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, www.otherapp.com/users/email?email=johnmerlino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) 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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 6 May 2011, at 01:53, John Merlino <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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, > www.otherapp.com/users/email?email=johnmerlino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) > > > 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.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> Thanks for response. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
John, RestClient is a thin wrapper fot Net::HTTP standard library http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html 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/master/lib/restclient Hope it helps. ---- http://blog.eugen.co -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thanks for responses -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.