README.md in my_api_client-0.22.0 vs README.md in my_api_client-0.23.0
- old
+ new
@@ -10,12 +10,12 @@
[toc]
## Supported Versions
-* Ruby 2.6, 2.7, 3.0
-* Rails 5.2, 6.0, 6.1, 7.0
+- Ruby 2.7, 3.0, 3.1
+- Rails 5.2, 6.0, 6.1, 7.0
## Installation
Add this line to your application's Gemfile:
@@ -81,11 +81,11 @@
The `endpoint` defines the intersection of the request URL. Each method described below defines a subsequent path. In the above example, `get 'users'` will request to `GET https://example.com/v1/users`.
Next, define `#initialize`. Suppose you want to set an Access Token, API Key, etc. as in the example above. You can omit the definition if you don't need it.
-Then define `# get_users` and` # post_user`. It's a good idea to give the method name the title of the API. I'm calling `# get` and` # post` inside the method, which is the HTTP Method at the time of the request. You can also use `#patch`` #put` `#delete`.
+Then define `#get_users` and `#post_user`. It's a good idea to give the method name the title of the API. I'm calling `#get` and `#post` inside the method, which is the HTTP Method at the time of the request. You can also use `#patch` `#put` `#delete`.
### Pagination
Some APIs include a URL in the response to get the continuation of the result.
@@ -114,11 +114,11 @@
```json
{
"links": {
"next": "https://example.com/pagination?page=3",
- "previous": "https://example.com/pagination?page=1",
+ "previous": "https://example.com/pagination?page=1"
},
"page": 2
}
```
@@ -214,14 +214,14 @@
In the above case, it matches JSON as below:
```json
{
- "erros": {
- "code": 10,
- "message": "Some error has occurred."
- }
+ "erros": {
+ "code": 10,
+ "message": "Some error has occurred."
+ }
}
```
By specifying the instance method name in `with`, when an error is detected, any method can be executed before raising an exception. The arguments passed to the method are `params` and `logger` as in the `block` definition. Note that `block` and` with` cannot be used at the same time.
@@ -333,12 +333,12 @@
retry: true
```
Keep the following in mind when using the `retry` option:
-* The `raise` option must be specified for `error_handling`
-* Definition of `error_handling` using `block` is prohibited
+- The `raise` option must be specified for `error_handling`
+- Definition of `error_handling` using `block` is prohibited
#### MyApiClient::NetworkError
As mentioned above, in MyApiClient, network exceptions are collectively `raised` as `MyApiClient::NetworkError`. Like the other exceptions, it has `MyApiClient::Error` as its parent class. A list of exception classes treated as `MyApiClient::NetworkError` can be found in `MyApiClient::NETWORK_ERRORS`. You can also refer to the original exception with `#original_error`:
@@ -402,10 +402,9 @@
'Authorization': "Bearer #{access_token}",
}
end
end
```
-
WIP
### Stubbing