ultracart_api 3.6.16 → 3.6.20

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.
@@ -0,0 +1,285 @@
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 ExperimentVariationStat
17
+ # Total add to cart count for this variation
18
+ attr_accessor :add_to_cart_count
19
+
20
+ # Total bounce count for this variation
21
+ attr_accessor :bounce_count
22
+
23
+ # Total number of seconds spent on the site for this variation
24
+ attr_accessor :duration_seconds_sum
25
+
26
+ # Total event count for this variation
27
+ attr_accessor :event_count
28
+
29
+ # Total initiate checkout count for this variation
30
+ attr_accessor :initiate_checkout_count
31
+
32
+ # Total order count for this variation
33
+ attr_accessor :order_count
34
+
35
+ # Total order item count for this variation
36
+ attr_accessor :order_item_count
37
+
38
+ # Total page view count for this variation
39
+ attr_accessor :page_view_count
40
+
41
+ # Total revenue for this variation
42
+ attr_accessor :revenue
43
+
44
+ # Total sessions for this variation
45
+ attr_accessor :session_count
46
+
47
+ # Date/time that the statistic was created
48
+ attr_accessor :stat_dts
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'add_to_cart_count' => :'add_to_cart_count',
54
+ :'bounce_count' => :'bounce_count',
55
+ :'duration_seconds_sum' => :'duration_seconds_sum',
56
+ :'event_count' => :'event_count',
57
+ :'initiate_checkout_count' => :'initiate_checkout_count',
58
+ :'order_count' => :'order_count',
59
+ :'order_item_count' => :'order_item_count',
60
+ :'page_view_count' => :'page_view_count',
61
+ :'revenue' => :'revenue',
62
+ :'session_count' => :'session_count',
63
+ :'stat_dts' => :'stat_dts'
64
+ }
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.swagger_types
69
+ {
70
+ :'add_to_cart_count' => :'Integer',
71
+ :'bounce_count' => :'Integer',
72
+ :'duration_seconds_sum' => :'Integer',
73
+ :'event_count' => :'Integer',
74
+ :'initiate_checkout_count' => :'Integer',
75
+ :'order_count' => :'Integer',
76
+ :'order_item_count' => :'Integer',
77
+ :'page_view_count' => :'Integer',
78
+ :'revenue' => :'Float',
79
+ :'session_count' => :'Integer',
80
+ :'stat_dts' => :'String'
81
+ }
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ return unless attributes.is_a?(Hash)
88
+
89
+ # convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
91
+
92
+ if attributes.has_key?(:'add_to_cart_count')
93
+ self.add_to_cart_count = attributes[:'add_to_cart_count']
94
+ end
95
+
96
+ if attributes.has_key?(:'bounce_count')
97
+ self.bounce_count = attributes[:'bounce_count']
98
+ end
99
+
100
+ if attributes.has_key?(:'duration_seconds_sum')
101
+ self.duration_seconds_sum = attributes[:'duration_seconds_sum']
102
+ end
103
+
104
+ if attributes.has_key?(:'event_count')
105
+ self.event_count = attributes[:'event_count']
106
+ end
107
+
108
+ if attributes.has_key?(:'initiate_checkout_count')
109
+ self.initiate_checkout_count = attributes[:'initiate_checkout_count']
110
+ end
111
+
112
+ if attributes.has_key?(:'order_count')
113
+ self.order_count = attributes[:'order_count']
114
+ end
115
+
116
+ if attributes.has_key?(:'order_item_count')
117
+ self.order_item_count = attributes[:'order_item_count']
118
+ end
119
+
120
+ if attributes.has_key?(:'page_view_count')
121
+ self.page_view_count = attributes[:'page_view_count']
122
+ end
123
+
124
+ if attributes.has_key?(:'revenue')
125
+ self.revenue = attributes[:'revenue']
126
+ end
127
+
128
+ if attributes.has_key?(:'session_count')
129
+ self.session_count = attributes[:'session_count']
130
+ end
131
+
132
+ if attributes.has_key?(:'stat_dts')
133
+ self.stat_dts = attributes[:'stat_dts']
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ invalid_properties = Array.new
141
+ invalid_properties
142
+ end
143
+
144
+ # Check to see if the all the properties in the model are valid
145
+ # @return true if the model is valid
146
+ def valid?
147
+ true
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ add_to_cart_count == o.add_to_cart_count &&
156
+ bounce_count == o.bounce_count &&
157
+ duration_seconds_sum == o.duration_seconds_sum &&
158
+ event_count == o.event_count &&
159
+ initiate_checkout_count == o.initiate_checkout_count &&
160
+ order_count == o.order_count &&
161
+ order_item_count == o.order_item_count &&
162
+ page_view_count == o.page_view_count &&
163
+ revenue == o.revenue &&
164
+ session_count == o.session_count &&
165
+ stat_dts == o.stat_dts
166
+ end
167
+
168
+ # @see the `==` method
169
+ # @param [Object] Object to be compared
170
+ def eql?(o)
171
+ self == o
172
+ end
173
+
174
+ # Calculates hash code according to all attributes.
175
+ # @return [Fixnum] Hash code
176
+ def hash
177
+ [add_to_cart_count, bounce_count, duration_seconds_sum, event_count, initiate_checkout_count, order_count, order_item_count, page_view_count, revenue, session_count, stat_dts].hash
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ self.class.swagger_types.each_pair do |key, type|
186
+ if type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
190
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
191
+ end
192
+ elsif !attributes[self.class.attribute_map[key]].nil?
193
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
194
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
195
+ end
196
+
197
+ self
198
+ end
199
+
200
+ # Deserializes the data based on type
201
+ # @param string type Data type
202
+ # @param string value Value to be deserialized
203
+ # @return [Object] Deserialized data
204
+ def _deserialize(type, value)
205
+ case type.to_sym
206
+ when :DateTime
207
+ DateTime.parse(value)
208
+ when :Date
209
+ Date.parse(value)
210
+ when :String
211
+ value.to_s
212
+ when :Integer
213
+ value.to_i
214
+ when :Float
215
+ value.to_f
216
+ when :BOOLEAN
217
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
218
+ true
219
+ else
220
+ false
221
+ end
222
+ when :Object
223
+ # generic object (usually a Hash), return directly
224
+ value
225
+ when /\AArray<(?<inner_type>.+)>\z/
226
+ inner_type = Regexp.last_match[:inner_type]
227
+ value.map { |v| _deserialize(inner_type, v) }
228
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
229
+ k_type = Regexp.last_match[:k_type]
230
+ v_type = Regexp.last_match[:v_type]
231
+ {}.tap do |hash|
232
+ value.each do |k, v|
233
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
234
+ end
235
+ end
236
+ else # model
237
+ temp_model = UltracartClient.const_get(type).new
238
+ temp_model.build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ next if value.nil?
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ # Outputs non-array value in the form of hash
267
+ # For object, use to_hash. Otherwise, just return the value
268
+ # @param [Object] value Any valid value
269
+ # @return [Hash] Returns the value in the form of hash
270
+ def _to_hash(value)
271
+ if value.is_a?(Array)
272
+ value.compact.map { |v| _to_hash(v) }
273
+ elsif value.is_a?(Hash)
274
+ {}.tap do |hash|
275
+ value.each { |k, v| hash[k] = _to_hash(v) }
276
+ end
277
+ elsif value.respond_to? :to_hash
278
+ value.to_hash
279
+ else
280
+ value
281
+ end
282
+ end
283
+
284
+ end
285
+ end
@@ -48,6 +48,9 @@ module UltracartClient
48
48
 
49
49
  attr_accessor :enrollment123
50
50
 
51
+ # Fulfillment Add-ons
52
+ attr_accessor :fulfillment_addons
53
+
51
54
  attr_accessor :gift_certificate
52
55
 
53
56
  attr_accessor :google_product_search
@@ -151,6 +154,7 @@ module UltracartClient
151
154
  :'ebay' => :'ebay',
152
155
  :'email_notifications' => :'email_notifications',
153
156
  :'enrollment123' => :'enrollment123',
157
+ :'fulfillment_addons' => :'fulfillment_addons',
154
158
  :'gift_certificate' => :'gift_certificate',
155
159
  :'google_product_search' => :'google_product_search',
156
160
  :'identifiers' => :'identifiers',
@@ -207,6 +211,7 @@ module UltracartClient
207
211
  :'ebay' => :'ItemEbay',
208
212
  :'email_notifications' => :'ItemEmailNotifications',
209
213
  :'enrollment123' => :'ItemEnrollment123',
214
+ :'fulfillment_addons' => :'Array<ItemFulfillmentAddon>',
210
215
  :'gift_certificate' => :'ItemGiftCertificate',
211
216
  :'google_product_search' => :'ItemGoogleProductSearch',
212
217
  :'identifiers' => :'ItemIdentifiers',
@@ -315,6 +320,12 @@ module UltracartClient
315
320
  self.enrollment123 = attributes[:'enrollment123']
316
321
  end
317
322
 
323
+ if attributes.has_key?(:'fulfillment_addons')
324
+ if (value = attributes[:'fulfillment_addons']).is_a?(Array)
325
+ self.fulfillment_addons = value
326
+ end
327
+ end
328
+
318
329
  if attributes.has_key?(:'gift_certificate')
319
330
  self.gift_certificate = attributes[:'gift_certificate']
320
331
  end
@@ -544,6 +555,7 @@ module UltracartClient
544
555
  ebay == o.ebay &&
545
556
  email_notifications == o.email_notifications &&
546
557
  enrollment123 == o.enrollment123 &&
558
+ fulfillment_addons == o.fulfillment_addons &&
547
559
  gift_certificate == o.gift_certificate &&
548
560
  google_product_search == o.google_product_search &&
549
561
  identifiers == o.identifiers &&
@@ -590,7 +602,7 @@ module UltracartClient
590
602
  # Calculates hash code according to all attributes.
591
603
  # @return [Fixnum] Hash code
592
604
  def hash
593
- [accounting, amember, auto_order, ccbill, channel_partner_item_mappings, chargeback, checkout, content, creation_dts, description, description_translated_text_instance_oid, digital_delivery, ebay, email_notifications, enrollment123, gift_certificate, google_product_search, identifiers, inactive, instant_payment_notifications, internal, kit, kit_component_only, kit_definition, last_modified_dts, merchant_id, merchant_item_id, merchant_item_oid, options, parent_category_id, parent_category_path, payment_processing, physical, pricing, properties, realtime_pricing, recommend_replenishment_days, related, reporting, restriction, revguard, reviews, salesforce, shipping, tags, tax, third_party_email_marketing, variant_items, variations, wishlist_member].hash
605
+ [accounting, amember, auto_order, ccbill, channel_partner_item_mappings, chargeback, checkout, content, creation_dts, description, description_translated_text_instance_oid, digital_delivery, ebay, email_notifications, enrollment123, fulfillment_addons, gift_certificate, google_product_search, identifiers, inactive, instant_payment_notifications, internal, kit, kit_component_only, kit_definition, last_modified_dts, merchant_id, merchant_item_id, merchant_item_oid, options, parent_category_id, parent_category_path, payment_processing, physical, pricing, properties, realtime_pricing, recommend_replenishment_days, related, reporting, restriction, revguard, reviews, salesforce, shipping, tags, tax, third_party_email_marketing, variant_items, variations, wishlist_member].hash
594
606
  end
595
607
 
596
608
  # Builds the object from hash
@@ -56,7 +56,7 @@ module UltracartClient
56
56
  # Email list identifier to subscribe the customer to when this rebill occurs
57
57
  attr_accessor :subscribe_email_list_oid
58
58
 
59
- # Type of step (item or pause)
59
+ # Type of step (item, kit only, loop or pause)
60
60
  attr_accessor :type
61
61
 
62
62
  class EnumAttributeValidator
@@ -211,7 +211,7 @@ module UltracartClient
211
211
  # @return true if the model is valid
212
212
  def valid?
213
213
  return false if !@recurring_merchant_item_id.nil? && @recurring_merchant_item_id.to_s.length > 20
214
- type_validator = EnumAttributeValidator.new('String', ['item', 'pause'])
214
+ type_validator = EnumAttributeValidator.new('String', ['item', 'pause', 'loop', 'kit only'])
215
215
  return false unless type_validator.valid?(@type)
216
216
  true
217
217
  end
@@ -229,7 +229,7 @@ module UltracartClient
229
229
  # Custom attribute writer method checking allowed values (enum).
230
230
  # @param [Object] type Object to be assigned
231
231
  def type=(type)
232
- validator = EnumAttributeValidator.new('String', ['item', 'pause'])
232
+ validator = EnumAttributeValidator.new('String', ['item', 'pause', 'loop', 'kit only'])
233
233
  unless validator.valid?(type)
234
234
  fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
235
235
  end
@@ -20,6 +20,9 @@ module UltracartClient
20
20
  # Terms for purchasing this item
21
21
  attr_accessor :terms
22
22
 
23
+ # Terms only apply if the item is on auto order
24
+ attr_accessor :terms_if_auto_order
25
+
23
26
  # Terms translated text instance identifier
24
27
  attr_accessor :terms_translated_text_instance_oid
25
28
 
@@ -28,6 +31,7 @@ module UltracartClient
28
31
  {
29
32
  :'suppress_buysafe' => :'suppress_buysafe',
30
33
  :'terms' => :'terms',
34
+ :'terms_if_auto_order' => :'terms_if_auto_order',
31
35
  :'terms_translated_text_instance_oid' => :'terms_translated_text_instance_oid'
32
36
  }
33
37
  end
@@ -37,6 +41,7 @@ module UltracartClient
37
41
  {
38
42
  :'suppress_buysafe' => :'BOOLEAN',
39
43
  :'terms' => :'String',
44
+ :'terms_if_auto_order' => :'BOOLEAN',
40
45
  :'terms_translated_text_instance_oid' => :'Integer'
41
46
  }
42
47
  end
@@ -57,6 +62,10 @@ module UltracartClient
57
62
  self.terms = attributes[:'terms']
58
63
  end
59
64
 
65
+ if attributes.has_key?(:'terms_if_auto_order')
66
+ self.terms_if_auto_order = attributes[:'terms_if_auto_order']
67
+ end
68
+
60
69
  if attributes.has_key?(:'terms_translated_text_instance_oid')
61
70
  self.terms_translated_text_instance_oid = attributes[:'terms_translated_text_instance_oid']
62
71
  end
@@ -97,6 +106,7 @@ module UltracartClient
97
106
  self.class == o.class &&
98
107
  suppress_buysafe == o.suppress_buysafe &&
99
108
  terms == o.terms &&
109
+ terms_if_auto_order == o.terms_if_auto_order &&
100
110
  terms_translated_text_instance_oid == o.terms_translated_text_instance_oid
101
111
  end
102
112
 
@@ -109,7 +119,7 @@ module UltracartClient
109
119
  # Calculates hash code according to all attributes.
110
120
  # @return [Fixnum] Hash code
111
121
  def hash
112
- [suppress_buysafe, terms, terms_translated_text_instance_oid].hash
122
+ [suppress_buysafe, terms, terms_if_auto_order, terms_translated_text_instance_oid].hash
113
123
  end
114
124
 
115
125
  # Builds the object from hash
@@ -26,6 +26,9 @@ module UltracartClient
26
26
  # Exclude from search
27
27
  attr_accessor :exclude_from_search
28
28
 
29
+ # Exclude from the sitemap for the StoreFront
30
+ attr_accessor :exclude_from_sitemap
31
+
29
32
  # Exclude from the top sellers list in the StoreFront
30
33
  attr_accessor :exclude_from_top_sellers
31
34
 
@@ -57,6 +60,7 @@ module UltracartClient
57
60
  :'attributes' => :'attributes',
58
61
  :'custom_thank_you_url' => :'custom_thank_you_url',
59
62
  :'exclude_from_search' => :'exclude_from_search',
63
+ :'exclude_from_sitemap' => :'exclude_from_sitemap',
60
64
  :'exclude_from_top_sellers' => :'exclude_from_top_sellers',
61
65
  :'extended_description' => :'extended_description',
62
66
  :'extended_description_translated_text_instance_oid' => :'extended_description_translated_text_instance_oid',
@@ -75,6 +79,7 @@ module UltracartClient
75
79
  :'attributes' => :'Array<ItemContentAttribute>',
76
80
  :'custom_thank_you_url' => :'String',
77
81
  :'exclude_from_search' => :'BOOLEAN',
82
+ :'exclude_from_sitemap' => :'BOOLEAN',
78
83
  :'exclude_from_top_sellers' => :'BOOLEAN',
79
84
  :'extended_description' => :'String',
80
85
  :'extended_description_translated_text_instance_oid' => :'Integer',
@@ -114,6 +119,10 @@ module UltracartClient
114
119
  self.exclude_from_search = attributes[:'exclude_from_search']
115
120
  end
116
121
 
122
+ if attributes.has_key?(:'exclude_from_sitemap')
123
+ self.exclude_from_sitemap = attributes[:'exclude_from_sitemap']
124
+ end
125
+
117
126
  if attributes.has_key?(:'exclude_from_top_sellers')
118
127
  self.exclude_from_top_sellers = attributes[:'exclude_from_top_sellers']
119
128
  end
@@ -186,6 +195,7 @@ module UltracartClient
186
195
  attributes == o.attributes &&
187
196
  custom_thank_you_url == o.custom_thank_you_url &&
188
197
  exclude_from_search == o.exclude_from_search &&
198
+ exclude_from_sitemap == o.exclude_from_sitemap &&
189
199
  exclude_from_top_sellers == o.exclude_from_top_sellers &&
190
200
  extended_description == o.extended_description &&
191
201
  extended_description_translated_text_instance_oid == o.extended_description_translated_text_instance_oid &&
@@ -205,7 +215,7 @@ module UltracartClient
205
215
  # Calculates hash code according to all attributes.
206
216
  # @return [Fixnum] Hash code
207
217
  def hash
208
- [assignments, attributes, custom_thank_you_url, exclude_from_search, exclude_from_top_sellers, extended_description, extended_description_translated_text_instance_oid, multimedia, new_item, new_item_end, new_item_start, view_url].hash
218
+ [assignments, attributes, custom_thank_you_url, exclude_from_search, exclude_from_sitemap, exclude_from_top_sellers, extended_description, extended_description_translated_text_instance_oid, multimedia, new_item, new_item_end, new_item_start, view_url].hash
209
219
  end
210
220
 
211
221
  # Builds the object from hash
@@ -0,0 +1,215 @@
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 ItemFulfillmentAddon
17
+ # Add Item Id
18
+ attr_accessor :add_item_id
19
+
20
+ # Add Item object identifier
21
+ attr_accessor :add_item_oid
22
+
23
+ # Quantity
24
+ attr_accessor :once_per_order
25
+
26
+ # Quantity
27
+ attr_accessor :quantity
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'add_item_id' => :'add_item_id',
33
+ :'add_item_oid' => :'add_item_oid',
34
+ :'once_per_order' => :'once_per_order',
35
+ :'quantity' => :'quantity'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'add_item_id' => :'String',
43
+ :'add_item_oid' => :'Integer',
44
+ :'once_per_order' => :'BOOLEAN',
45
+ :'quantity' => :'Integer'
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?(:'add_item_id')
58
+ self.add_item_id = attributes[:'add_item_id']
59
+ end
60
+
61
+ if attributes.has_key?(:'add_item_oid')
62
+ self.add_item_oid = attributes[:'add_item_oid']
63
+ end
64
+
65
+ if attributes.has_key?(:'once_per_order')
66
+ self.once_per_order = attributes[:'once_per_order']
67
+ end
68
+
69
+ if attributes.has_key?(:'quantity')
70
+ self.quantity = attributes[:'quantity']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ add_item_id == o.add_item_id &&
93
+ add_item_oid == o.add_item_oid &&
94
+ once_per_order == o.once_per_order &&
95
+ quantity == o.quantity
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Fixnum] Hash code
106
+ def hash
107
+ [add_item_id, add_item_oid, once_per_order, quantity].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.swagger_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :BOOLEAN
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ temp_model = UltracartClient.const_get(type).new
168
+ temp_model.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ next if value.nil?
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+
214
+ end
215
+ end