Hey all, I see this line of code: RestClient.send(verb, url, parameters) Basically there's two rails application that communicate with each other. RestClient is a rails gem. Here we send the get http verb and a url string comprising of the other application base url and append a query string to it consisting of the new user email that is being created. So if the arguments are these: RestClient.send(:get, email@example.com) What exactly would RestClient get back as the response? I don't mean this specific case, but I mean what is supposed to be sent back to client in general. Or even if it is the ruby send method, what exactly is RestClient doing with these two parameters? I looked in documentation: https://github.com/archiloque/rest-client and it didn't give a clear answer. The documentation shows you how to use it but it doesn't explain why you would want to do something about. Before I understand how to use it, I think I need to know why. It appears to have nothing to do with cookies and that's typically how you can maintain a browser state from one app to the next. Thanks for response.
on 2011-05-06 02:53
on 2011-05-06 09:07
On 6 May 2011, at 01:53, John Merlino <firstname.lastname@example.org> wrote: > created. So if the arguments are these: > I looked in documentation: > > https://github.com/archiloque/rest-client > > and it didn't give a clear answer. Which bit of for results code between 200 and 207 a RestClient::Response will be returned for results code 301, 302 or 307 the redirection will be followed if the request is a get or a head for result code 303 the redirection will be followed and the request transformed into a get for other cases a RestClient::Exception holding the Response will be raised, a specific exception class will be thrown for known error codes Is not clear? > The documentation shows you how to > use it but it doesn't explain why you would want to do something about. > Before I understand how to use it, I think I need to know why. It > appears to have nothing to do with cookies and that's typically how you > can maintain a browser state from one app to the next. > It sends http requests. Why you would want to send http requests is up to you Fred
on 2011-05-06 09:46
John, RestClient is a thin wrapper fot Net::HTTP standard library http://www.ruby-doc.org/stdlib/libdoc/net/http/rdo... And it assumes that you already know how to use it and why; it just simplifies (if you know how to use Net::HTTP) usage of Net:HTTP. My advice is instead of getting stuck at RestClient documentation look at documentation for Net::HTTP and only then jump directly to RestClient source code, which is pretty simple and self explanatory; you don't event have to go to source code in your local gem, just use github: https://github.com/archiloque/rest-client/tree/mas... Hope it helps. ---- http://blog.eugen.co
on 2011-08-31 19:09
thanks for responses