dimanche 2 août 2015

RESTful for Ruby on Rails

I am currently managing a backoffice made in Ruby on Rails. I need to receive a .zip file from another Rails-based application with some configurations in xml. For that, I've been asked to create a RESTful interface which makes available an URL, that will be used by the other application to deploy the zip file in it. I know I'll have to use POST method. I've tried the Sinatra gem, and I've tried using Webrick. I was able to open some port and render my address with Sinatra. With Webrick, I was able to open some listening port, but it collided somehow with my rails app. Now, I'm using Net::HTTP class, and generating a request and response. I am not sure of what I'm doing, though. My code:

http = Net::HTTP.new("someURL")
request = Net::HTTP::Post.new("/deployURL")
response = http.request(request)

Anyone has a tip on which steps to follow, and what would be the easiest implementation?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire