This has been answered already. Please learn how to search the Ruby API category.
So in this other topic, it is explained how to create a transformation and apply it to the group’s definition’s entities collection.
There is also a more complex code example in this topic (if instances need to be adjusted) …
[Partially Solved] Rotation transformation not working for me - why not? - #8 by eneroth3