README.md in json_api_client-1.3.0 vs README.md in json_api_client-1.4.0
- old
+ new
@@ -186,11 +186,11 @@
## Fetching Includes
[See specification](http://jsonapi.org/format/#fetching-includes)
-If the response returns a [compound document](http://jsonapi.org/format/#document-structure-compound-documents), then we should be able to get the related resources.
+If the response returns a [compound document](http://jsonapi.org/format/#document-compound-documents), then we should be able to get the related resources.
```ruby
# makes request to /articles/1?include=author,comments.author
results = Article.includes(:author, :comments => :author).find(1)
@@ -334,9 +334,18 @@
end
end
# requests http://example.com/foobar
MyApi::SomeResource.all
+```
+
+### Custom headers
+
+You can inject custom headers on resource request by wrapping your code into block:
+```ruby
+MyApi::SomeResource.with_headers(x_access_token: 'secure_token_here') do
+ MyApi::SomeResource.find(1)
+end
```
### Connections
You can configure your API client to use a custom connection that implementes the `run` instance method. It should return data that your parser can handle. The default connection class wraps Faraday and lets you add middleware.