ultracart_api 3.4.4 → 3.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -4
  3. data/docs/ConfigurationApi.md +2 -2
  4. data/docs/EmailList.md +1 -0
  5. data/docs/EmailListSegmentFolder.md +12 -0
  6. data/docs/EmailListSegmentFolderResponse.md +12 -0
  7. data/docs/EmailListSegmentFoldersResponse.md +12 -0
  8. data/docs/EmailSegment.md +1 -0
  9. data/docs/PaymentsConfiguration.md +2 -0
  10. data/docs/PaymentsConfigurationCheck.md +0 -4
  11. data/docs/PaymentsConfigurationCreditCard.md +0 -1
  12. data/docs/PaymentsConfigurationEcheck.md +11 -0
  13. data/docs/PaymentsConfigurationMoneyOrder.md +9 -0
  14. data/docs/RotatingTransactionGateway.md +4 -3
  15. data/docs/StorefrontApi.md +260 -0
  16. data/lib/ultracart_api.rb +5 -0
  17. data/lib/ultracart_api/api/configuration_api.rb +3 -3
  18. data/lib/ultracart_api/api/storefront_api.rb +295 -0
  19. data/lib/ultracart_api/models/email_list.rb +11 -1
  20. data/lib/ultracart_api/models/email_list_segment_folder.rb +240 -0
  21. data/lib/ultracart_api/models/email_list_segment_folder_response.rb +221 -0
  22. data/lib/ultracart_api/models/email_list_segment_folders_response.rb +223 -0
  23. data/lib/ultracart_api/models/email_segment.rb +11 -1
  24. data/lib/ultracart_api/models/payments_configuration.rb +19 -1
  25. data/lib/ultracart_api/models/payments_configuration_check.rb +1 -37
  26. data/lib/ultracart_api/models/payments_configuration_credit_card.rb +1 -10
  27. data/lib/ultracart_api/models/payments_configuration_echeck.rb +211 -0
  28. data/lib/ultracart_api/models/payments_configuration_money_order.rb +193 -0
  29. data/lib/ultracart_api/models/rotating_transaction_gateway.rb +13 -3
  30. data/lib/ultracart_api/version.rb +1 -1
  31. metadata +12 -2
@@ -26,8 +26,12 @@ module UltracartClient
26
26
 
27
27
  attr_accessor :credit_card
28
28
 
29
+ attr_accessor :e_check
30
+
29
31
  attr_accessor :loan_hero
30
32
 
33
+ attr_accessor :money_order
34
+
31
35
  attr_accessor :pay_pal
32
36
 
33
37
  attr_accessor :purchase_order
@@ -55,7 +59,9 @@ module UltracartClient
55
59
  :'check' => :'check',
56
60
  :'cod' => :'cod',
57
61
  :'credit_card' => :'creditCard',
62
+ :'e_check' => :'eCheck',
58
63
  :'loan_hero' => :'loanHero',
64
+ :'money_order' => :'moneyOrder',
59
65
  :'pay_pal' => :'payPal',
60
66
  :'purchase_order' => :'purchaseOrder',
61
67
  :'quote_request' => :'quoteRequest',
@@ -77,7 +83,9 @@ module UltracartClient
77
83
  :'check' => :'PaymentsConfigurationCheck',
78
84
  :'cod' => :'PaymentsConfigurationCOD',
79
85
  :'credit_card' => :'PaymentsConfigurationCreditCard',
86
+ :'e_check' => :'PaymentsConfigurationEcheck',
80
87
  :'loan_hero' => :'PaymentsConfigurationLoanHero',
88
+ :'money_order' => :'PaymentsConfigurationMoneyOrder',
81
89
  :'pay_pal' => :'PaymentsConfigurationPayPal',
82
90
  :'purchase_order' => :'PaymentsConfigurationPurchaseOrder',
83
91
  :'quote_request' => :'PaymentsConfigurationQuoteRequest',
@@ -122,10 +130,18 @@ module UltracartClient
122
130
  self.credit_card = attributes[:'creditCard']
123
131
  end
124
132
 
133
+ if attributes.has_key?(:'eCheck')
134
+ self.e_check = attributes[:'eCheck']
135
+ end
136
+
125
137
  if attributes.has_key?(:'loanHero')
126
138
  self.loan_hero = attributes[:'loanHero']
127
139
  end
128
140
 
141
+ if attributes.has_key?(:'moneyOrder')
142
+ self.money_order = attributes[:'moneyOrder']
143
+ end
144
+
129
145
  if attributes.has_key?(:'payPal')
130
146
  self.pay_pal = attributes[:'payPal']
131
147
  end
@@ -187,7 +203,9 @@ module UltracartClient
187
203
  check == o.check &&
188
204
  cod == o.cod &&
189
205
  credit_card == o.credit_card &&
206
+ e_check == o.e_check &&
190
207
  loan_hero == o.loan_hero &&
208
+ money_order == o.money_order &&
191
209
  pay_pal == o.pay_pal &&
192
210
  purchase_order == o.purchase_order &&
193
211
  quote_request == o.quote_request &&
@@ -208,7 +226,7 @@ module UltracartClient
208
226
  # Calculates hash code according to all attributes.
209
227
  # @return [Fixnum] Hash code
210
228
  def hash
211
- [affirm, amazon, cash, check, cod, credit_card, loan_hero, pay_pal, purchase_order, quote_request, sezzle, show_accounting_code, switch_to_sub_tab, switch_to_tab, we_pay, wire_transfer].hash
229
+ [affirm, amazon, cash, check, cod, credit_card, e_check, loan_hero, money_order, pay_pal, purchase_order, quote_request, sezzle, show_accounting_code, switch_to_sub_tab, switch_to_tab, we_pay, wire_transfer].hash
212
230
  end
213
231
 
214
232
  # Builds the object from hash
@@ -16,20 +16,12 @@ module UltracartClient
16
16
  class PaymentsConfigurationCheck
17
17
  attr_accessor :accept_check_orders
18
18
 
19
- attr_accessor :accept_e_check
20
-
21
- attr_accessor :accept_money_orders
22
-
23
19
  attr_accessor :check_accounting_code
24
20
 
25
21
  attr_accessor :check_deposit_to_account
26
22
 
27
23
  attr_accessor :checks_payable_to
28
24
 
29
- attr_accessor :e_check_accounting_code
30
-
31
- attr_accessor :e_check_deposit_to_account
32
-
33
25
  attr_accessor :mail_to_address1
34
26
 
35
27
  attr_accessor :mail_to_address2
@@ -54,13 +46,9 @@ module UltracartClient
54
46
  def self.attribute_map
55
47
  {
56
48
  :'accept_check_orders' => :'acceptCheckOrders',
57
- :'accept_e_check' => :'acceptECheck',
58
- :'accept_money_orders' => :'acceptMoneyOrders',
59
49
  :'check_accounting_code' => :'checkAccountingCode',
60
50
  :'check_deposit_to_account' => :'checkDepositToAccount',
61
51
  :'checks_payable_to' => :'checksPayableTo',
62
- :'e_check_accounting_code' => :'eCheckAccountingCode',
63
- :'e_check_deposit_to_account' => :'eCheckDepositToAccount',
64
52
  :'mail_to_address1' => :'mailToAddress1',
65
53
  :'mail_to_address2' => :'mailToAddress2',
66
54
  :'mail_to_city' => :'mailToCity',
@@ -78,13 +66,9 @@ module UltracartClient
78
66
  def self.swagger_types
79
67
  {
80
68
  :'accept_check_orders' => :'BOOLEAN',
81
- :'accept_e_check' => :'BOOLEAN',
82
- :'accept_money_orders' => :'BOOLEAN',
83
69
  :'check_accounting_code' => :'String',
84
70
  :'check_deposit_to_account' => :'String',
85
71
  :'checks_payable_to' => :'String',
86
- :'e_check_accounting_code' => :'String',
87
- :'e_check_deposit_to_account' => :'String',
88
72
  :'mail_to_address1' => :'String',
89
73
  :'mail_to_address2' => :'String',
90
74
  :'mail_to_city' => :'String',
@@ -110,14 +94,6 @@ module UltracartClient
110
94
  self.accept_check_orders = attributes[:'acceptCheckOrders']
111
95
  end
112
96
 
113
- if attributes.has_key?(:'acceptECheck')
114
- self.accept_e_check = attributes[:'acceptECheck']
115
- end
116
-
117
- if attributes.has_key?(:'acceptMoneyOrders')
118
- self.accept_money_orders = attributes[:'acceptMoneyOrders']
119
- end
120
-
121
97
  if attributes.has_key?(:'checkAccountingCode')
122
98
  self.check_accounting_code = attributes[:'checkAccountingCode']
123
99
  end
@@ -130,14 +106,6 @@ module UltracartClient
130
106
  self.checks_payable_to = attributes[:'checksPayableTo']
131
107
  end
132
108
 
133
- if attributes.has_key?(:'eCheckAccountingCode')
134
- self.e_check_accounting_code = attributes[:'eCheckAccountingCode']
135
- end
136
-
137
- if attributes.has_key?(:'eCheckDepositToAccount')
138
- self.e_check_deposit_to_account = attributes[:'eCheckDepositToAccount']
139
- end
140
-
141
109
  if attributes.has_key?(:'mailToAddress1')
142
110
  self.mail_to_address1 = attributes[:'mailToAddress1']
143
111
  end
@@ -198,13 +166,9 @@ module UltracartClient
198
166
  return true if self.equal?(o)
199
167
  self.class == o.class &&
200
168
  accept_check_orders == o.accept_check_orders &&
201
- accept_e_check == o.accept_e_check &&
202
- accept_money_orders == o.accept_money_orders &&
203
169
  check_accounting_code == o.check_accounting_code &&
204
170
  check_deposit_to_account == o.check_deposit_to_account &&
205
171
  checks_payable_to == o.checks_payable_to &&
206
- e_check_accounting_code == o.e_check_accounting_code &&
207
- e_check_deposit_to_account == o.e_check_deposit_to_account &&
208
172
  mail_to_address1 == o.mail_to_address1 &&
209
173
  mail_to_address2 == o.mail_to_address2 &&
210
174
  mail_to_city == o.mail_to_city &&
@@ -226,7 +190,7 @@ module UltracartClient
226
190
  # Calculates hash code according to all attributes.
227
191
  # @return [Fixnum] Hash code
228
192
  def hash
229
- [accept_check_orders, accept_e_check, accept_money_orders, check_accounting_code, check_deposit_to_account, checks_payable_to, e_check_accounting_code, e_check_deposit_to_account, mail_to_address1, mail_to_address2, mail_to_city, mail_to_country, mail_to_name, mail_to_state, mail_to_zip, money_order_accounting_code, money_order_deposit_to_account, restrictions].hash
193
+ [accept_check_orders, check_accounting_code, check_deposit_to_account, checks_payable_to, mail_to_address1, mail_to_address2, mail_to_city, mail_to_country, mail_to_name, mail_to_state, mail_to_zip, money_order_accounting_code, money_order_deposit_to_account, restrictions].hash
230
194
  end
231
195
 
232
196
  # Builds the object from hash
@@ -28,8 +28,6 @@ module UltracartClient
28
28
 
29
29
  attr_accessor :hide_connect_single_gateway
30
30
 
31
- attr_accessor :immediate_finalize_domains
32
-
33
31
  attr_accessor :send_customer_billing_update_on_decline
34
32
 
35
33
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -42,7 +40,6 @@ module UltracartClient
42
40
  :'configured_gateways_details' => :'configuredGatewaysDetails',
43
41
  :'failed_attempts' => :'failedAttempts',
44
42
  :'hide_connect_single_gateway' => :'hideConnectSingleGateway',
45
- :'immediate_finalize_domains' => :'immediateFinalizeDomains',
46
43
  :'send_customer_billing_update_on_decline' => :'sendCustomerBillingUpdateOnDecline'
47
44
  }
48
45
  end
@@ -57,7 +54,6 @@ module UltracartClient
57
54
  :'configured_gateways_details' => :'String',
58
55
  :'failed_attempts' => :'String',
59
56
  :'hide_connect_single_gateway' => :'BOOLEAN',
60
- :'immediate_finalize_domains' => :'String',
61
57
  :'send_customer_billing_update_on_decline' => :'BOOLEAN'
62
58
  }
63
59
  end
@@ -98,10 +94,6 @@ module UltracartClient
98
94
  self.hide_connect_single_gateway = attributes[:'hideConnectSingleGateway']
99
95
  end
100
96
 
101
- if attributes.has_key?(:'immediateFinalizeDomains')
102
- self.immediate_finalize_domains = attributes[:'immediateFinalizeDomains']
103
- end
104
-
105
97
  if attributes.has_key?(:'sendCustomerBillingUpdateOnDecline')
106
98
  self.send_customer_billing_update_on_decline = attributes[:'sendCustomerBillingUpdateOnDecline']
107
99
  end
@@ -132,7 +124,6 @@ module UltracartClient
132
124
  configured_gateways_details == o.configured_gateways_details &&
133
125
  failed_attempts == o.failed_attempts &&
134
126
  hide_connect_single_gateway == o.hide_connect_single_gateway &&
135
- immediate_finalize_domains == o.immediate_finalize_domains &&
136
127
  send_customer_billing_update_on_decline == o.send_customer_billing_update_on_decline
137
128
  end
138
129
 
@@ -145,7 +136,7 @@ module UltracartClient
145
136
  # Calculates hash code according to all attributes.
146
137
  # @return [Fixnum] Hash code
147
138
  def hash
148
- [accept_credit_cards, billed_by, charge_during_checkout, collect_cvv2, configured_gateways_details, failed_attempts, hide_connect_single_gateway, immediate_finalize_domains, send_customer_billing_update_on_decline].hash
139
+ [accept_credit_cards, billed_by, charge_during_checkout, collect_cvv2, configured_gateways_details, failed_attempts, hide_connect_single_gateway, send_customer_billing_update_on_decline].hash
149
140
  end
150
141
 
151
142
  # Builds the object from hash
@@ -0,0 +1,211 @@
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 PaymentsConfigurationEcheck
17
+ attr_accessor :accept_e_check
18
+
19
+ attr_accessor :e_check_accounting_code
20
+
21
+ attr_accessor :e_check_deposit_to_account
22
+
23
+ attr_accessor :restrictions
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'accept_e_check' => :'acceptECheck',
29
+ :'e_check_accounting_code' => :'eCheckAccountingCode',
30
+ :'e_check_deposit_to_account' => :'eCheckDepositToAccount',
31
+ :'restrictions' => :'restrictions'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ :'accept_e_check' => :'BOOLEAN',
39
+ :'e_check_accounting_code' => :'String',
40
+ :'e_check_deposit_to_account' => :'String',
41
+ :'restrictions' => :'PaymentsConfigurationRestrictions'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+
53
+ if attributes.has_key?(:'acceptECheck')
54
+ self.accept_e_check = attributes[:'acceptECheck']
55
+ end
56
+
57
+ if attributes.has_key?(:'eCheckAccountingCode')
58
+ self.e_check_accounting_code = attributes[:'eCheckAccountingCode']
59
+ end
60
+
61
+ if attributes.has_key?(:'eCheckDepositToAccount')
62
+ self.e_check_deposit_to_account = attributes[:'eCheckDepositToAccount']
63
+ end
64
+
65
+ if attributes.has_key?(:'restrictions')
66
+ self.restrictions = attributes[:'restrictions']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ accept_e_check == o.accept_e_check &&
89
+ e_check_accounting_code == o.e_check_accounting_code &&
90
+ e_check_deposit_to_account == o.e_check_deposit_to_account &&
91
+ restrictions == o.restrictions
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Fixnum] Hash code
102
+ def hash
103
+ [accept_e_check, e_check_accounting_code, e_check_deposit_to_account, restrictions].hash
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
+ self.class.swagger_types.each_pair do |key, type|
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :DateTime
133
+ DateTime.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :BOOLEAN
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ temp_model = UltracartClient.const_get(type).new
164
+ temp_model.build_from_hash(value)
165
+ end
166
+ end
167
+
168
+ # Returns the string representation of the object
169
+ # @return [String] String presentation of the object
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_hash (backward compatibility)
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_body
177
+ to_hash
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ next if value.nil?
187
+ hash[param] = _to_hash(value)
188
+ end
189
+ hash
190
+ end
191
+
192
+ # Outputs non-array value in the form of hash
193
+ # For object, use to_hash. Otherwise, just return the value
194
+ # @param [Object] value Any valid value
195
+ # @return [Hash] Returns the value in the form of hash
196
+ def _to_hash(value)
197
+ if value.is_a?(Array)
198
+ value.compact.map { |v| _to_hash(v) }
199
+ elsif value.is_a?(Hash)
200
+ {}.tap do |hash|
201
+ value.each { |k, v| hash[k] = _to_hash(v) }
202
+ end
203
+ elsif value.respond_to? :to_hash
204
+ value.to_hash
205
+ else
206
+ value
207
+ end
208
+ end
209
+
210
+ end
211
+ end
@@ -0,0 +1,193 @@
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 PaymentsConfigurationMoneyOrder
17
+ attr_accessor :accept_money_orders
18
+
19
+ attr_accessor :restrictions
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'accept_money_orders' => :'acceptMoneyOrders',
25
+ :'restrictions' => :'restrictions'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'accept_money_orders' => :'BOOLEAN',
33
+ :'restrictions' => :'PaymentsConfigurationRestrictions'
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?(:'acceptMoneyOrders')
46
+ self.accept_money_orders = attributes[:'acceptMoneyOrders']
47
+ end
48
+
49
+ if attributes.has_key?(:'restrictions')
50
+ self.restrictions = attributes[:'restrictions']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ true
65
+ end
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(o)
70
+ return true if self.equal?(o)
71
+ self.class == o.class &&
72
+ accept_money_orders == o.accept_money_orders &&
73
+ restrictions == o.restrictions
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [accept_money_orders, restrictions].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :BOOLEAN
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ temp_model = UltracartClient.const_get(type).new
146
+ temp_model.build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ # Outputs non-array value in the form of hash
175
+ # For object, use to_hash. Otherwise, just return the value
176
+ # @param [Object] value Any valid value
177
+ # @return [Hash] Returns the value in the form of hash
178
+ def _to_hash(value)
179
+ if value.is_a?(Array)
180
+ value.compact.map { |v| _to_hash(v) }
181
+ elsif value.is_a?(Hash)
182
+ {}.tap do |hash|
183
+ value.each { |k, v| hash[k] = _to_hash(v) }
184
+ end
185
+ elsif value.respond_to? :to_hash
186
+ value.to_hash
187
+ else
188
+ value
189
+ end
190
+ end
191
+
192
+ end
193
+ end