On 04.03.2013 07:20, Aaron Yung wrote:
Hi All
I am curious about the OBS webui communication with the backend api, so I begin to study ROR for some days. Is there a easy way to understand the communication between OBS frontend webui and the backend api , just like some docs about activexml module or for developers?
activexml is basically two things: the HTTP implementation as part of transport.rb and on top of that is the Node, which is parsing the XML returned from the API into a ruby tree. For this to work every API route needs to be mapped to a model and a route, so you can find in config/initializers/activexml.rb e.g. map.connect :statusmessage, 'rest:///status/messages/:id/?:limit' This maps to app/models/statusmessage.rb, so you can use Statusmessage.find(:id => params[:message_id]) This will then call into $APIURL/status/messages/#{params[:message_id} and the returned XML is available in the model. So e.g. see this example: irb(main):003:0> Statusmessage.find(id: 1).message.msg_id => "1" irb(main):004:0> Statusmessage.find(id: 1).value(:message) => "Now we have status messages ... watch out for notes here, if you encounter problems." Greetings, Stephan -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org