cadooz 1.0.7 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cadooz.rb +1 -0
- data/lib/cadooz/models/immutable/response.rb +10 -0
- data/lib/cadooz/services/business_order_service.rb +10 -2
- data/lib/cadooz/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fb219a855dbef54fa310d71427f145600294b93
|
4
|
+
data.tar.gz: ae10d8b1b9d05f31c3a6accc6482e1e3a5889bc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 352a18c44ea820ac5b1150eb4be54b517a2b4f7b009ccef0fe5ce41f98f1c4f82ff7a07b66622771c02983123fb5e163f68a8315ad4b41210477c2878838cbdf
|
7
|
+
data.tar.gz: 26e837627e09278c5eb11cf82a227380f0d372cbae361bf5af61b7ce45fbf022ada1044c95c60202e82dd3c79a9f7b14f6c7e261c3736b1e7943687fb8f6427f
|
data/lib/cadooz.rb
CHANGED
@@ -45,6 +45,7 @@ require_relative 'cadooz/models/immutable/order_position'
|
|
45
45
|
require_relative 'cadooz/models/immutable/order_status'
|
46
46
|
require_relative 'cadooz/models/immutable/payment'
|
47
47
|
require_relative 'cadooz/models/immutable/product_category'
|
48
|
+
require_relative 'cadooz/models/immutable/response.rb'
|
48
49
|
require_relative 'cadooz/models/immutable/voucher'
|
49
50
|
require_relative 'cadooz/models/mutable/address'
|
50
51
|
require_relative 'cadooz/models/mutable/greeting_card'
|
@@ -116,6 +116,8 @@ class Cadooz::BusinessOrderService
|
|
116
116
|
private
|
117
117
|
|
118
118
|
def deserialize(response, response_class, operation)
|
119
|
+
response_wrapper = Cadooz::Immutable::Response
|
120
|
+
|
119
121
|
key = (operation.to_s + '_response').to_sym
|
120
122
|
body = response.body[key][:return]
|
121
123
|
|
@@ -126,9 +128,15 @@ class Cadooz::BusinessOrderService
|
|
126
128
|
end
|
127
129
|
|
128
130
|
if object.class == Array
|
129
|
-
|
131
|
+
response_wrapper.new(
|
132
|
+
object.each_with_object([]) { |o, arr| arr << Object::const_get(response_class.to_s).new(o) },
|
133
|
+
response.xml
|
134
|
+
)
|
130
135
|
elsif object.class == OpenStruct
|
131
|
-
|
136
|
+
response_wrapper.new(
|
137
|
+
Object::const_get(response_class.to_s).new(object),
|
138
|
+
response.xml
|
139
|
+
)
|
132
140
|
else
|
133
141
|
# TODO handle exception
|
134
142
|
end
|
data/lib/cadooz/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cadooz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Brown
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/cadooz/models/immutable/order_status.rb
|
79
79
|
- lib/cadooz/models/immutable/payment.rb
|
80
80
|
- lib/cadooz/models/immutable/product_category.rb
|
81
|
+
- lib/cadooz/models/immutable/response.rb
|
81
82
|
- lib/cadooz/models/immutable/voucher.rb
|
82
83
|
- lib/cadooz/models/mutable/address.rb
|
83
84
|
- lib/cadooz/models/mutable/greeting_card.rb
|