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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71ed0653306657ab17cbd542675c716d5381cd06
4
- data.tar.gz: bebe5e700ed097dbca730fefff7f5c62be3efd87
3
+ metadata.gz: 2fb219a855dbef54fa310d71427f145600294b93
4
+ data.tar.gz: ae10d8b1b9d05f31c3a6accc6482e1e3a5889bc4
5
5
  SHA512:
6
- metadata.gz: b4c7112cc67f4233fd237e6f61e22c4353e6943eb737f78ec37baf80baeea73c1fbf83b43ae62ff97ea83a178958d20d9f4d2bdf50ec969ef93753c68a6d1669
7
- data.tar.gz: c21aef948911ae76b705e5c704e202e75dff67c909d824437aa3da71710f775d332e7b37da79e468b06d440fa12e22df8698695c1104be5dcdfe89382aaa6184
6
+ metadata.gz: 352a18c44ea820ac5b1150eb4be54b517a2b4f7b009ccef0fe5ce41f98f1c4f82ff7a07b66622771c02983123fb5e163f68a8315ad4b41210477c2878838cbdf
7
+ data.tar.gz: 26e837627e09278c5eb11cf82a227380f0d372cbae361bf5af61b7ce45fbf022ada1044c95c60202e82dd3c79a9f7b14f6c7e261c3736b1e7943687fb8f6427f
@@ -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'
@@ -0,0 +1,10 @@
1
+ class Cadooz::Immutable::Response
2
+ attr_reader :object, :raw
3
+
4
+ def initialize(object, raw_response)
5
+ @object = object
6
+ @raw = raw_response
7
+
8
+ self.freeze
9
+ end
10
+ end
@@ -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
- object.each_with_object([]) { |o, arr| arr << Object::const_get(response_class.to_s).new(o) }
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
- Object::const_get(response_class.to_s).new(object)
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
@@ -1,3 +1,3 @@
1
1
  module Cadooz
2
- VERSION = '1.0.7'
2
+ VERSION = '2.0.0'
3
3
  end
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: 1.0.7
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-09 00:00:00.000000000 Z
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