I have seen code such as:
Net::HTTP::Post.new(url)
If I then use ri
as follows:
$ ri Net::HTTP::Post
I get almost no documentation, and:
$ ri Net::HTTP::Post.new
results in
Nothing known about Net::HTTP::Post.new
When reading the documentation for Net::HTTP
, I get the suspicion that the code should be using Net::HTTP#request_post
instead. I still find the correct way to use this module confusing. Why does Net::HTTP::Post.net
seem to work? Even with the Net::HTTP.request_post
, I get:
undefined method `request_post' for Net::HTTP:Class.
To clarify my question, what I want is to know how to:
- Find the best documentation for ruby.
- Given the example provided, obtain the best way to achieve the aim (which is, to make an HTTP POST request, I'll add that I need to use provide authentication, cookie, and data in the body).
- Make sense of what it means when the methods have been annotated with 'R' (does that mean 'read-only'? That doesn't make sense because I need to set the request body, which implies write...
As a contrast, this is equivalent documentation for Python, which I understand (being a python dev myself): http://docs.python.org/2/library/httplib.html