json_api_client 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/json_api_client/error_collector.rb +5 -3
- data/lib/json_api_client/resource.rb +2 -1
- data/lib/json_api_client/schema.rb +8 -4
- data/lib/json_api_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8321eeb175cf8813d29558dd026494b395e46de2
|
|
4
|
+
data.tar.gz: f43c277cea007075b8a2e50950a03e6828dd78ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2a4359579478dd853e4cf2c487385cdae6da8d7bb6e89f24fbdd26a67a241d5fa2cc0d5c76de7bf7f7a9b594063a772ae0dd7dc65639a97794f630b488d3468
|
|
7
|
+
data.tar.gz: da0d908b8db521d6a3f2b02834ce8c0a9f3056774c4d1e400ef1d018f9af95f516f683aab8abf1c41a07011c207debf444748b883b397b7405febc8038d639a1
|
data/README.md
CHANGED
|
@@ -12,7 +12,8 @@ module JsonApiClient
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def about
|
|
15
|
-
attrs.fetch(:links, {})
|
|
15
|
+
res = attrs.fetch(:links, {})
|
|
16
|
+
res ? res[:about] : {}
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
def status
|
|
@@ -48,7 +49,8 @@ module JsonApiClient
|
|
|
48
49
|
end
|
|
49
50
|
|
|
50
51
|
def source
|
|
51
|
-
attrs.fetch(:source, {})
|
|
52
|
+
res = attrs.fetch(:source, {})
|
|
53
|
+
res ? res : {}
|
|
52
54
|
end
|
|
53
55
|
|
|
54
56
|
def meta
|
|
@@ -77,4 +79,4 @@ module JsonApiClient
|
|
|
77
79
|
end
|
|
78
80
|
|
|
79
81
|
end
|
|
80
|
-
end
|
|
82
|
+
end
|
|
@@ -267,7 +267,7 @@ module JsonApiClient
|
|
|
267
267
|
end
|
|
268
268
|
self.attributes = params.merge(self.class.default_attributes)
|
|
269
269
|
self.class.schema.each_property do |property|
|
|
270
|
-
attributes[property.name] = property.default unless attributes.has_key?(property.name)
|
|
270
|
+
attributes[property.name] = property.default unless attributes.has_key?(property.name) || property.default.nil?
|
|
271
271
|
end
|
|
272
272
|
end
|
|
273
273
|
|
|
@@ -363,6 +363,7 @@ module JsonApiClient
|
|
|
363
363
|
mark_as_persisted!
|
|
364
364
|
if updated = last_result_set.first
|
|
365
365
|
self.attributes = updated.attributes
|
|
366
|
+
self.relationships.attributes = updated.relationships.attributes
|
|
366
367
|
clear_changes_information
|
|
367
368
|
end
|
|
368
369
|
true
|
|
@@ -15,10 +15,14 @@ module JsonApiClient
|
|
|
15
15
|
when :time
|
|
16
16
|
value.is_a?(Time) || nil ? value : Time.parse(value)
|
|
17
17
|
when :boolean
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
case value
|
|
19
|
+
when "false", "0", 0, false
|
|
20
|
+
false
|
|
21
|
+
when "true", "1", 1, true
|
|
22
|
+
true
|
|
20
23
|
else
|
|
21
|
-
|
|
24
|
+
# if it's unknown, use the default value
|
|
25
|
+
default
|
|
22
26
|
end
|
|
23
27
|
else
|
|
24
28
|
value
|
|
@@ -63,4 +67,4 @@ module JsonApiClient
|
|
|
63
67
|
end
|
|
64
68
|
alias_method :[], :find
|
|
65
69
|
end
|
|
66
|
-
end
|
|
70
|
+
end
|
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.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeff Ching
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-10-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|