ultracart_api 3.1.14 → 3.1.37

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -77
  3. data/docs/Coupon.md +1 -0
  4. data/docs/CouponPercentOffMsrpItems.md +11 -0
  5. data/docs/CustomerLoyalty.md +1 -0
  6. data/docs/EmailCampaign.md +2 -1
  7. data/docs/EmailFlow.md +2 -1
  8. data/docs/LibraryItemAttribute.md +0 -1
  9. data/docs/OrderApi.md +4 -0
  10. data/docs/OrderProcessPaymentRequest.md +1 -0
  11. data/docs/OrderQuery.md +3 -1
  12. data/docs/ScreenRecording.md +13 -0
  13. data/docs/ScreenRecordingAdPlatform.md +13 -0
  14. data/docs/ScreenRecordingFilter.md +12 -0
  15. data/docs/ScreenRecordingFilterValues.md +12 -1
  16. data/docs/ScreenRecordingFilterValuesPageParam.md +9 -0
  17. data/docs/ScreenRecordingFilterValuesPageView.md +12 -0
  18. data/docs/ScreenRecordingPageView.md +2 -0
  19. data/docs/ScreenRecordingPageViewEvent.md +1 -0
  20. data/docs/ScreenRecordingQueryResponse.md +3 -0
  21. data/docs/ScreenRecordingSegment.md +3 -0
  22. data/docs/ScreenRecordingSettings.md +5 -0
  23. data/docs/StorefrontApi.md +3 -4
  24. data/docs/TaxJarConfig.md +1 -0
  25. data/lib/ultracart_api.rb +4 -0
  26. data/lib/ultracart_api/api/order_api.rb +6 -0
  27. data/lib/ultracart_api/api/storefront_api.rb +5 -6
  28. data/lib/ultracart_api/models/coupon.rb +10 -1
  29. data/lib/ultracart_api/models/coupon_percent_off_msrp_items.rb +219 -0
  30. data/lib/ultracart_api/models/customer_loyalty.rb +11 -1
  31. data/lib/ultracart_api/models/email_campaign.rb +12 -2
  32. data/lib/ultracart_api/models/email_flow.rb +12 -2
  33. data/lib/ultracart_api/models/library_item_attribute.rb +1 -10
  34. data/lib/ultracart_api/models/order_process_payment_request.rb +11 -1
  35. data/lib/ultracart_api/models/order_query.rb +22 -2
  36. data/lib/ultracart_api/models/screen_recording.rb +128 -1
  37. data/lib/ultracart_api/models/screen_recording_ad_platform.rb +235 -0
  38. data/lib/ultracart_api/models/screen_recording_filter.rb +109 -1
  39. data/lib/ultracart_api/models/screen_recording_filter_values.rb +128 -11
  40. data/lib/ultracart_api/models/screen_recording_filter_values_page_param.rb +195 -0
  41. data/lib/ultracart_api/models/screen_recording_filter_values_page_view.rb +226 -0
  42. data/lib/ultracart_api/models/screen_recording_page_view.rb +21 -1
  43. data/lib/ultracart_api/models/screen_recording_page_view_event.rb +10 -1
  44. data/lib/ultracart_api/models/screen_recording_query_response.rb +30 -1
  45. data/lib/ultracart_api/models/screen_recording_segment.rb +30 -1
  46. data/lib/ultracart_api/models/screen_recording_settings.rb +49 -4
  47. data/lib/ultracart_api/models/tax_jar_config.rb +11 -1
  48. data/lib/ultracart_api/version.rb +1 -1
  49. metadata +10 -2
@@ -14,14 +14,32 @@ require 'date'
14
14
 
15
15
  module UltracartClient
16
16
  class ScreenRecordingFilterValues
17
- attr_accessor :events
17
+ attr_accessor :communications_campaign_names
18
+
19
+ attr_accessor :communications_email_subjects
20
+
21
+ attr_accessor :communications_flow_names
22
+
23
+ attr_accessor :email_domains
18
24
 
19
25
  attr_accessor :geolocation_countries
20
26
 
21
27
  attr_accessor :geolocation_states
22
28
 
29
+ attr_accessor :language_iso_codes
30
+
23
31
  attr_accessor :max_values
24
32
 
33
+ attr_accessor :page_views
34
+
35
+ attr_accessor :preferred_languages
36
+
37
+ attr_accessor :referrer_domains
38
+
39
+ attr_accessor :time_on_site_max
40
+
41
+ attr_accessor :time_on_site_min
42
+
25
43
  attr_accessor :urls
26
44
 
27
45
  attr_accessor :user_agent_device_names
@@ -34,35 +52,61 @@ module UltracartClient
34
52
 
35
53
  attr_accessor :user_agent_originals
36
54
 
55
+ attr_accessor :utm_campaigns
56
+
57
+ attr_accessor :utm_sources
58
+
37
59
  # Attribute mapping from ruby-style variable name to JSON key.
38
60
  def self.attribute_map
39
61
  {
40
- :'events' => :'events',
62
+ :'communications_campaign_names' => :'communications_campaign_names',
63
+ :'communications_email_subjects' => :'communications_email_subjects',
64
+ :'communications_flow_names' => :'communications_flow_names',
65
+ :'email_domains' => :'email_domains',
41
66
  :'geolocation_countries' => :'geolocation_countries',
42
67
  :'geolocation_states' => :'geolocation_states',
68
+ :'language_iso_codes' => :'language_iso_codes',
43
69
  :'max_values' => :'max_values',
70
+ :'page_views' => :'page_views',
71
+ :'preferred_languages' => :'preferred_languages',
72
+ :'referrer_domains' => :'referrer_domains',
73
+ :'time_on_site_max' => :'time_on_site_max',
74
+ :'time_on_site_min' => :'time_on_site_min',
44
75
  :'urls' => :'urls',
45
76
  :'user_agent_device_names' => :'user_agent_device_names',
46
77
  :'user_agent_device_os_names' => :'user_agent_device_os_names',
47
78
  :'user_agent_device_os_versions' => :'user_agent_device_os_versions',
48
79
  :'user_agent_names' => :'user_agent_names',
49
- :'user_agent_originals' => :'user_agent_originals'
80
+ :'user_agent_originals' => :'user_agent_originals',
81
+ :'utm_campaigns' => :'utm_campaigns',
82
+ :'utm_sources' => :'utm_sources'
50
83
  }
51
84
  end
52
85
 
53
86
  # Attribute type mapping.
54
87
  def self.swagger_types
55
88
  {
56
- :'events' => :'Array<ScreenRecordingFilterValuesEvent>',
89
+ :'communications_campaign_names' => :'Array<String>',
90
+ :'communications_email_subjects' => :'Array<String>',
91
+ :'communications_flow_names' => :'Array<String>',
92
+ :'email_domains' => :'Array<String>',
57
93
  :'geolocation_countries' => :'Array<String>',
58
94
  :'geolocation_states' => :'Array<String>',
95
+ :'language_iso_codes' => :'Array<String>',
59
96
  :'max_values' => :'Integer',
97
+ :'page_views' => :'Array<ScreenRecordingFilterValuesPageView>',
98
+ :'preferred_languages' => :'Array<String>',
99
+ :'referrer_domains' => :'Array<String>',
100
+ :'time_on_site_max' => :'Integer',
101
+ :'time_on_site_min' => :'Integer',
60
102
  :'urls' => :'Array<String>',
61
103
  :'user_agent_device_names' => :'Array<String>',
62
104
  :'user_agent_device_os_names' => :'Array<String>',
63
105
  :'user_agent_device_os_versions' => :'Array<String>',
64
106
  :'user_agent_names' => :'Array<String>',
65
- :'user_agent_originals' => :'Array<String>'
107
+ :'user_agent_originals' => :'Array<String>',
108
+ :'utm_campaigns' => :'Array<String>',
109
+ :'utm_sources' => :'Array<String>'
66
110
  }
67
111
  end
68
112
 
@@ -74,9 +118,27 @@ module UltracartClient
74
118
  # convert string to symbol for hash key
75
119
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
76
120
 
77
- if attributes.has_key?(:'events')
78
- if (value = attributes[:'events']).is_a?(Array)
79
- self.events = value
121
+ if attributes.has_key?(:'communications_campaign_names')
122
+ if (value = attributes[:'communications_campaign_names']).is_a?(Array)
123
+ self.communications_campaign_names = value
124
+ end
125
+ end
126
+
127
+ if attributes.has_key?(:'communications_email_subjects')
128
+ if (value = attributes[:'communications_email_subjects']).is_a?(Array)
129
+ self.communications_email_subjects = value
130
+ end
131
+ end
132
+
133
+ if attributes.has_key?(:'communications_flow_names')
134
+ if (value = attributes[:'communications_flow_names']).is_a?(Array)
135
+ self.communications_flow_names = value
136
+ end
137
+ end
138
+
139
+ if attributes.has_key?(:'email_domains')
140
+ if (value = attributes[:'email_domains']).is_a?(Array)
141
+ self.email_domains = value
80
142
  end
81
143
  end
82
144
 
@@ -92,10 +154,42 @@ module UltracartClient
92
154
  end
93
155
  end
94
156
 
157
+ if attributes.has_key?(:'language_iso_codes')
158
+ if (value = attributes[:'language_iso_codes']).is_a?(Array)
159
+ self.language_iso_codes = value
160
+ end
161
+ end
162
+
95
163
  if attributes.has_key?(:'max_values')
96
164
  self.max_values = attributes[:'max_values']
97
165
  end
98
166
 
167
+ if attributes.has_key?(:'page_views')
168
+ if (value = attributes[:'page_views']).is_a?(Array)
169
+ self.page_views = value
170
+ end
171
+ end
172
+
173
+ if attributes.has_key?(:'preferred_languages')
174
+ if (value = attributes[:'preferred_languages']).is_a?(Array)
175
+ self.preferred_languages = value
176
+ end
177
+ end
178
+
179
+ if attributes.has_key?(:'referrer_domains')
180
+ if (value = attributes[:'referrer_domains']).is_a?(Array)
181
+ self.referrer_domains = value
182
+ end
183
+ end
184
+
185
+ if attributes.has_key?(:'time_on_site_max')
186
+ self.time_on_site_max = attributes[:'time_on_site_max']
187
+ end
188
+
189
+ if attributes.has_key?(:'time_on_site_min')
190
+ self.time_on_site_min = attributes[:'time_on_site_min']
191
+ end
192
+
99
193
  if attributes.has_key?(:'urls')
100
194
  if (value = attributes[:'urls']).is_a?(Array)
101
195
  self.urls = value
@@ -131,6 +225,18 @@ module UltracartClient
131
225
  self.user_agent_originals = value
132
226
  end
133
227
  end
228
+
229
+ if attributes.has_key?(:'utm_campaigns')
230
+ if (value = attributes[:'utm_campaigns']).is_a?(Array)
231
+ self.utm_campaigns = value
232
+ end
233
+ end
234
+
235
+ if attributes.has_key?(:'utm_sources')
236
+ if (value = attributes[:'utm_sources']).is_a?(Array)
237
+ self.utm_sources = value
238
+ end
239
+ end
134
240
  end
135
241
 
136
242
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -151,16 +257,27 @@ module UltracartClient
151
257
  def ==(o)
152
258
  return true if self.equal?(o)
153
259
  self.class == o.class &&
154
- events == o.events &&
260
+ communications_campaign_names == o.communications_campaign_names &&
261
+ communications_email_subjects == o.communications_email_subjects &&
262
+ communications_flow_names == o.communications_flow_names &&
263
+ email_domains == o.email_domains &&
155
264
  geolocation_countries == o.geolocation_countries &&
156
265
  geolocation_states == o.geolocation_states &&
266
+ language_iso_codes == o.language_iso_codes &&
157
267
  max_values == o.max_values &&
268
+ page_views == o.page_views &&
269
+ preferred_languages == o.preferred_languages &&
270
+ referrer_domains == o.referrer_domains &&
271
+ time_on_site_max == o.time_on_site_max &&
272
+ time_on_site_min == o.time_on_site_min &&
158
273
  urls == o.urls &&
159
274
  user_agent_device_names == o.user_agent_device_names &&
160
275
  user_agent_device_os_names == o.user_agent_device_os_names &&
161
276
  user_agent_device_os_versions == o.user_agent_device_os_versions &&
162
277
  user_agent_names == o.user_agent_names &&
163
- user_agent_originals == o.user_agent_originals
278
+ user_agent_originals == o.user_agent_originals &&
279
+ utm_campaigns == o.utm_campaigns &&
280
+ utm_sources == o.utm_sources
164
281
  end
165
282
 
166
283
  # @see the `==` method
@@ -172,7 +289,7 @@ module UltracartClient
172
289
  # Calculates hash code according to all attributes.
173
290
  # @return [Fixnum] Hash code
174
291
  def hash
175
- [events, geolocation_countries, geolocation_states, max_values, urls, user_agent_device_names, user_agent_device_os_names, user_agent_device_os_versions, user_agent_names, user_agent_originals].hash
292
+ [communications_campaign_names, communications_email_subjects, communications_flow_names, email_domains, geolocation_countries, geolocation_states, language_iso_codes, max_values, page_views, preferred_languages, referrer_domains, time_on_site_max, time_on_site_min, urls, user_agent_device_names, user_agent_device_os_names, user_agent_device_os_versions, user_agent_names, user_agent_originals, utm_campaigns, utm_sources].hash
176
293
  end
177
294
 
178
295
  # Builds the object from hash
@@ -0,0 +1,195 @@
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 ScreenRecordingFilterValuesPageParam
17
+ attr_accessor :name
18
+
19
+ attr_accessor :values
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'name' => :'name',
25
+ :'values' => :'values'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'name' => :'String',
33
+ :'values' => :'Array<String>'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'name')
46
+ self.name = attributes[:'name']
47
+ end
48
+
49
+ if attributes.has_key?(:'values')
50
+ if (value = attributes[:'values']).is_a?(Array)
51
+ self.values = value
52
+ end
53
+ end
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ invalid_properties
61
+ end
62
+
63
+ # Check to see if the all the properties in the model are valid
64
+ # @return true if the model is valid
65
+ def valid?
66
+ true
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] Object to be compared
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class &&
74
+ name == o.name &&
75
+ values == o.values
76
+ end
77
+
78
+ # @see the `==` method
79
+ # @param [Object] Object to be compared
80
+ def eql?(o)
81
+ self == o
82
+ end
83
+
84
+ # Calculates hash code according to all attributes.
85
+ # @return [Fixnum] Hash code
86
+ def hash
87
+ [name, values].hash
88
+ end
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.swagger_types.each_pair do |key, type|
96
+ if type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :BOOLEAN
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ temp_model = UltracartClient.const_get(type).new
148
+ temp_model.build_from_hash(value)
149
+ end
150
+ end
151
+
152
+ # Returns the string representation of the object
153
+ # @return [String] String presentation of the object
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # to_body is an alias to to_hash (backward compatibility)
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_body
161
+ to_hash
162
+ end
163
+
164
+ # Returns the object in the form of hash
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_hash
167
+ hash = {}
168
+ self.class.attribute_map.each_pair do |attr, param|
169
+ value = self.send(attr)
170
+ next if value.nil?
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ # Outputs non-array value in the form of hash
177
+ # For object, use to_hash. Otherwise, just return the value
178
+ # @param [Object] value Any valid value
179
+ # @return [Hash] Returns the value in the form of hash
180
+ def _to_hash(value)
181
+ if value.is_a?(Array)
182
+ value.compact.map { |v| _to_hash(v) }
183
+ elsif value.is_a?(Hash)
184
+ {}.tap do |hash|
185
+ value.each { |k, v| hash[k] = _to_hash(v) }
186
+ end
187
+ elsif value.respond_to? :to_hash
188
+ value.to_hash
189
+ else
190
+ value
191
+ end
192
+ end
193
+
194
+ end
195
+ end
@@ -0,0 +1,226 @@
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 ScreenRecordingFilterValuesPageView
17
+ attr_accessor :events
18
+
19
+ attr_accessor :page_params
20
+
21
+ attr_accessor :time_on_page_max
22
+
23
+ attr_accessor :time_on_page_min
24
+
25
+ attr_accessor :urls
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'events' => :'events',
31
+ :'page_params' => :'page_params',
32
+ :'time_on_page_max' => :'time_on_page_max',
33
+ :'time_on_page_min' => :'time_on_page_min',
34
+ :'urls' => :'urls'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ :'events' => :'Array<ScreenRecordingFilterValuesEvent>',
42
+ :'page_params' => :'Array<ScreenRecordingFilterValuesPageParam>',
43
+ :'time_on_page_max' => :'Integer',
44
+ :'time_on_page_min' => :'Integer',
45
+ :'urls' => :'Array<String>'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ if attributes.has_key?(:'events')
58
+ if (value = attributes[:'events']).is_a?(Array)
59
+ self.events = value
60
+ end
61
+ end
62
+
63
+ if attributes.has_key?(:'page_params')
64
+ if (value = attributes[:'page_params']).is_a?(Array)
65
+ self.page_params = value
66
+ end
67
+ end
68
+
69
+ if attributes.has_key?(:'time_on_page_max')
70
+ self.time_on_page_max = attributes[:'time_on_page_max']
71
+ end
72
+
73
+ if attributes.has_key?(:'time_on_page_min')
74
+ self.time_on_page_min = attributes[:'time_on_page_min']
75
+ end
76
+
77
+ if attributes.has_key?(:'urls')
78
+ if (value = attributes[:'urls']).is_a?(Array)
79
+ self.urls = value
80
+ end
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ events == o.events &&
103
+ page_params == o.page_params &&
104
+ time_on_page_max == o.time_on_page_max &&
105
+ time_on_page_min == o.time_on_page_min &&
106
+ urls == o.urls
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(o)
112
+ self == o
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Fixnum] Hash code
117
+ def hash
118
+ [events, page_params, time_on_page_max, time_on_page_min, urls].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.swagger_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :BOOLEAN
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ temp_model = UltracartClient.const_get(type).new
179
+ temp_model.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ next if value.nil?
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+ end