Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Enhanced RDoc for Net::HTTP #77

Merged
merged 5 commits into from
Nov 18, 2022
Merged

[DOC] Enhanced RDoc for Net::HTTP #77

merged 5 commits into from
Nov 18, 2022

Conversation

BurdetteLamar
Copy link
Member

  • Revises most of class doc for Net::HTTP. (Does not modify sections "Following Redirection" and after.)
  • Treats a few methods, including Net::HTTP.start.
  • Adds to class docs for Net::HTTPRequest and Net::HTTPResponse.

@BurdetteLamar BurdetteLamar added the documentation Improvements or additions to documentation label Nov 15, 2022
lib/net/http.rb Outdated
# connections. They are not recommended if you are performing many HTTP
# requests.
# - https://jsonplaceholder.typicode.com.
# - http:example.com.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# - http:example.com.
# - http://example.com.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed (3 places). Should "About the Examples" be pushed out to an includable file (in a future PR)? It's now used in three places, and may be in more.

lib/net/http.rb Outdated Show resolved Hide resolved
lib/net/http.rb Outdated Show resolved Hide resolved
lib/net/http.rb Outdated Show resolved Hide resolved
lib/net/http.rb Outdated Show resolved Hide resolved
lib/net/http.rb Show resolved Hide resolved
lib/net/http/request.rb Outdated Show resolved Hide resolved
lib/net/http/response.rb Outdated Show resolved Hide resolved
lib/net/http/request.rb Outdated Show resolved Hide resolved
lib/net/http/response.rb Outdated Show resolved Hide resolved
@BurdetteLamar
Copy link
Member Author

Wrt headers, they have no apparent effect on either host we've mentioned. Would it be useful to introduce another "real" host (github rest api, for example) to have more "real" examples? (But not in this PR.)

Copy link
Member

@peterzhu2118 peterzhu2118 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like https://httpbin.org/ that is more of a "swiss army knife" of endpoints to test various things would be useful (to demo things like headers, authentication, status codes, redirect, etc.).

lib/net/http/request.rb Outdated Show resolved Hide resolved
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
@BurdetteLamar
Copy link
Member Author

Maybe something like https://httpbin.org/ that is more of a "swiss army knife" of endpoints to test various things would be useful (to demo things like headers, authentication, status codes, redirect, etc.).

I'll look into that. (But not for this PR?)

@BurdetteLamar
Copy link
Member Author

A reader pointed out (offline) that I'd added to request.rb a new section for each of the 15 subclasses, but with text and examples for only three. For some (perhaps most) of the requests, the example host will not behave well; so I have removed the new sections altogether.

Comment on lines +9 to +23
# - \Net::HTTP::Get
# - \Net::HTTP::Head
# - \Net::HTTP::Post
# - \Net::HTTP::Delete
# - \Net::HTTP::Options
# - \Net::HTTP::Trace
# - \Net::HTTP::Patch
# - \Net::HTTP::Put
# - \Net::HTTP::Copy
# - \Net::HTTP::Lock
# - \Net::HTTP::Mkcol
# - \Net::HTTP::Move
# - \Net::HTTP::Propfind
# - \Net::HTTP::Proppatch
# - \Net::HTTP::Unlock
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove the escaping so that it links to the subclasses?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subclasses' docs are empty(ish).

Comment on lines +9 to +23
# - \Net::HTTP::Get
# - \Net::HTTP::Head
# - \Net::HTTP::Post
# - \Net::HTTP::Delete
# - \Net::HTTP::Options
# - \Net::HTTP::Trace
# - \Net::HTTP::Patch
# - \Net::HTTP::Put
# - \Net::HTTP::Copy
# - \Net::HTTP::Lock
# - \Net::HTTP::Mkcol
# - \Net::HTTP::Move
# - \Net::HTTP::Propfind
# - \Net::HTTP::Proppatch
# - \Net::HTTP::Unlock
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this list sorted? Should we sort it alphabetically (or some other way) so it's more intuitive to read?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're in the order as given in the Wikipedia docs we've linked (which I assumed is the same as in the underlying specs):

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that makes sense. I wonder how Wikipedia orders their list 🤔

@BurdetteLamar BurdetteLamar merged commit a1b7031 into ruby:master Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Development

Successfully merging this pull request may close these issues.

2 participants