ultracart_api 3.1.40 → 3.1.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -4
  3. data/docs/OrderApi.md +1 -1
  4. data/docs/OrderSummary.md +1 -0
  5. data/docs/ScreenRecordingFilterPageView.md +1 -0
  6. data/docs/ScreenRecordingFilterValuesPageView.md +1 -0
  7. data/docs/ScreenRecordingHeatmap.md +19 -0
  8. data/docs/ScreenRecordingHeatmapIndexResponse.md +12 -0
  9. data/docs/ScreenRecordingHeatmapRequest.md +9 -0
  10. data/docs/ScreenRecordingHeatmapReset.md +8 -0
  11. data/docs/ScreenRecordingHeatmapResponse.md +12 -0
  12. data/docs/ScreenRecordingHeatmapUrl.md +12 -0
  13. data/docs/ScreenRecordingPageView.md +1 -0
  14. data/docs/StorefrontApi.md +158 -0
  15. data/lib/ultracart_api.rb +6 -0
  16. data/lib/ultracart_api/api/order_api.rb +2 -2
  17. data/lib/ultracart_api/api/storefront_api.rb +176 -0
  18. data/lib/ultracart_api/models/order_summary.rb +10 -1
  19. data/lib/ultracart_api/models/screen_recording_filter_page_view.rb +10 -1
  20. data/lib/ultracart_api/models/screen_recording_filter_values_page_view.rb +12 -1
  21. data/lib/ultracart_api/models/screen_recording_heatmap.rb +283 -0
  22. data/lib/ultracart_api/models/screen_recording_heatmap_index_response.rb +223 -0
  23. data/lib/ultracart_api/models/screen_recording_heatmap_request.rb +193 -0
  24. data/lib/ultracart_api/models/screen_recording_heatmap_reset.rb +184 -0
  25. data/lib/ultracart_api/models/screen_recording_heatmap_response.rb +221 -0
  26. data/lib/ultracart_api/models/screen_recording_heatmap_url.rb +222 -0
  27. data/lib/ultracart_api/models/screen_recording_page_view.rb +10 -1
  28. data/lib/ultracart_api/version.rb +1 -1
  29. metadata +14 -2
@@ -16,6 +16,8 @@ module UltracartClient
16
16
  class OrderSummary
17
17
  attr_accessor :actual_fulfillment
18
18
 
19
+ attr_accessor :actual_payment_processing
20
+
19
21
  attr_accessor :actual_shipping
20
22
 
21
23
  attr_accessor :arbitrary_shipping_handling_total
@@ -52,6 +54,7 @@ module UltracartClient
52
54
  def self.attribute_map
53
55
  {
54
56
  :'actual_fulfillment' => :'actual_fulfillment',
57
+ :'actual_payment_processing' => :'actual_payment_processing',
55
58
  :'actual_shipping' => :'actual_shipping',
56
59
  :'arbitrary_shipping_handling_total' => :'arbitrary_shipping_handling_total',
57
60
  :'other_refunded' => :'other_refunded',
@@ -75,6 +78,7 @@ module UltracartClient
75
78
  def self.swagger_types
76
79
  {
77
80
  :'actual_fulfillment' => :'Currency',
81
+ :'actual_payment_processing' => :'Currency',
78
82
  :'actual_shipping' => :'Currency',
79
83
  :'arbitrary_shipping_handling_total' => :'Currency',
80
84
  :'other_refunded' => :'Currency',
@@ -106,6 +110,10 @@ module UltracartClient
106
110
  self.actual_fulfillment = attributes[:'actual_fulfillment']
107
111
  end
108
112
 
113
+ if attributes.has_key?(:'actual_payment_processing')
114
+ self.actual_payment_processing = attributes[:'actual_payment_processing']
115
+ end
116
+
109
117
  if attributes.has_key?(:'actual_shipping')
110
118
  self.actual_shipping = attributes[:'actual_shipping']
111
119
  end
@@ -190,6 +198,7 @@ module UltracartClient
190
198
  return true if self.equal?(o)
191
199
  self.class == o.class &&
192
200
  actual_fulfillment == o.actual_fulfillment &&
201
+ actual_payment_processing == o.actual_payment_processing &&
193
202
  actual_shipping == o.actual_shipping &&
194
203
  arbitrary_shipping_handling_total == o.arbitrary_shipping_handling_total &&
195
204
  other_refunded == o.other_refunded &&
@@ -217,7 +226,7 @@ module UltracartClient
217
226
  # Calculates hash code according to all attributes.
218
227
  # @return [Fixnum] Hash code
219
228
  def hash
220
- [actual_fulfillment, actual_shipping, arbitrary_shipping_handling_total, other_refunded, shipping_handling_refunded, shipping_handling_total, shipping_handling_total_discount, subtotal, subtotal_discount, subtotal_discount_refunded, subtotal_refunded, tax, tax_refunded, taxable_subtotal, taxable_subtotal_discount, total, total_refunded].hash
229
+ [actual_fulfillment, actual_payment_processing, actual_shipping, arbitrary_shipping_handling_total, other_refunded, shipping_handling_refunded, shipping_handling_total, shipping_handling_total_discount, subtotal, subtotal_discount, subtotal_discount_refunded, subtotal_refunded, tax, tax_refunded, taxable_subtotal, taxable_subtotal_discount, total, total_refunded].hash
221
230
  end
222
231
 
223
232
  # Builds the object from hash
@@ -14,6 +14,8 @@ require 'date'
14
14
 
15
15
  module UltracartClient
16
16
  class ScreenRecordingFilterPageView
17
+ attr_accessor :domain
18
+
17
19
  attr_accessor :events
18
20
 
19
21
  attr_accessor :params
@@ -31,6 +33,7 @@ module UltracartClient
31
33
  # Attribute mapping from ruby-style variable name to JSON key.
32
34
  def self.attribute_map
33
35
  {
36
+ :'domain' => :'domain',
34
37
  :'events' => :'events',
35
38
  :'params' => :'params',
36
39
  :'referrer' => :'referrer',
@@ -44,6 +47,7 @@ module UltracartClient
44
47
  # Attribute type mapping.
45
48
  def self.swagger_types
46
49
  {
50
+ :'domain' => :'ScreenRecordingFilterStringSearch',
47
51
  :'events' => :'Array<ScreenRecordingFilterPageViewEvent>',
48
52
  :'params' => :'Array<ScreenRecordingFilterPageViewParam>',
49
53
  :'referrer' => :'ScreenRecordingFilterStringSearch',
@@ -62,6 +66,10 @@ module UltracartClient
62
66
  # convert string to symbol for hash key
63
67
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
64
68
 
69
+ if attributes.has_key?(:'domain')
70
+ self.domain = attributes[:'domain']
71
+ end
72
+
65
73
  if attributes.has_key?(:'events')
66
74
  if (value = attributes[:'events']).is_a?(Array)
67
75
  self.events = value
@@ -115,6 +123,7 @@ module UltracartClient
115
123
  def ==(o)
116
124
  return true if self.equal?(o)
117
125
  self.class == o.class &&
126
+ domain == o.domain &&
118
127
  events == o.events &&
119
128
  params == o.params &&
120
129
  referrer == o.referrer &&
@@ -133,7 +142,7 @@ module UltracartClient
133
142
  # Calculates hash code according to all attributes.
134
143
  # @return [Fixnum] Hash code
135
144
  def hash
136
- [events, params, referrer, referrer_params, referrer_raw, time_on_page, url].hash
145
+ [domain, events, params, referrer, referrer_params, referrer_raw, time_on_page, url].hash
137
146
  end
138
147
 
139
148
  # Builds the object from hash
@@ -14,6 +14,8 @@ require 'date'
14
14
 
15
15
  module UltracartClient
16
16
  class ScreenRecordingFilterValuesPageView
17
+ attr_accessor :domains
18
+
17
19
  attr_accessor :events
18
20
 
19
21
  attr_accessor :page_params
@@ -27,6 +29,7 @@ module UltracartClient
27
29
  # Attribute mapping from ruby-style variable name to JSON key.
28
30
  def self.attribute_map
29
31
  {
32
+ :'domains' => :'domains',
30
33
  :'events' => :'events',
31
34
  :'page_params' => :'page_params',
32
35
  :'time_on_page_max' => :'time_on_page_max',
@@ -38,6 +41,7 @@ module UltracartClient
38
41
  # Attribute type mapping.
39
42
  def self.swagger_types
40
43
  {
44
+ :'domains' => :'Array<String>',
41
45
  :'events' => :'Array<ScreenRecordingFilterValuesEvent>',
42
46
  :'page_params' => :'Array<ScreenRecordingFilterValuesPageParam>',
43
47
  :'time_on_page_max' => :'Integer',
@@ -54,6 +58,12 @@ module UltracartClient
54
58
  # convert string to symbol for hash key
55
59
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
60
 
61
+ if attributes.has_key?(:'domains')
62
+ if (value = attributes[:'domains']).is_a?(Array)
63
+ self.domains = value
64
+ end
65
+ end
66
+
57
67
  if attributes.has_key?(:'events')
58
68
  if (value = attributes[:'events']).is_a?(Array)
59
69
  self.events = value
@@ -99,6 +109,7 @@ module UltracartClient
99
109
  def ==(o)
100
110
  return true if self.equal?(o)
101
111
  self.class == o.class &&
112
+ domains == o.domains &&
102
113
  events == o.events &&
103
114
  page_params == o.page_params &&
104
115
  time_on_page_max == o.time_on_page_max &&
@@ -115,7 +126,7 @@ module UltracartClient
115
126
  # Calculates hash code according to all attributes.
116
127
  # @return [Fixnum] Hash code
117
128
  def hash
118
- [events, page_params, time_on_page_max, time_on_page_min, urls].hash
129
+ [domains, events, page_params, time_on_page_max, time_on_page_min, urls].hash
119
130
  end
120
131
 
121
132
  # Builds the object from hash
@@ -0,0 +1,283 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class ScreenRecordingHeatmap
17
+ attr_accessor :large_click_url
18
+
19
+ attr_accessor :large_movement_url
20
+
21
+ attr_accessor :large_regular_url
22
+
23
+ attr_accessor :large_scroll_url
24
+
25
+ attr_accessor :medium_click_url
26
+
27
+ attr_accessor :medium_movement_url
28
+
29
+ attr_accessor :medium_regular_url
30
+
31
+ attr_accessor :medium_scroll_url
32
+
33
+ attr_accessor :small_click_url
34
+
35
+ attr_accessor :small_movement_url
36
+
37
+ attr_accessor :small_regular_url
38
+
39
+ attr_accessor :small_scroll_url
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'large_click_url' => :'large_click_url',
45
+ :'large_movement_url' => :'large_movement_url',
46
+ :'large_regular_url' => :'large_regular_url',
47
+ :'large_scroll_url' => :'large_scroll_url',
48
+ :'medium_click_url' => :'medium_click_url',
49
+ :'medium_movement_url' => :'medium_movement_url',
50
+ :'medium_regular_url' => :'medium_regular_url',
51
+ :'medium_scroll_url' => :'medium_scroll_url',
52
+ :'small_click_url' => :'small_click_url',
53
+ :'small_movement_url' => :'small_movement_url',
54
+ :'small_regular_url' => :'small_regular_url',
55
+ :'small_scroll_url' => :'small_scroll_url'
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ :'large_click_url' => :'String',
63
+ :'large_movement_url' => :'String',
64
+ :'large_regular_url' => :'String',
65
+ :'large_scroll_url' => :'String',
66
+ :'medium_click_url' => :'String',
67
+ :'medium_movement_url' => :'String',
68
+ :'medium_regular_url' => :'String',
69
+ :'medium_scroll_url' => :'String',
70
+ :'small_click_url' => :'String',
71
+ :'small_movement_url' => :'String',
72
+ :'small_regular_url' => :'String',
73
+ :'small_scroll_url' => :'String'
74
+ }
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ return unless attributes.is_a?(Hash)
81
+
82
+ # convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
84
+
85
+ if attributes.has_key?(:'large_click_url')
86
+ self.large_click_url = attributes[:'large_click_url']
87
+ end
88
+
89
+ if attributes.has_key?(:'large_movement_url')
90
+ self.large_movement_url = attributes[:'large_movement_url']
91
+ end
92
+
93
+ if attributes.has_key?(:'large_regular_url')
94
+ self.large_regular_url = attributes[:'large_regular_url']
95
+ end
96
+
97
+ if attributes.has_key?(:'large_scroll_url')
98
+ self.large_scroll_url = attributes[:'large_scroll_url']
99
+ end
100
+
101
+ if attributes.has_key?(:'medium_click_url')
102
+ self.medium_click_url = attributes[:'medium_click_url']
103
+ end
104
+
105
+ if attributes.has_key?(:'medium_movement_url')
106
+ self.medium_movement_url = attributes[:'medium_movement_url']
107
+ end
108
+
109
+ if attributes.has_key?(:'medium_regular_url')
110
+ self.medium_regular_url = attributes[:'medium_regular_url']
111
+ end
112
+
113
+ if attributes.has_key?(:'medium_scroll_url')
114
+ self.medium_scroll_url = attributes[:'medium_scroll_url']
115
+ end
116
+
117
+ if attributes.has_key?(:'small_click_url')
118
+ self.small_click_url = attributes[:'small_click_url']
119
+ end
120
+
121
+ if attributes.has_key?(:'small_movement_url')
122
+ self.small_movement_url = attributes[:'small_movement_url']
123
+ end
124
+
125
+ if attributes.has_key?(:'small_regular_url')
126
+ self.small_regular_url = attributes[:'small_regular_url']
127
+ end
128
+
129
+ if attributes.has_key?(:'small_scroll_url')
130
+ self.small_scroll_url = attributes[:'small_scroll_url']
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = Array.new
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ true
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ large_click_url == o.large_click_url &&
153
+ large_movement_url == o.large_movement_url &&
154
+ large_regular_url == o.large_regular_url &&
155
+ large_scroll_url == o.large_scroll_url &&
156
+ medium_click_url == o.medium_click_url &&
157
+ medium_movement_url == o.medium_movement_url &&
158
+ medium_regular_url == o.medium_regular_url &&
159
+ medium_scroll_url == o.medium_scroll_url &&
160
+ small_click_url == o.small_click_url &&
161
+ small_movement_url == o.small_movement_url &&
162
+ small_regular_url == o.small_regular_url &&
163
+ small_scroll_url == o.small_scroll_url
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Fixnum] Hash code
174
+ def hash
175
+ [large_click_url, large_movement_url, large_regular_url, large_scroll_url, medium_click_url, medium_movement_url, medium_regular_url, medium_scroll_url, small_click_url, small_movement_url, small_regular_url, small_scroll_url].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ self.class.swagger_types.each_pair do |key, type|
184
+ if type =~ /\AArray<(.*)>/i
185
+ # check to ensure the input is an array given that the attribute
186
+ # is documented as an array but the input is not
187
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
188
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
189
+ end
190
+ elsif !attributes[self.class.attribute_map[key]].nil?
191
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
192
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
193
+ end
194
+
195
+ self
196
+ end
197
+
198
+ # Deserializes the data based on type
199
+ # @param string type Data type
200
+ # @param string value Value to be deserialized
201
+ # @return [Object] Deserialized data
202
+ def _deserialize(type, value)
203
+ case type.to_sym
204
+ when :DateTime
205
+ DateTime.parse(value)
206
+ when :Date
207
+ Date.parse(value)
208
+ when :String
209
+ value.to_s
210
+ when :Integer
211
+ value.to_i
212
+ when :Float
213
+ value.to_f
214
+ when :BOOLEAN
215
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
216
+ true
217
+ else
218
+ false
219
+ end
220
+ when :Object
221
+ # generic object (usually a Hash), return directly
222
+ value
223
+ when /\AArray<(?<inner_type>.+)>\z/
224
+ inner_type = Regexp.last_match[:inner_type]
225
+ value.map { |v| _deserialize(inner_type, v) }
226
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
227
+ k_type = Regexp.last_match[:k_type]
228
+ v_type = Regexp.last_match[:v_type]
229
+ {}.tap do |hash|
230
+ value.each do |k, v|
231
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
232
+ end
233
+ end
234
+ else # model
235
+ temp_model = UltracartClient.const_get(type).new
236
+ temp_model.build_from_hash(value)
237
+ end
238
+ end
239
+
240
+ # Returns the string representation of the object
241
+ # @return [String] String presentation of the object
242
+ def to_s
243
+ to_hash.to_s
244
+ end
245
+
246
+ # to_body is an alias to to_hash (backward compatibility)
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_body
249
+ to_hash
250
+ end
251
+
252
+ # Returns the object in the form of hash
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_hash
255
+ hash = {}
256
+ self.class.attribute_map.each_pair do |attr, param|
257
+ value = self.send(attr)
258
+ next if value.nil?
259
+ hash[param] = _to_hash(value)
260
+ end
261
+ hash
262
+ end
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+
282
+ end
283
+ end
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class ScreenRecordingHeatmapIndexResponse
17
+ attr_accessor :error
18
+
19
+ attr_accessor :heatmap_urls
20
+
21
+ attr_accessor :metadata
22
+
23
+ # Indicates if API call was successful
24
+ attr_accessor :success
25
+
26
+ attr_accessor :warning
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'error' => :'error',
32
+ :'heatmap_urls' => :'heatmap_urls',
33
+ :'metadata' => :'metadata',
34
+ :'success' => :'success',
35
+ :'warning' => :'warning'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'error' => :'Error',
43
+ :'heatmap_urls' => :'Array<ScreenRecordingHeatmapUrl>',
44
+ :'metadata' => :'ResponseMetadata',
45
+ :'success' => :'BOOLEAN',
46
+ :'warning' => :'Warning'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'error')
59
+ self.error = attributes[:'error']
60
+ end
61
+
62
+ if attributes.has_key?(:'heatmap_urls')
63
+ if (value = attributes[:'heatmap_urls']).is_a?(Array)
64
+ self.heatmap_urls = value
65
+ end
66
+ end
67
+
68
+ if attributes.has_key?(:'metadata')
69
+ self.metadata = attributes[:'metadata']
70
+ end
71
+
72
+ if attributes.has_key?(:'success')
73
+ self.success = attributes[:'success']
74
+ end
75
+
76
+ if attributes.has_key?(:'warning')
77
+ self.warning = attributes[:'warning']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ error == o.error &&
100
+ heatmap_urls == o.heatmap_urls &&
101
+ metadata == o.metadata &&
102
+ success == o.success &&
103
+ warning == o.warning
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [error, heatmap_urls, metadata, success, warning].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :BOOLEAN
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ temp_model = UltracartClient.const_get(type).new
176
+ temp_model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+ end