how to call a libreoffice macro from a rails application?

I have document which should be changed with the help of macros. I have the macros in place, now need to call and invoke the macro(.xba file) from my rails application in-order to change the document.

libreoffice Arch: x86_64 Epoch: 1 Version: 4.2.8.2 Release: 11.el6

Language: Ruby on Rails

[Edit: added lo4 tag]