json_api_client 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/lib/json_api_client/query/builder.rb +4 -0
- data/lib/json_api_client/resource.rb +1 -1
- data/lib/json_api_client/schema.rb +3 -0
- data/lib/json_api_client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0d020be7e9bf6e1b22999ffc3a0acde1ecc5625
|
4
|
+
data.tar.gz: 5125ad8d9ea03cf4cf58c77e4031d678de6778f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 625e1b33f72351b242e9d3ed4920b43be7ab14c150c71eeb3d7f5f077a644d5bc8dfee01c58855735e3095d5f084e32ecd86ce0f3075f70bd869b1765e72b3c9
|
7
|
+
data.tar.gz: 7f8675ae9030f8b1d4d1342d77075c73f117715a0b3b8540144ca7074701e38fbed1f0e3b4c793fbddcdb588d627ae166beda7c2908d79fe7cd3f0ab66677205
|
data/README.md
CHANGED
@@ -188,7 +188,7 @@ user.verify(foo: 'bar')
|
|
188
188
|
|
189
189
|
[See specification](http://jsonapi.org/format/#fetching-includes)
|
190
190
|
|
191
|
-
If the response returns a [compound document](http://jsonapi.org/format/#document-
|
191
|
+
If the response returns a [compound document](http://jsonapi.org/format/#document-compound-documents), then we should be able to get the related resources.
|
192
192
|
|
193
193
|
```ruby
|
194
194
|
# makes request to /articles/1?include=author,comments.author
|
@@ -338,6 +338,15 @@ end
|
|
338
338
|
MyApi::SomeResource.all
|
339
339
|
```
|
340
340
|
|
341
|
+
### Custom headers
|
342
|
+
|
343
|
+
You can inject custom headers on resource request by wrapping your code into block:
|
344
|
+
```ruby
|
345
|
+
MyApi::SomeResource.with_headers(x_access_token: 'secure_token_here') do
|
346
|
+
MyApi::SomeResource.find(1)
|
347
|
+
end
|
348
|
+
```
|
349
|
+
|
341
350
|
### Connections
|
342
351
|
|
343
352
|
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.
|
@@ -56,7 +56,7 @@ module JsonApiClient
|
|
56
56
|
|
57
57
|
class << self
|
58
58
|
extend Forwardable
|
59
|
-
def_delegators :_new_scope, :where, :order, :includes, :select, :all, :paginate, :page, :with_params, :first, :find
|
59
|
+
def_delegators :_new_scope, :where, :order, :includes, :select, :all, :paginate, :page, :with_params, :first, :find, :last
|
60
60
|
|
61
61
|
# The table name for this resource. i.e. Article -> articles, Person -> people
|
62
62
|
#
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'bigdecimal'
|
1
2
|
module JsonApiClient
|
2
3
|
class Schema
|
3
4
|
Property = Struct.new(:name, :type, :default) do
|
@@ -14,6 +15,8 @@ module JsonApiClient
|
|
14
15
|
value.to_f
|
15
16
|
when :time
|
16
17
|
value.is_a?(Time) || nil ? value : Time.parse(value)
|
18
|
+
when :decimal
|
19
|
+
value.nil? ? nil : BigDecimal.new(value)
|
17
20
|
when :boolean
|
18
21
|
case value
|
19
22
|
when "false", "0", 0, false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Ching
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project:
|
179
|
-
rubygems_version: 2.
|
179
|
+
rubygems_version: 2.5.2
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: Build client libraries compliant with specification defined by jsonapi.org
|