I’m doing some work with Adcourier. They send me an xml feed with some job data, i.e. job_title, job_description and so on.
I’d like to provide them with a url in my application, i.e. myapp:3000/job/inbox. When they send their feed to that URL, it takes the data and stores it in my database on a Job object that I already created.
-
What’s the best way to structure this? I’m quite new to MVC and i’m not sure where something like this would fit.
-
How can I get an action to interpret the XML feed from an external source? I use Nokogiri to handle local XMl documents, but never ones from a feed.
I was thinking about using http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-raw_post to handle the post. Doest anyone any thoughts on this?
In your job controller add a action inbox which gets the correct parameter(s) from the post request and saves them (or whatever you need to do with it).
Next set your routes.rb to send posts request for that URL to the correct location
Note I did just made up the xml parse stuff here, just google a bit to find out what would be the best solution/gem for parsing your request.