README.md in rest-man-1.0.0 vs README.md in rest-man-1.1.0
- old
+ new
@@ -1,32 +1,30 @@
# REST Man -- simple DSL for accessing HTTP and REST resources
+[](https://github.com/rest-man/rest-man/actions/workflows/ci.yml)
+[](https://www.codacy.com/gh/rest-man/rest-man/dashboard?utm_source=github.com&utm_medium=referral&utm_content=rest-man/rest-man&utm_campaign=Badge_Grade)
+[](https://www.codacy.com/gh/rest-man/rest-man/dashboard?utm_source=github.com&utm_medium=referral&utm_content=rest-man/rest-man&utm_campaign=Badge_Coverage)
+
A simple HTTP and REST client for Ruby, inspired by the Sinatra's microframework style
of specifying actions: get, put, post, delete.
This is a fork version of [rest-client](https://github.com/rest-client/rest-client)
## Requirements
-MRI Ruby 2.0 and newer are supported. Alternative interpreters compatible with
-2.0+ should work as well.
+Supported Ruby versions
-Earlier Ruby versions such as 1.8.7, 1.9.2, and 1.9.3 are no longer supported. These
-versions no longer have any official support, and do not receive security
-updates.
+| 2.6 | 2.7 | 3.0 | 3.1 | 3.2 | 3.3-Preview |
+| ---- | ---- | ---- | ---- | ---- | ---- |
+| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
-The rest-man gem depends on these other gems for usage at runtime:
+Supported JRuby versions
-* [mime-types](http://rubygems.org/gems/mime-types)
-* [netrc](http://rubygems.org/gems/netrc)
-* [http-accept](https://rubygems.org/gems/http-accept)
-* [http-cookie](https://rubygems.org/gems/http-cookie)
+| 9.3 | 9.4 |
+| ---- | ---- |
+| ✅ | ✅ |
-There are also several development dependencies. It's recommended to use
-[bundler](http://bundler.io/) to manage these dependencies for hacking on
-rest-man.
-
## Usage: Raw URL
Basic usage:
```ruby
@@ -200,11 +198,11 @@
### Redirection
By default, rest-man will follow HTTP 30x redirection requests.
-__New in 2.0:__ `RestMan::Response` exposes a `#history` method that returns
+`RestMan::Response` exposes a `#history` method that returns
a list of each response received in a redirection chain.
```ruby
>> r = RestMan.get('http://httpbin.org/redirect/2')
=> <RestMan::Response 200 "{\n \"args\":...">
@@ -222,16 +220,10 @@
#### Manually following redirection
To disable automatic redirection, set `:max_redirects => 0`.
-__New in 2.0:__ Prior versions of rest-man would raise
-`RestMan::MaxRedirectsReached`, with no easy way to access the server's
-response. In 2.0, rest-man raises the normal
-`RestMan::ExceptionWithResponse` as it would with any other non-HTTP-20x
-response.
-
```ruby
>> RestMan::Request.execute(method: :get, url: 'http://httpbin.org/redirect/1')
=> RestMan::Response 200 "{\n "args":..."
>> RestMan::Request.execute(method: :get, url: 'http://httpbin.org/redirect/1', max_redirects: 0)
@@ -256,10 +248,18 @@
=> "/get"
>> err.response.follow_redirection
=> RestMan::Response 200 "{\n "args":..."
```
+#### Manually set max retries
+
+The default max_retries is 1. You can change it to any number you like.
+
+```ruby
+RestMan::Request.execute(method: :get, url: 'http://httpbin.org', max_retires: 0)
+```
+
## Result handling
The result of a `RestMan::Request` is a `RestMan::Response` object.
`RestMan::Response` objects are a subclass of `String`.
@@ -269,13 +269,13 @@
- `Response#code`: The HTTP response code
- `Response#body`: The response body as a string. (AKA .to_s)
- `Response#headers`: A hash of HTTP response headers
- `Response#raw_headers`: A hash of HTTP response headers as unprocessed arrays
- `Response#cookies`: A hash of HTTP cookies set by the server
-- `Response#cookie_jar`: <em>New in 1.8</em> An HTTP::CookieJar of cookies
+- `Response#cookie_jar`: An HTTP::CookieJar of cookies
- `Response#request`: The RestMan::Request object used to make the request
-- `Response#history`: <em>New in 2.0</em> If redirection was followed, a list of prior Response objects
+- `Response#history`: If redirection was followed, a list of prior Response objects
```ruby
RestMan.get('http://example.com')
➔ <RestMan::Response 200 "<!doctype h...">
@@ -600,11 +600,11 @@
```ruby
RestMan.proxy = ENV['http_proxy']
```
-__New in 2.0:__ Specify a per-request proxy by passing the :proxy option to
+Specify a per-request proxy by passing the :proxy option to
RestMan::Request. This will override any proxies set by environment variable
or by the global `RestMan.proxy` value.
```ruby
RestMan::Request.execute(method: :get, url: 'http://example.com',
@@ -700,11 +700,11 @@
GET:
{"outer"=>{"foo"=>"123", "bar"=>"456"}}
```
-__New in 2.0:__ The new `RestMan::ParamsArray` class allows callers to
+The `RestMan::ParamsArray` class allows callers to
provide ordering even to structured parameters. This is useful for unusual
cases where the server treats the order of parameters as significant or you
want to pass a particular key multiple times.
Multiple fields with the same name using ParamsArray:
@@ -739,22 +739,22 @@
## Timeouts
By default the timeout for a request is 60 seconds. Timeouts for your request can
be adjusted by setting the `timeout:` to the number of seconds that you would like
-the request to wait. Setting `timeout:` will override both `read_timeout:` and `open_timeout:`.
+the request to wait. Setting `timeout:` will override `read_timeout:`, `open_timeout:` and `write_timeout`.
```ruby
RestMan::Request.execute(method: :get, url: 'http://example.com/resource',
timeout: 120)
```
-Additionally, you can set `read_timeout:` and `open_timeout:` separately.
+Additionally, you can set `read_timeout:`, `open_timeout:` and `write_timeout` separately.
```ruby
RestMan::Request.execute(method: :get, url: 'http://example.com/resource',
- read_timeout: 120, open_timeout: 240)
+ read_timeout: 120, open_timeout: 240, write_timeout: 120)
```
## Cookies
Request and Response objects know about HTTP cookies, and will automatically
@@ -770,17 +770,13 @@
{:param1 => "foo"},
{:cookies => {:session_id => "1234"}}
)
# ...response body
```
-### Full cookie jar support (new in 1.8)
+### Full cookie jar support
-The original cookie implementation was very naive and ignored most of the
-cookie RFC standards.
-__New in 1.8__: An HTTP::CookieJar of cookies
-
-Response objects now carry a cookie_jar method that exposes an HTTP::CookieJar
+Response objects carry a cookie_jar method that exposes an HTTP::CookieJar
of cookies, which supports full standards compliant behavior.
## SSL/TLS support
Various options are supported for configuring rest-man's TLS settings. By
@@ -836,8 +832,5 @@
Released under the MIT License: https://opensource.org/licenses/MIT
Photo of the International Space Station was produced by NASA and is in the
public domain.
-
-Code for reading Windows root certificate store derived from work by Puppet;
-used under terms of the Apache License, Version 2.0.