ultracart_api 4.0.101.rc → 4.0.103.rc

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.
@@ -17,8 +17,6 @@ module UltracartClient
17
17
  class ConversationDepartment
18
18
  attr_accessor :conversation_department_oid
19
19
 
20
- attr_accessor :delete_me
21
-
22
20
  attr_accessor :department_name
23
21
 
24
22
  attr_accessor :merchant_id
@@ -29,7 +27,6 @@ module UltracartClient
29
27
  def self.attribute_map
30
28
  {
31
29
  :'conversation_department_oid' => :'conversation_department_oid',
32
- :'delete_me' => :'delete_me',
33
30
  :'department_name' => :'department_name',
34
31
  :'merchant_id' => :'merchant_id',
35
32
  :'settings' => :'settings'
@@ -45,7 +42,6 @@ module UltracartClient
45
42
  def self.openapi_types
46
43
  {
47
44
  :'conversation_department_oid' => :'Integer',
48
- :'delete_me' => :'Boolean',
49
45
  :'department_name' => :'String',
50
46
  :'merchant_id' => :'String',
51
47
  :'settings' => :'Object'
@@ -77,10 +73,6 @@ module UltracartClient
77
73
  self.conversation_department_oid = attributes[:'conversation_department_oid']
78
74
  end
79
75
 
80
- if attributes.key?(:'delete_me')
81
- self.delete_me = attributes[:'delete_me']
82
- end
83
-
84
76
  if attributes.key?(:'department_name')
85
77
  self.department_name = attributes[:'department_name']
86
78
  end
@@ -113,7 +105,6 @@ module UltracartClient
113
105
  return true if self.equal?(o)
114
106
  self.class == o.class &&
115
107
  conversation_department_oid == o.conversation_department_oid &&
116
- delete_me == o.delete_me &&
117
108
  department_name == o.department_name &&
118
109
  merchant_id == o.merchant_id &&
119
110
  settings == o.settings
@@ -128,7 +119,7 @@ module UltracartClient
128
119
  # Calculates hash code according to all attributes.
129
120
  # @return [Integer] Hash code
130
121
  def hash
131
- [conversation_department_oid, delete_me, department_name, merchant_id, settings].hash
122
+ [conversation_department_oid, department_name, merchant_id, settings].hash
132
123
  end
133
124
 
134
125
  # Builds the object from hash
@@ -15,6 +15,8 @@ require 'time'
15
15
 
16
16
  module UltracartClient
17
17
  class ConversationEngagement
18
+ attr_accessor :active
19
+
18
20
  attr_accessor :conversation_engagement_oid
19
21
 
20
22
  attr_accessor :customer_greeting
@@ -55,6 +57,7 @@ module UltracartClient
55
57
  # Attribute mapping from ruby-style variable name to JSON key.
56
58
  def self.attribute_map
57
59
  {
60
+ :'active' => :'active',
58
61
  :'conversation_engagement_oid' => :'conversation_engagement_oid',
59
62
  :'customer_greeting' => :'customer_greeting',
60
63
  :'department_oids' => :'department_oids',
@@ -73,6 +76,7 @@ module UltracartClient
73
76
  # Attribute type mapping.
74
77
  def self.openapi_types
75
78
  {
79
+ :'active' => :'Boolean',
76
80
  :'conversation_engagement_oid' => :'Integer',
77
81
  :'customer_greeting' => :'String',
78
82
  :'department_oids' => :'Array<Integer>',
@@ -104,6 +108,10 @@ module UltracartClient
104
108
  h[k.to_sym] = v
105
109
  }
106
110
 
111
+ if attributes.key?(:'active')
112
+ self.active = attributes[:'active']
113
+ end
114
+
107
115
  if attributes.key?(:'conversation_engagement_oid')
108
116
  self.conversation_engagement_oid = attributes[:'conversation_engagement_oid']
109
117
  end
@@ -165,6 +173,7 @@ module UltracartClient
165
173
  def ==(o)
166
174
  return true if self.equal?(o)
167
175
  self.class == o.class &&
176
+ active == o.active &&
168
177
  conversation_engagement_oid == o.conversation_engagement_oid &&
169
178
  customer_greeting == o.customer_greeting &&
170
179
  department_oids == o.department_oids &&
@@ -183,7 +192,7 @@ module UltracartClient
183
192
  # Calculates hash code according to all attributes.
184
193
  # @return [Integer] Hash code
185
194
  def hash
186
- [conversation_engagement_oid, customer_greeting, department_oids, engagement_name, equation, time_on_page, visitor_type].hash
195
+ [active, conversation_engagement_oid, customer_greeting, department_oids, engagement_name, equation, time_on_page, visitor_type].hash
187
196
  end
188
197
 
189
198
  # Builds the object from hash
@@ -94,10 +94,18 @@ module UltracartClient
94
94
  # Internal notes about this coupon. These are not visible to customer.
95
95
  attr_accessor :merchant_notes
96
96
 
97
+ attr_accessor :more_loyalty_cashback
98
+
99
+ attr_accessor :more_loyalty_points
100
+
97
101
  attr_accessor :multiple_amounts_off_items
98
102
 
99
103
  attr_accessor :no_discount
100
104
 
105
+ attr_accessor :percent_more_loyalty_cashback
106
+
107
+ attr_accessor :percent_more_loyalty_points
108
+
101
109
  attr_accessor :percent_off_item_with_items_quantity_purchase
102
110
 
103
111
  attr_accessor :percent_off_items
@@ -192,8 +200,12 @@ module UltracartClient
192
200
  :'hide_from_customer' => :'hide_from_customer',
193
201
  :'merchant_code' => :'merchant_code',
194
202
  :'merchant_notes' => :'merchant_notes',
203
+ :'more_loyalty_cashback' => :'more_loyalty_cashback',
204
+ :'more_loyalty_points' => :'more_loyalty_points',
195
205
  :'multiple_amounts_off_items' => :'multiple_amounts_off_items',
196
206
  :'no_discount' => :'no_discount',
207
+ :'percent_more_loyalty_cashback' => :'percent_more_loyalty_cashback',
208
+ :'percent_more_loyalty_points' => :'percent_more_loyalty_points',
197
209
  :'percent_off_item_with_items_quantity_purchase' => :'percent_off_item_with_items_quantity_purchase',
198
210
  :'percent_off_items' => :'percent_off_items',
199
211
  :'percent_off_items_and_free_shipping' => :'percent_off_items_and_free_shipping',
@@ -264,8 +276,12 @@ module UltracartClient
264
276
  :'hide_from_customer' => :'Boolean',
265
277
  :'merchant_code' => :'String',
266
278
  :'merchant_notes' => :'String',
279
+ :'more_loyalty_cashback' => :'CouponMoreLoyaltyCashback',
280
+ :'more_loyalty_points' => :'CouponMoreLoyaltyPoints',
267
281
  :'multiple_amounts_off_items' => :'CouponMultipleAmountsOffItems',
268
282
  :'no_discount' => :'CouponNoDiscount',
283
+ :'percent_more_loyalty_cashback' => :'CouponPercentMoreLoyaltyCashback',
284
+ :'percent_more_loyalty_points' => :'CouponPercentMoreLoyaltyPoints',
269
285
  :'percent_off_item_with_items_quantity_purchase' => :'CouponPercentOffItemWithItemsQuantityPurchase',
270
286
  :'percent_off_items' => :'CouponPercentOffItems',
271
287
  :'percent_off_items_and_free_shipping' => :'CouponPercentOffItemsAndFreeShipping',
@@ -451,6 +467,14 @@ module UltracartClient
451
467
  self.merchant_notes = attributes[:'merchant_notes']
452
468
  end
453
469
 
470
+ if attributes.key?(:'more_loyalty_cashback')
471
+ self.more_loyalty_cashback = attributes[:'more_loyalty_cashback']
472
+ end
473
+
474
+ if attributes.key?(:'more_loyalty_points')
475
+ self.more_loyalty_points = attributes[:'more_loyalty_points']
476
+ end
477
+
454
478
  if attributes.key?(:'multiple_amounts_off_items')
455
479
  self.multiple_amounts_off_items = attributes[:'multiple_amounts_off_items']
456
480
  end
@@ -459,6 +483,14 @@ module UltracartClient
459
483
  self.no_discount = attributes[:'no_discount']
460
484
  end
461
485
 
486
+ if attributes.key?(:'percent_more_loyalty_cashback')
487
+ self.percent_more_loyalty_cashback = attributes[:'percent_more_loyalty_cashback']
488
+ end
489
+
490
+ if attributes.key?(:'percent_more_loyalty_points')
491
+ self.percent_more_loyalty_points = attributes[:'percent_more_loyalty_points']
492
+ end
493
+
462
494
  if attributes.key?(:'percent_off_item_with_items_quantity_purchase')
463
495
  self.percent_off_item_with_items_quantity_purchase = attributes[:'percent_off_item_with_items_quantity_purchase']
464
496
  end
@@ -708,8 +740,12 @@ module UltracartClient
708
740
  hide_from_customer == o.hide_from_customer &&
709
741
  merchant_code == o.merchant_code &&
710
742
  merchant_notes == o.merchant_notes &&
743
+ more_loyalty_cashback == o.more_loyalty_cashback &&
744
+ more_loyalty_points == o.more_loyalty_points &&
711
745
  multiple_amounts_off_items == o.multiple_amounts_off_items &&
712
746
  no_discount == o.no_discount &&
747
+ percent_more_loyalty_cashback == o.percent_more_loyalty_cashback &&
748
+ percent_more_loyalty_points == o.percent_more_loyalty_points &&
713
749
  percent_off_item_with_items_quantity_purchase == o.percent_off_item_with_items_quantity_purchase &&
714
750
  percent_off_items == o.percent_off_items &&
715
751
  percent_off_items_and_free_shipping == o.percent_off_items_and_free_shipping &&
@@ -746,7 +782,7 @@ module UltracartClient
746
782
  # Calculates hash code according to all attributes.
747
783
  # @return [Integer] Hash code
748
784
  def hash
749
- [affiliate_oid, allow_multiple_one_time_codes, amount_off_items, amount_off_shipping, amount_off_shipping_with_items_purchase, amount_off_subtotal, amount_off_subtotal_and_free_shipping, amount_off_subtotal_and_shipping, amount_off_subtotal_with_block_purchase, amount_off_subtotal_with_items_purchase, amount_off_subtotal_with_purchase, amount_shipping_with_subtotal, automatically_apply_coupon_codes, buy_one_get_one, calculated_description, can_be_used_with_other_coupons, coupon_oid, coupon_type, description, discount_item_with_item_purchase, discount_items, expiration_dts, free_item_and_shipping_with_subtotal, free_item_with_item_purchase, free_item_with_subtotal, free_items_with_item_purchase, free_items_with_mixmatch_purchase, free_shipping, free_shipping_specific_items, free_shipping_with_items_purchase, free_shipping_with_subtotal, hide_from_customer, merchant_code, merchant_notes, multiple_amounts_off_items, no_discount, percent_off_item_with_items_quantity_purchase, percent_off_items, percent_off_items_and_free_shipping, percent_off_items_with_items_purchase, percent_off_msrp_items, percent_off_retail_price_items, percent_off_shipping, percent_off_subtotal, percent_off_subtotal_and_free_shipping, percent_off_subtotal_limit, percent_off_subtotal_with_items_purchase, percent_off_subtotal_with_subtotal, quickbooks_code, restrict_by_postal_codes, restrict_by_screen_branding_theme_codes, restrict_by_storefronts, start_dts, super_coupon, tiered_amount_off_items, tiered_amount_off_subtotal, tiered_percent_off_items, tiered_percent_off_shipping, tiered_percent_off_subtotal, tiered_percent_off_subtotal_based_on_msrp, usable_by].hash
785
+ [affiliate_oid, allow_multiple_one_time_codes, amount_off_items, amount_off_shipping, amount_off_shipping_with_items_purchase, amount_off_subtotal, amount_off_subtotal_and_free_shipping, amount_off_subtotal_and_shipping, amount_off_subtotal_with_block_purchase, amount_off_subtotal_with_items_purchase, amount_off_subtotal_with_purchase, amount_shipping_with_subtotal, automatically_apply_coupon_codes, buy_one_get_one, calculated_description, can_be_used_with_other_coupons, coupon_oid, coupon_type, description, discount_item_with_item_purchase, discount_items, expiration_dts, free_item_and_shipping_with_subtotal, free_item_with_item_purchase, free_item_with_subtotal, free_items_with_item_purchase, free_items_with_mixmatch_purchase, free_shipping, free_shipping_specific_items, free_shipping_with_items_purchase, free_shipping_with_subtotal, hide_from_customer, merchant_code, merchant_notes, more_loyalty_cashback, more_loyalty_points, multiple_amounts_off_items, no_discount, percent_more_loyalty_cashback, percent_more_loyalty_points, percent_off_item_with_items_quantity_purchase, percent_off_items, percent_off_items_and_free_shipping, percent_off_items_with_items_purchase, percent_off_msrp_items, percent_off_retail_price_items, percent_off_shipping, percent_off_subtotal, percent_off_subtotal_and_free_shipping, percent_off_subtotal_limit, percent_off_subtotal_with_items_purchase, percent_off_subtotal_with_subtotal, quickbooks_code, restrict_by_postal_codes, restrict_by_screen_branding_theme_codes, restrict_by_storefronts, start_dts, super_coupon, tiered_amount_off_items, tiered_amount_off_subtotal, tiered_percent_off_items, tiered_percent_off_shipping, tiered_percent_off_subtotal, tiered_percent_off_subtotal_based_on_msrp, usable_by].hash
750
786
  end
751
787
 
752
788
  # Builds the object from hash
@@ -0,0 +1,220 @@
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 CouponMoreLoyaltyCashback
18
+ # The additional loyalty cashback
19
+ attr_accessor :loyalty_cashback
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'loyalty_cashback' => :'loyalty_cashback'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'loyalty_cashback' => :'Float'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::CouponMoreLoyaltyCashback` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::CouponMoreLoyaltyCashback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'loyalty_cashback')
62
+ self.loyalty_cashback = attributes[:'loyalty_cashback']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ loyalty_cashback == o.loyalty_cashback
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(o)
90
+ self == o
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [loyalty_cashback].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ self.class.openapi_types.each_pair do |key, type|
113
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
+ self.send("#{key}=", nil)
115
+ elsif type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :Time
136
+ Time.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ # models (e.g. Pet) or oneOf
167
+ klass = UltracartClient.const_get(type)
168
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Outputs non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
204
+ def _to_hash(value)
205
+ if value.is_a?(Array)
206
+ value.compact.map { |v| _to_hash(v) }
207
+ elsif value.is_a?(Hash)
208
+ {}.tap do |hash|
209
+ value.each { |k, v| hash[k] = _to_hash(v) }
210
+ end
211
+ elsif value.respond_to? :to_hash
212
+ value.to_hash
213
+ else
214
+ value
215
+ end
216
+ end
217
+
218
+ end
219
+
220
+ end
@@ -0,0 +1,220 @@
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 CouponMoreLoyaltyPoints
18
+ # The additional loyalty points
19
+ attr_accessor :loyalty_points
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'loyalty_points' => :'loyalty_points'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'loyalty_points' => :'Float'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::CouponMoreLoyaltyPoints` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::CouponMoreLoyaltyPoints`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'loyalty_points')
62
+ self.loyalty_points = attributes[:'loyalty_points']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ loyalty_points == o.loyalty_points
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(o)
90
+ self == o
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [loyalty_points].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ self.class.openapi_types.each_pair do |key, type|
113
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
+ self.send("#{key}=", nil)
115
+ elsif type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :Time
136
+ Time.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ # models (e.g. Pet) or oneOf
167
+ klass = UltracartClient.const_get(type)
168
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Outputs non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
204
+ def _to_hash(value)
205
+ if value.is_a?(Array)
206
+ value.compact.map { |v| _to_hash(v) }
207
+ elsif value.is_a?(Hash)
208
+ {}.tap do |hash|
209
+ value.each { |k, v| hash[k] = _to_hash(v) }
210
+ end
211
+ elsif value.respond_to? :to_hash
212
+ value.to_hash
213
+ else
214
+ value
215
+ end
216
+ end
217
+
218
+ end
219
+
220
+ end