ultracart_api 4.1.222 → 4.1.224

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +55 -2
  3. data/docs/OauthTokenResponse.md +2 -0
  4. data/docs/SfvbAffiliateNetwork.md +60 -0
  5. data/docs/SfvbAffiliateNetworkRequest.md +50 -0
  6. data/docs/SfvbAffiliateNetworksResponse.md +20 -0
  7. data/docs/SfvbApi.md +1456 -120
  8. data/docs/SfvbApprovalCreateRequest.md +8 -2
  9. data/docs/SfvbApprovalParams.md +7 -3
  10. data/docs/SfvbContainerResponse.md +3 -1
  11. data/docs/SfvbSmartAttribution.md +38 -0
  12. data/docs/SfvbSmartAttributionPlatform.md +34 -0
  13. data/docs/SfvbSmartAttributionRequest.md +30 -0
  14. data/docs/SfvbTrackingAdvanced.md +34 -0
  15. data/docs/SfvbTrackingAdvancedRequest.md +34 -0
  16. data/docs/SfvbTrackingChange.md +24 -0
  17. data/docs/SfvbTrackingHtml.md +36 -0
  18. data/docs/SfvbTrackingHtmlRequest.md +20 -0
  19. data/docs/SfvbTrackingHtmlResponse.md +22 -0
  20. data/docs/SfvbTrackingPrivacy.md +28 -0
  21. data/docs/SfvbTrackingPrivacyRequest.md +28 -0
  22. data/docs/SfvbTrackingProvider.md +48 -0
  23. data/docs/SfvbTrackingProviderConsent.md +22 -0
  24. data/docs/SfvbTrackingProviderEvent.md +20 -0
  25. data/docs/SfvbTrackingProviderField.md +42 -0
  26. data/docs/SfvbTrackingProviderOauth.md +28 -0
  27. data/docs/SfvbTrackingProviderRequest.md +32 -0
  28. data/docs/SfvbTrackingProviderSecrets.md +46 -0
  29. data/docs/SfvbTrackingProvidersResponse.md +22 -0
  30. data/docs/SfvbTrackingSettingsResponse.md +28 -0
  31. data/docs/SfvbTrackingWholesaleTier.md +22 -0
  32. data/docs/SfvbUtmShortcode.md +56 -0
  33. data/docs/SfvbUtmShortcodeRequest.md +44 -0
  34. data/docs/SfvbUtmShortcodesResponse.md +24 -0
  35. data/lib/ultracart_api/api/sfvb_api.rb +4602 -2793
  36. data/lib/ultracart_api/models/oauth_token_response.rb +11 -1
  37. data/lib/ultracart_api/models/sfvb_affiliate_network.rb +478 -0
  38. data/lib/ultracart_api/models/sfvb_affiliate_network_request.rb +428 -0
  39. data/lib/ultracart_api/models/sfvb_affiliate_networks_response.rb +232 -0
  40. data/lib/ultracart_api/models/sfvb_approval_create_request.rb +34 -7
  41. data/lib/ultracart_api/models/sfvb_approval_params.rb +24 -4
  42. data/lib/ultracart_api/models/sfvb_container_response.rb +16 -4
  43. data/lib/ultracart_api/models/sfvb_smart_attribution.rb +324 -0
  44. data/lib/ultracart_api/models/sfvb_smart_attribution_platform.rb +300 -0
  45. data/lib/ultracart_api/models/sfvb_smart_attribution_request.rb +282 -0
  46. data/lib/ultracart_api/models/sfvb_tracking_advanced.rb +300 -0
  47. data/lib/ultracart_api/models/sfvb_tracking_advanced_request.rb +302 -0
  48. data/lib/ultracart_api/models/sfvb_tracking_change.rb +250 -0
  49. data/lib/ultracart_api/models/sfvb_tracking_html.rb +344 -0
  50. data/lib/ultracart_api/models/sfvb_tracking_html_request.rb +230 -0
  51. data/lib/ultracart_api/models/sfvb_tracking_html_response.rb +242 -0
  52. data/lib/ultracart_api/models/sfvb_tracking_privacy.rb +352 -0
  53. data/lib/ultracart_api/models/sfvb_tracking_privacy_request.rb +352 -0
  54. data/lib/ultracart_api/models/sfvb_tracking_provider.rb +378 -0
  55. data/lib/ultracart_api/models/sfvb_tracking_provider_consent.rb +240 -0
  56. data/lib/ultracart_api/models/sfvb_tracking_provider_event.rb +230 -0
  57. data/lib/ultracart_api/models/sfvb_tracking_provider_field.rb +342 -0
  58. data/lib/ultracart_api/models/sfvb_tracking_provider_oauth.rb +270 -0
  59. data/lib/ultracart_api/models/sfvb_tracking_provider_request.rb +292 -0
  60. data/lib/ultracart_api/models/sfvb_tracking_provider_secrets.rb +360 -0
  61. data/lib/ultracart_api/models/sfvb_tracking_providers_response.rb +242 -0
  62. data/lib/ultracart_api/models/sfvb_tracking_settings_response.rb +272 -0
  63. data/lib/ultracart_api/models/sfvb_tracking_wholesale_tier.rb +240 -0
  64. data/lib/ultracart_api/models/sfvb_utm_shortcode.rb +410 -0
  65. data/lib/ultracart_api/models/sfvb_utm_shortcode_request.rb +350 -0
  66. data/lib/ultracart_api/models/sfvb_utm_shortcodes_response.rb +252 -0
  67. data/lib/ultracart_api/version.rb +1 -1
  68. data/lib/ultracart_api.rb +27 -0
  69. metadata +55 -1
@@ -0,0 +1,428 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbAffiliateNetworkRequest
18
+ # One of the account's own affiliates. Name it in unset to clear it.
19
+ attr_accessor :assign_to_affiliate_oid
20
+
21
+ # A fixed commission amount, 0 or more, with at most 6 decimals. Name it in unset to clear it.
22
+ attr_accessor :commission
23
+
24
+ # HTML for custom, at most 10,000 characters, or one https URL for server_to_server. An empty string empties it. A pixel that a custom or server_to_server network will use needs an approved affiliate_network.change request for exactly this change.
25
+ attr_accessor :conversion_pixel
26
+
27
+ # custom, commission_junction or server_to_server.
28
+ attr_accessor :conversion_type
29
+
30
+ # 1 to 3650.
31
+ attr_accessor :cookie_lifetime_days
32
+
33
+ # True to check the change and say whether it needs an approval, without saving.
34
+ attr_accessor :dry_run
35
+
36
+ # 0 to 100, with at most 2 decimals.
37
+ attr_accessor :fire_percentage
38
+
39
+ # process, skip or assign. assign needs if_not_fired_affiliate_oid.
40
+ attr_accessor :if_not_fired
41
+
42
+ # For if_not_fired assign, one of the account's own affiliates.
43
+ attr_accessor :if_not_fired_affiliate_oid
44
+
45
+ # Up to 50 characters. Required on a create.
46
+ attr_accessor :network_name
47
+
48
+ # Up to 50 characters. Required on a create.
49
+ attr_accessor :parameter_name
50
+
51
+ # Up to 100 characters. Required on a create.
52
+ attr_accessor :parameter_value
53
+
54
+ # 1 to 10.
55
+ attr_accessor :record_fire_in_custom_field
56
+
57
+ # 1 to 10.
58
+ attr_accessor :record_name_in_custom_field
59
+
60
+ # server_to_server only.
61
+ attr_accessor :remove_empty_pixel_parameters
62
+
63
+ # True to replace another network's cookie.
64
+ attr_accessor :stomp_previous_cookie
65
+
66
+ # Fields to clear. commission and assign_to_affiliate_oid only.
67
+ attr_accessor :unset
68
+
69
+ class EnumAttributeValidator
70
+ attr_reader :datatype
71
+ attr_reader :allowable_values
72
+
73
+ def initialize(datatype, allowable_values)
74
+ @allowable_values = allowable_values.map do |value|
75
+ case datatype.to_s
76
+ when /Integer/i
77
+ value.to_i
78
+ when /Float/i
79
+ value.to_f
80
+ else
81
+ value
82
+ end
83
+ end
84
+ end
85
+
86
+ def valid?(value)
87
+ !value || allowable_values.include?(value)
88
+ end
89
+ end
90
+
91
+ # Attribute mapping from ruby-style variable name to JSON key.
92
+ def self.attribute_map
93
+ {
94
+ :'assign_to_affiliate_oid' => :'assign_to_affiliate_oid',
95
+ :'commission' => :'commission',
96
+ :'conversion_pixel' => :'conversion_pixel',
97
+ :'conversion_type' => :'conversion_type',
98
+ :'cookie_lifetime_days' => :'cookie_lifetime_days',
99
+ :'dry_run' => :'dry_run',
100
+ :'fire_percentage' => :'fire_percentage',
101
+ :'if_not_fired' => :'if_not_fired',
102
+ :'if_not_fired_affiliate_oid' => :'if_not_fired_affiliate_oid',
103
+ :'network_name' => :'network_name',
104
+ :'parameter_name' => :'parameter_name',
105
+ :'parameter_value' => :'parameter_value',
106
+ :'record_fire_in_custom_field' => :'record_fire_in_custom_field',
107
+ :'record_name_in_custom_field' => :'record_name_in_custom_field',
108
+ :'remove_empty_pixel_parameters' => :'remove_empty_pixel_parameters',
109
+ :'stomp_previous_cookie' => :'stomp_previous_cookie',
110
+ :'unset' => :'unset'
111
+ }
112
+ end
113
+
114
+ # Returns all the JSON keys this model knows about
115
+ def self.acceptable_attributes
116
+ attribute_map.values
117
+ end
118
+
119
+ # Attribute type mapping.
120
+ def self.openapi_types
121
+ {
122
+ :'assign_to_affiliate_oid' => :'Integer',
123
+ :'commission' => :'Float',
124
+ :'conversion_pixel' => :'String',
125
+ :'conversion_type' => :'String',
126
+ :'cookie_lifetime_days' => :'Integer',
127
+ :'dry_run' => :'Boolean',
128
+ :'fire_percentage' => :'Float',
129
+ :'if_not_fired' => :'String',
130
+ :'if_not_fired_affiliate_oid' => :'Integer',
131
+ :'network_name' => :'String',
132
+ :'parameter_name' => :'String',
133
+ :'parameter_value' => :'String',
134
+ :'record_fire_in_custom_field' => :'Integer',
135
+ :'record_name_in_custom_field' => :'Integer',
136
+ :'remove_empty_pixel_parameters' => :'Boolean',
137
+ :'stomp_previous_cookie' => :'Boolean',
138
+ :'unset' => :'Array<String>'
139
+ }
140
+ end
141
+
142
+ # List of attributes with nullable: true
143
+ def self.openapi_nullable
144
+ Set.new([
145
+ ])
146
+ end
147
+
148
+ # Initializes the object
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ def initialize(attributes = {})
151
+ if (!attributes.is_a?(Hash))
152
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbAffiliateNetworkRequest` initialize method"
153
+ end
154
+
155
+ # check to see if the attribute exists and convert string to symbol for hash key
156
+ attributes = attributes.each_with_object({}) { |(k, v), h|
157
+ if (!self.class.attribute_map.key?(k.to_sym))
158
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbAffiliateNetworkRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
159
+ end
160
+ h[k.to_sym] = v
161
+ }
162
+
163
+ if attributes.key?(:'assign_to_affiliate_oid')
164
+ self.assign_to_affiliate_oid = attributes[:'assign_to_affiliate_oid']
165
+ end
166
+
167
+ if attributes.key?(:'commission')
168
+ self.commission = attributes[:'commission']
169
+ end
170
+
171
+ if attributes.key?(:'conversion_pixel')
172
+ self.conversion_pixel = attributes[:'conversion_pixel']
173
+ end
174
+
175
+ if attributes.key?(:'conversion_type')
176
+ self.conversion_type = attributes[:'conversion_type']
177
+ end
178
+
179
+ if attributes.key?(:'cookie_lifetime_days')
180
+ self.cookie_lifetime_days = attributes[:'cookie_lifetime_days']
181
+ end
182
+
183
+ if attributes.key?(:'dry_run')
184
+ self.dry_run = attributes[:'dry_run']
185
+ end
186
+
187
+ if attributes.key?(:'fire_percentage')
188
+ self.fire_percentage = attributes[:'fire_percentage']
189
+ end
190
+
191
+ if attributes.key?(:'if_not_fired')
192
+ self.if_not_fired = attributes[:'if_not_fired']
193
+ end
194
+
195
+ if attributes.key?(:'if_not_fired_affiliate_oid')
196
+ self.if_not_fired_affiliate_oid = attributes[:'if_not_fired_affiliate_oid']
197
+ end
198
+
199
+ if attributes.key?(:'network_name')
200
+ self.network_name = attributes[:'network_name']
201
+ end
202
+
203
+ if attributes.key?(:'parameter_name')
204
+ self.parameter_name = attributes[:'parameter_name']
205
+ end
206
+
207
+ if attributes.key?(:'parameter_value')
208
+ self.parameter_value = attributes[:'parameter_value']
209
+ end
210
+
211
+ if attributes.key?(:'record_fire_in_custom_field')
212
+ self.record_fire_in_custom_field = attributes[:'record_fire_in_custom_field']
213
+ end
214
+
215
+ if attributes.key?(:'record_name_in_custom_field')
216
+ self.record_name_in_custom_field = attributes[:'record_name_in_custom_field']
217
+ end
218
+
219
+ if attributes.key?(:'remove_empty_pixel_parameters')
220
+ self.remove_empty_pixel_parameters = attributes[:'remove_empty_pixel_parameters']
221
+ end
222
+
223
+ if attributes.key?(:'stomp_previous_cookie')
224
+ self.stomp_previous_cookie = attributes[:'stomp_previous_cookie']
225
+ end
226
+
227
+ if attributes.key?(:'unset')
228
+ if (value = attributes[:'unset']).is_a?(Array)
229
+ self.unset = value
230
+ end
231
+ end
232
+ end
233
+
234
+ # Show invalid properties with the reasons. Usually used together with valid?
235
+ # @return Array for valid properties with the reasons
236
+ def list_invalid_properties
237
+ invalid_properties = Array.new
238
+ invalid_properties
239
+ end
240
+
241
+ # Check to see if the all the properties in the model are valid
242
+ # @return true if the model is valid
243
+ def valid?
244
+ conversion_type_validator = EnumAttributeValidator.new('String', ["custom", "commission_junction", "server_to_server"])
245
+ return false unless conversion_type_validator.valid?(@conversion_type)
246
+ if_not_fired_validator = EnumAttributeValidator.new('String', ["process", "skip", "assign"])
247
+ return false unless if_not_fired_validator.valid?(@if_not_fired)
248
+ true
249
+ end
250
+
251
+ # Custom attribute writer method checking allowed values (enum).
252
+ # @param [Object] conversion_type Object to be assigned
253
+ def conversion_type=(conversion_type)
254
+ validator = EnumAttributeValidator.new('String', ["custom", "commission_junction", "server_to_server"])
255
+ unless validator.valid?(conversion_type)
256
+ fail ArgumentError, "invalid value for \"conversion_type\", must be one of #{validator.allowable_values}."
257
+ end
258
+ @conversion_type = conversion_type
259
+ end
260
+
261
+ # Custom attribute writer method checking allowed values (enum).
262
+ # @param [Object] if_not_fired Object to be assigned
263
+ def if_not_fired=(if_not_fired)
264
+ validator = EnumAttributeValidator.new('String', ["process", "skip", "assign"])
265
+ unless validator.valid?(if_not_fired)
266
+ fail ArgumentError, "invalid value for \"if_not_fired\", must be one of #{validator.allowable_values}."
267
+ end
268
+ @if_not_fired = if_not_fired
269
+ end
270
+
271
+ # Checks equality by comparing each attribute.
272
+ # @param [Object] Object to be compared
273
+ def ==(o)
274
+ return true if self.equal?(o)
275
+ self.class == o.class &&
276
+ assign_to_affiliate_oid == o.assign_to_affiliate_oid &&
277
+ commission == o.commission &&
278
+ conversion_pixel == o.conversion_pixel &&
279
+ conversion_type == o.conversion_type &&
280
+ cookie_lifetime_days == o.cookie_lifetime_days &&
281
+ dry_run == o.dry_run &&
282
+ fire_percentage == o.fire_percentage &&
283
+ if_not_fired == o.if_not_fired &&
284
+ if_not_fired_affiliate_oid == o.if_not_fired_affiliate_oid &&
285
+ network_name == o.network_name &&
286
+ parameter_name == o.parameter_name &&
287
+ parameter_value == o.parameter_value &&
288
+ record_fire_in_custom_field == o.record_fire_in_custom_field &&
289
+ record_name_in_custom_field == o.record_name_in_custom_field &&
290
+ remove_empty_pixel_parameters == o.remove_empty_pixel_parameters &&
291
+ stomp_previous_cookie == o.stomp_previous_cookie &&
292
+ unset == o.unset
293
+ end
294
+
295
+ # @see the `==` method
296
+ # @param [Object] Object to be compared
297
+ def eql?(o)
298
+ self == o
299
+ end
300
+
301
+ # Calculates hash code according to all attributes.
302
+ # @return [Integer] Hash code
303
+ def hash
304
+ [assign_to_affiliate_oid, commission, conversion_pixel, conversion_type, cookie_lifetime_days, dry_run, fire_percentage, if_not_fired, if_not_fired_affiliate_oid, network_name, parameter_name, parameter_value, record_fire_in_custom_field, record_name_in_custom_field, remove_empty_pixel_parameters, stomp_previous_cookie, unset].hash
305
+ end
306
+
307
+ # Builds the object from hash
308
+ # @param [Hash] attributes Model attributes in the form of hash
309
+ # @return [Object] Returns the model itself
310
+ def self.build_from_hash(attributes)
311
+ new.build_from_hash(attributes)
312
+ end
313
+
314
+ # Builds the object from hash
315
+ # @param [Hash] attributes Model attributes in the form of hash
316
+ # @return [Object] Returns the model itself
317
+ def build_from_hash(attributes)
318
+ return nil unless attributes.is_a?(Hash)
319
+ attributes = attributes.transform_keys(&:to_sym)
320
+ self.class.openapi_types.each_pair do |key, type|
321
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
322
+ self.send("#{key}=", nil)
323
+ elsif type =~ /\AArray<(.*)>/i
324
+ # check to ensure the input is an array given that the attribute
325
+ # is documented as an array but the input is not
326
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
327
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
328
+ end
329
+ elsif !attributes[self.class.attribute_map[key]].nil?
330
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
331
+ end
332
+ end
333
+
334
+ self
335
+ end
336
+
337
+ # Deserializes the data based on type
338
+ # @param string type Data type
339
+ # @param string value Value to be deserialized
340
+ # @return [Object] Deserialized data
341
+ def _deserialize(type, value)
342
+ case type.to_sym
343
+ when :Time
344
+ Time.parse(value)
345
+ when :Date
346
+ Date.parse(value)
347
+ when :String
348
+ value.to_s
349
+ when :Integer
350
+ value.to_i
351
+ when :Float
352
+ value.to_f
353
+ when :Boolean
354
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
355
+ true
356
+ else
357
+ false
358
+ end
359
+ when :Object
360
+ # generic object (usually a Hash), return directly
361
+ value
362
+ when /\AArray<(?<inner_type>.+)>\z/
363
+ inner_type = Regexp.last_match[:inner_type]
364
+ value.map { |v| _deserialize(inner_type, v) }
365
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
366
+ k_type = Regexp.last_match[:k_type]
367
+ v_type = Regexp.last_match[:v_type]
368
+ {}.tap do |hash|
369
+ value.each do |k, v|
370
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
371
+ end
372
+ end
373
+ else # model
374
+ # models (e.g. Pet) or oneOf
375
+ klass = UltracartClient.const_get(type)
376
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
377
+ end
378
+ end
379
+
380
+ # Returns the string representation of the object
381
+ # @return [String] String presentation of the object
382
+ def to_s
383
+ to_hash.to_s
384
+ end
385
+
386
+ # to_body is an alias to to_hash (backward compatibility)
387
+ # @return [Hash] Returns the object in the form of hash
388
+ def to_body
389
+ to_hash
390
+ end
391
+
392
+ # Returns the object in the form of hash
393
+ # @return [Hash] Returns the object in the form of hash
394
+ def to_hash
395
+ hash = {}
396
+ self.class.attribute_map.each_pair do |attr, param|
397
+ value = self.send(attr)
398
+ if value.nil?
399
+ is_nullable = self.class.openapi_nullable.include?(attr)
400
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
401
+ end
402
+
403
+ hash[param] = _to_hash(value)
404
+ end
405
+ hash
406
+ end
407
+
408
+ # Outputs non-array value in the form of hash
409
+ # For object, use to_hash. Otherwise, just return the value
410
+ # @param [Object] value Any valid value
411
+ # @return [Hash] Returns the value in the form of hash
412
+ def _to_hash(value)
413
+ if value.is_a?(Array)
414
+ value.compact.map { |v| _to_hash(v) }
415
+ elsif value.is_a?(Hash)
416
+ {}.tap do |hash|
417
+ value.each { |k, v| hash[k] = _to_hash(v) }
418
+ end
419
+ elsif value.respond_to? :to_hash
420
+ value.to_hash
421
+ else
422
+ value
423
+ end
424
+ end
425
+
426
+ end
427
+
428
+ end
@@ -0,0 +1,232 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbAffiliateNetworksResponse
18
+ # Every network, by name. conversion_pixel is left out; read one network for it.
19
+ attr_accessor :affiliate_networks
20
+
21
+ # The storefront.
22
+ attr_accessor :storefront_oid
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'affiliate_networks' => :'affiliate_networks',
28
+ :'storefront_oid' => :'storefront_oid'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'affiliate_networks' => :'Array<SfvbAffiliateNetwork>',
41
+ :'storefront_oid' => :'Integer'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbAffiliateNetworksResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbAffiliateNetworksResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'affiliate_networks')
67
+ if (value = attributes[:'affiliate_networks']).is_a?(Array)
68
+ self.affiliate_networks = value
69
+ end
70
+ end
71
+
72
+ if attributes.key?(:'storefront_oid')
73
+ self.storefront_oid = attributes[:'storefront_oid']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ affiliate_networks == o.affiliate_networks &&
96
+ storefront_oid == o.storefront_oid
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [affiliate_networks, storefront_oid].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ new.build_from_hash(attributes)
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
+ attributes = attributes.transform_keys(&:to_sym)
124
+ self.class.openapi_types.each_pair do |key, type|
125
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
126
+ self.send("#{key}=", nil)
127
+ elsif 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
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 :Time
148
+ Time.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
+ # models (e.g. Pet) or oneOf
179
+ klass = UltracartClient.const_get(type)
180
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ if value.nil?
203
+ is_nullable = self.class.openapi_nullable.include?(attr)
204
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
205
+ end
206
+
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to? :to_hash
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+
230
+ end
231
+
232
+ end