cadooz 2.0.0 → 2.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/lib/cadooz/services/business_order_service.rb +23 -2
- data/lib/cadooz/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: 4b948e4c69b934df883cf6f277c4bffc2060d502
|
4
|
+
data.tar.gz: 6f4d9443f5613b33d34dc3ab887a3ba660b6a719
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bd38daf2d660e23c521cb273a3b537fbd166c812714c9d329d02b85d6df5fcc193f9deef443ff41014d46d4f2d566a873387c3516de2b93a5d8adb31c89e50d
|
7
|
+
data.tar.gz: 7f0e4976e7a5726928b454f68e5a28cba7fbc24a6ab9044c6f46166a56b1807997c3bc44a87c95ce192146bfe57034dd43b348ff92eeb049e3897aa88baceca7
|
@@ -127,18 +127,39 @@ class Cadooz::BusinessOrderService
|
|
127
127
|
object = JSON.parse(body.to_json, object_class: OpenStruct)
|
128
128
|
end
|
129
129
|
|
130
|
+
response_object = nil
|
131
|
+
|
130
132
|
if object.class == Array
|
131
|
-
response_wrapper.new(
|
133
|
+
wrapper = response_wrapper.new(
|
132
134
|
object.each_with_object([]) { |o, arr| arr << Object::const_get(response_class.to_s).new(o) },
|
133
135
|
response.xml
|
134
136
|
)
|
137
|
+
response_object = wrapper unless nil_check(wrapper.object.first)
|
135
138
|
elsif object.class == OpenStruct
|
136
|
-
response_wrapper.new(
|
139
|
+
wrapper = response_wrapper.new(
|
137
140
|
Object::const_get(response_class.to_s).new(object),
|
138
141
|
response.xml
|
139
142
|
)
|
143
|
+
response_object = wrapper unless nil_check(wrapper.object)
|
140
144
|
else
|
141
145
|
# TODO handle exception
|
142
146
|
end
|
147
|
+
|
148
|
+
response_object
|
149
|
+
end
|
150
|
+
|
151
|
+
def nil_check(object)
|
152
|
+
object.instance_variables.each do |v|
|
153
|
+
value = object.instance_variable_get(v)
|
154
|
+
if value.class.to_s.include?('Cadooz::Immutable')
|
155
|
+
nil_check(value)
|
156
|
+
elsif value.class == Money
|
157
|
+
return false unless value.cents == 0
|
158
|
+
else
|
159
|
+
return false unless value.nil?
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
true
|
143
164
|
end
|
144
165
|
end
|
data/lib/cadooz/version.rb
CHANGED