vhx-ruby 0.0.2 → 0.0.3
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/lib/vhx/utilities/vhx_object.rb +4 -5
- data/lib/vhx/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bff7a0ec7641e6a810850cd1d4b227fc4c7bf9f6
|
4
|
+
data.tar.gz: 55b7b5aedf57718ed9ac3b9eef362c8796a2e2cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c76cadac0d4604ea1dbf1b059bd9ddaf4fb9c1773d65de89e629622d4d348a1834c30fca884ceb7b37b6136cbd304abb36cc73849d62f16b6e166953909d9da
|
7
|
+
data.tar.gz: 42820006cf0e3c6d88be027b57a5cf21183fadec974f9d3fd97e2919d87184a1dca9345b9d0ee2a39c700ab8ce2db1acb4af609937da7a554f2ba31d7ee56cf6
|
@@ -57,9 +57,8 @@ module Vhx
|
|
57
57
|
def create_readers(obj_hash)
|
58
58
|
obj_hash.keys.each do |key|
|
59
59
|
next if key.match(/embedded|links/)
|
60
|
-
self.class.send(:
|
61
|
-
|
62
|
-
end
|
60
|
+
self.class.send(:attr_reader, key)
|
61
|
+
instance_variable_set("@#{key}", obj_hash[key])
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
@@ -68,11 +67,11 @@ module Vhx
|
|
68
67
|
associations.each do |association_method|
|
69
68
|
self.class.send(:define_method, association_method) do |payload = {}|
|
70
69
|
if payload.empty? && obj_hash['_embedded'] && obj_hash['_embedded'].fetch(association_method, []).length > 0
|
71
|
-
return fetch_embedded_association(obj_hash, association_method)
|
70
|
+
return instance_variable_set("@#{association_method}", fetch_embedded_association(obj_hash, association_method))
|
72
71
|
end
|
73
72
|
|
74
73
|
if obj_hash['_links'] && obj_hash['_links'].fetch(association_method, []).length > 0
|
75
|
-
return fetch_linked_association(obj_hash, association_method, payload)
|
74
|
+
return instance_variable_set("@#{association_method}", fetch_linked_association(obj_hash, association_method, payload))
|
76
75
|
end
|
77
76
|
|
78
77
|
raise InvalidResourceError.new 'Association does not exist'
|
data/lib/vhx/version.rb
CHANGED