ultracart_api 3.3.2 → 3.4.3

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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +61 -4
  3. data/docs/ConfigurationApi.md +756 -0
  4. data/docs/DelayAutoOrdersResponse.md +12 -0
  5. data/docs/IntegrationLogApi.md +51 -0
  6. data/docs/IntegrationLogSummary.md +16 -0
  7. data/docs/IntegrationLogSummaryQueryRequest.md +9 -0
  8. data/docs/IntegrationLogSummaryQueryResponse.md +12 -0
  9. data/docs/OrderChannelPartner.md +1 -0
  10. data/docs/PaymentsConfiguration.md +23 -0
  11. data/docs/PaymentsConfigurationAffirm.md +15 -0
  12. data/docs/PaymentsConfigurationAmazon.md +15 -0
  13. data/docs/PaymentsConfigurationCOD.md +13 -0
  14. data/docs/PaymentsConfigurationCash.md +9 -0
  15. data/docs/PaymentsConfigurationCheck.md +25 -0
  16. data/docs/PaymentsConfigurationCreditCard.md +16 -0
  17. data/docs/PaymentsConfigurationLoanHero.md +12 -0
  18. data/docs/PaymentsConfigurationPayPal.md +36 -0
  19. data/docs/PaymentsConfigurationPurchaseOrder.md +11 -0
  20. data/docs/PaymentsConfigurationQuoteRequest.md +10 -0
  21. data/docs/PaymentsConfigurationResponse.md +12 -0
  22. data/docs/PaymentsConfigurationRestrictions.md +19 -0
  23. data/docs/PaymentsConfigurationSezzle.md +15 -0
  24. data/docs/PaymentsConfigurationWePay.md +35 -0
  25. data/docs/PaymentsConfigurationWireTransfer.md +18 -0
  26. data/docs/PaymentsThemeTransactionType.md +10 -0
  27. data/docs/PaymentsWepayEnroll.md +22 -0
  28. data/docs/RotatingTransactionGateway.md +50 -0
  29. data/docs/RotatingTransactionGatewayResponse.md +12 -0
  30. data/docs/RotatingTransactionGatewaysResponse.md +12 -0
  31. data/docs/RtgCurrency.md +10 -0
  32. data/docs/RtgDayOfMonthRestriction.md +9 -0
  33. data/docs/RtgDayOfWeekRestriction.md +10 -0
  34. data/docs/RtgSummaryGateway.md +24 -0
  35. data/docs/RtgSummaryResponse.md +14 -0
  36. data/docs/RtgThemeRestriction.md +10 -0
  37. data/docs/StripeConnectResponse.md +12 -0
  38. data/docs/TransactionGateway.md +71 -0
  39. data/docs/TransactionGatewaysRequest.md +10 -0
  40. data/docs/TransactionGatewaysResponse.md +12 -0
  41. data/lib/ultracart_api.rb +36 -0
  42. data/lib/ultracart_api/api/configuration_api.rb +843 -0
  43. data/lib/ultracart_api/api/integration_log_api.rb +55 -0
  44. data/lib/ultracart_api/models/delay_auto_orders_response.rb +221 -0
  45. data/lib/ultracart_api/models/integration_log_summary.rb +256 -0
  46. data/lib/ultracart_api/models/integration_log_summary_query_request.rb +195 -0
  47. data/lib/ultracart_api/models/integration_log_summary_query_response.rb +223 -0
  48. data/lib/ultracart_api/models/order_channel_partner.rb +11 -1
  49. data/lib/ultracart_api/models/payments_configuration.rb +319 -0
  50. data/lib/ultracart_api/models/payments_configuration_affirm.rb +247 -0
  51. data/lib/ultracart_api/models/payments_configuration_amazon.rb +247 -0
  52. data/lib/ultracart_api/models/payments_configuration_cash.rb +193 -0
  53. data/lib/ultracart_api/models/payments_configuration_check.rb +337 -0
  54. data/lib/ultracart_api/models/payments_configuration_cod.rb +229 -0
  55. data/lib/ultracart_api/models/payments_configuration_credit_card.rb +256 -0
  56. data/lib/ultracart_api/models/payments_configuration_loan_hero.rb +220 -0
  57. data/lib/ultracart_api/models/payments_configuration_pay_pal.rb +436 -0
  58. data/lib/ultracart_api/models/payments_configuration_purchase_order.rb +211 -0
  59. data/lib/ultracart_api/models/payments_configuration_quote_request.rb +202 -0
  60. data/lib/ultracart_api/models/payments_configuration_response.rb +221 -0
  61. data/lib/ultracart_api/models/payments_configuration_restrictions.rb +283 -0
  62. data/lib/ultracart_api/models/payments_configuration_sezzle.rb +247 -0
  63. data/lib/ultracart_api/models/payments_configuration_we_pay.rb +427 -0
  64. data/lib/ultracart_api/models/payments_configuration_wire_transfer.rb +274 -0
  65. data/lib/ultracart_api/models/payments_theme_transaction_type.rb +239 -0
  66. data/lib/ultracart_api/models/payments_wepay_enroll.rb +310 -0
  67. data/lib/ultracart_api/models/rotating_transaction_gateway.rb +665 -0
  68. data/lib/ultracart_api/models/rotating_transaction_gateway_response.rb +221 -0
  69. data/lib/ultracart_api/models/rotating_transaction_gateways_response.rb +223 -0
  70. data/lib/ultracart_api/models/rtg_currency.rb +205 -0
  71. data/lib/ultracart_api/models/rtg_day_of_month_restriction.rb +195 -0
  72. data/lib/ultracart_api/models/rtg_day_of_week_restriction.rb +205 -0
  73. data/lib/ultracart_api/models/rtg_summary_gateway.rb +329 -0
  74. data/lib/ultracart_api/models/rtg_summary_response.rb +240 -0
  75. data/lib/ultracart_api/models/rtg_theme_restriction.rb +239 -0
  76. data/lib/ultracart_api/models/stripe_connect_response.rb +221 -0
  77. data/lib/ultracart_api/models/transaction_gateway.rb +823 -0
  78. data/lib/ultracart_api/models/transaction_gateways_request.rb +242 -0
  79. data/lib/ultracart_api/models/transaction_gateways_response.rb +223 -0
  80. data/lib/ultracart_api/version.rb +1 -1
  81. metadata +74 -2
@@ -0,0 +1,319 @@
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 PaymentsConfiguration
17
+ attr_accessor :affirm
18
+
19
+ attr_accessor :amazon
20
+
21
+ attr_accessor :cash
22
+
23
+ attr_accessor :check
24
+
25
+ attr_accessor :cod
26
+
27
+ attr_accessor :credit_card
28
+
29
+ attr_accessor :loan_hero
30
+
31
+ attr_accessor :pay_pal
32
+
33
+ attr_accessor :purchase_order
34
+
35
+ attr_accessor :quote_request
36
+
37
+ attr_accessor :sezzle
38
+
39
+ attr_accessor :show_accounting_code
40
+
41
+ attr_accessor :switch_to_sub_tab
42
+
43
+ attr_accessor :switch_to_tab
44
+
45
+ attr_accessor :we_pay
46
+
47
+ attr_accessor :wire_transfer
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'affirm' => :'affirm',
53
+ :'amazon' => :'amazon',
54
+ :'cash' => :'cash',
55
+ :'check' => :'check',
56
+ :'cod' => :'cod',
57
+ :'credit_card' => :'creditCard',
58
+ :'loan_hero' => :'loanHero',
59
+ :'pay_pal' => :'payPal',
60
+ :'purchase_order' => :'purchaseOrder',
61
+ :'quote_request' => :'quoteRequest',
62
+ :'sezzle' => :'sezzle',
63
+ :'show_accounting_code' => :'showAccountingCode',
64
+ :'switch_to_sub_tab' => :'switchToSubTab',
65
+ :'switch_to_tab' => :'switchToTab',
66
+ :'we_pay' => :'wePay',
67
+ :'wire_transfer' => :'wireTransfer'
68
+ }
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.swagger_types
73
+ {
74
+ :'affirm' => :'PaymentsConfigurationAffirm',
75
+ :'amazon' => :'PaymentsConfigurationAmazon',
76
+ :'cash' => :'PaymentsConfigurationCash',
77
+ :'check' => :'PaymentsConfigurationCheck',
78
+ :'cod' => :'PaymentsConfigurationCOD',
79
+ :'credit_card' => :'PaymentsConfigurationCreditCard',
80
+ :'loan_hero' => :'PaymentsConfigurationLoanHero',
81
+ :'pay_pal' => :'PaymentsConfigurationPayPal',
82
+ :'purchase_order' => :'PaymentsConfigurationPurchaseOrder',
83
+ :'quote_request' => :'PaymentsConfigurationQuoteRequest',
84
+ :'sezzle' => :'PaymentsConfigurationSezzle',
85
+ :'show_accounting_code' => :'BOOLEAN',
86
+ :'switch_to_sub_tab' => :'String',
87
+ :'switch_to_tab' => :'String',
88
+ :'we_pay' => :'PaymentsConfigurationWePay',
89
+ :'wire_transfer' => :'PaymentsConfigurationWireTransfer'
90
+ }
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ return unless attributes.is_a?(Hash)
97
+
98
+ # convert string to symbol for hash key
99
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
100
+
101
+ if attributes.has_key?(:'affirm')
102
+ self.affirm = attributes[:'affirm']
103
+ end
104
+
105
+ if attributes.has_key?(:'amazon')
106
+ self.amazon = attributes[:'amazon']
107
+ end
108
+
109
+ if attributes.has_key?(:'cash')
110
+ self.cash = attributes[:'cash']
111
+ end
112
+
113
+ if attributes.has_key?(:'check')
114
+ self.check = attributes[:'check']
115
+ end
116
+
117
+ if attributes.has_key?(:'cod')
118
+ self.cod = attributes[:'cod']
119
+ end
120
+
121
+ if attributes.has_key?(:'creditCard')
122
+ self.credit_card = attributes[:'creditCard']
123
+ end
124
+
125
+ if attributes.has_key?(:'loanHero')
126
+ self.loan_hero = attributes[:'loanHero']
127
+ end
128
+
129
+ if attributes.has_key?(:'payPal')
130
+ self.pay_pal = attributes[:'payPal']
131
+ end
132
+
133
+ if attributes.has_key?(:'purchaseOrder')
134
+ self.purchase_order = attributes[:'purchaseOrder']
135
+ end
136
+
137
+ if attributes.has_key?(:'quoteRequest')
138
+ self.quote_request = attributes[:'quoteRequest']
139
+ end
140
+
141
+ if attributes.has_key?(:'sezzle')
142
+ self.sezzle = attributes[:'sezzle']
143
+ end
144
+
145
+ if attributes.has_key?(:'showAccountingCode')
146
+ self.show_accounting_code = attributes[:'showAccountingCode']
147
+ end
148
+
149
+ if attributes.has_key?(:'switchToSubTab')
150
+ self.switch_to_sub_tab = attributes[:'switchToSubTab']
151
+ end
152
+
153
+ if attributes.has_key?(:'switchToTab')
154
+ self.switch_to_tab = attributes[:'switchToTab']
155
+ end
156
+
157
+ if attributes.has_key?(:'wePay')
158
+ self.we_pay = attributes[:'wePay']
159
+ end
160
+
161
+ if attributes.has_key?(:'wireTransfer')
162
+ self.wire_transfer = attributes[:'wireTransfer']
163
+ end
164
+ end
165
+
166
+ # Show invalid properties with the reasons. Usually used together with valid?
167
+ # @return Array for valid properties with the reasons
168
+ def list_invalid_properties
169
+ invalid_properties = Array.new
170
+ invalid_properties
171
+ end
172
+
173
+ # Check to see if the all the properties in the model are valid
174
+ # @return true if the model is valid
175
+ def valid?
176
+ true
177
+ end
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] Object to be compared
181
+ def ==(o)
182
+ return true if self.equal?(o)
183
+ self.class == o.class &&
184
+ affirm == o.affirm &&
185
+ amazon == o.amazon &&
186
+ cash == o.cash &&
187
+ check == o.check &&
188
+ cod == o.cod &&
189
+ credit_card == o.credit_card &&
190
+ loan_hero == o.loan_hero &&
191
+ pay_pal == o.pay_pal &&
192
+ purchase_order == o.purchase_order &&
193
+ quote_request == o.quote_request &&
194
+ sezzle == o.sezzle &&
195
+ show_accounting_code == o.show_accounting_code &&
196
+ switch_to_sub_tab == o.switch_to_sub_tab &&
197
+ switch_to_tab == o.switch_to_tab &&
198
+ we_pay == o.we_pay &&
199
+ wire_transfer == o.wire_transfer
200
+ end
201
+
202
+ # @see the `==` method
203
+ # @param [Object] Object to be compared
204
+ def eql?(o)
205
+ self == o
206
+ end
207
+
208
+ # Calculates hash code according to all attributes.
209
+ # @return [Fixnum] Hash code
210
+ 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
212
+ end
213
+
214
+ # Builds the object from hash
215
+ # @param [Hash] attributes Model attributes in the form of hash
216
+ # @return [Object] Returns the model itself
217
+ def build_from_hash(attributes)
218
+ return nil unless attributes.is_a?(Hash)
219
+ self.class.swagger_types.each_pair do |key, type|
220
+ if type =~ /\AArray<(.*)>/i
221
+ # check to ensure the input is an array given that the attribute
222
+ # is documented as an array but the input is not
223
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
224
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
225
+ end
226
+ elsif !attributes[self.class.attribute_map[key]].nil?
227
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
228
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
229
+ end
230
+
231
+ self
232
+ end
233
+
234
+ # Deserializes the data based on type
235
+ # @param string type Data type
236
+ # @param string value Value to be deserialized
237
+ # @return [Object] Deserialized data
238
+ def _deserialize(type, value)
239
+ case type.to_sym
240
+ when :DateTime
241
+ DateTime.parse(value)
242
+ when :Date
243
+ Date.parse(value)
244
+ when :String
245
+ value.to_s
246
+ when :Integer
247
+ value.to_i
248
+ when :Float
249
+ value.to_f
250
+ when :BOOLEAN
251
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
252
+ true
253
+ else
254
+ false
255
+ end
256
+ when :Object
257
+ # generic object (usually a Hash), return directly
258
+ value
259
+ when /\AArray<(?<inner_type>.+)>\z/
260
+ inner_type = Regexp.last_match[:inner_type]
261
+ value.map { |v| _deserialize(inner_type, v) }
262
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
263
+ k_type = Regexp.last_match[:k_type]
264
+ v_type = Regexp.last_match[:v_type]
265
+ {}.tap do |hash|
266
+ value.each do |k, v|
267
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
268
+ end
269
+ end
270
+ else # model
271
+ temp_model = UltracartClient.const_get(type).new
272
+ temp_model.build_from_hash(value)
273
+ end
274
+ end
275
+
276
+ # Returns the string representation of the object
277
+ # @return [String] String presentation of the object
278
+ def to_s
279
+ to_hash.to_s
280
+ end
281
+
282
+ # to_body is an alias to to_hash (backward compatibility)
283
+ # @return [Hash] Returns the object in the form of hash
284
+ def to_body
285
+ to_hash
286
+ end
287
+
288
+ # Returns the object in the form of hash
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_hash
291
+ hash = {}
292
+ self.class.attribute_map.each_pair do |attr, param|
293
+ value = self.send(attr)
294
+ next if value.nil?
295
+ hash[param] = _to_hash(value)
296
+ end
297
+ hash
298
+ end
299
+
300
+ # Outputs non-array value in the form of hash
301
+ # For object, use to_hash. Otherwise, just return the value
302
+ # @param [Object] value Any valid value
303
+ # @return [Hash] Returns the value in the form of hash
304
+ def _to_hash(value)
305
+ if value.is_a?(Array)
306
+ value.compact.map { |v| _to_hash(v) }
307
+ elsif value.is_a?(Hash)
308
+ {}.tap do |hash|
309
+ value.each { |k, v| hash[k] = _to_hash(v) }
310
+ end
311
+ elsif value.respond_to? :to_hash
312
+ value.to_hash
313
+ else
314
+ value
315
+ end
316
+ end
317
+
318
+ end
319
+ end
@@ -0,0 +1,247 @@
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 PaymentsConfigurationAffirm
17
+ attr_accessor :accept_affirm
18
+
19
+ attr_accessor :affirm_accounting_code
20
+
21
+ attr_accessor :affirm_deposit_to_account
22
+
23
+ attr_accessor :affirm_environment
24
+
25
+ attr_accessor :affirm_financial_product_key
26
+
27
+ attr_accessor :affirm_private_api_key
28
+
29
+ attr_accessor :affirm_public_api_key
30
+
31
+ attr_accessor :restrictions
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'accept_affirm' => :'acceptAffirm',
37
+ :'affirm_accounting_code' => :'affirmAccountingCode',
38
+ :'affirm_deposit_to_account' => :'affirmDepositToAccount',
39
+ :'affirm_environment' => :'affirmEnvironment',
40
+ :'affirm_financial_product_key' => :'affirmFinancialProductKey',
41
+ :'affirm_private_api_key' => :'affirmPrivateApiKey',
42
+ :'affirm_public_api_key' => :'affirmPublicApiKey',
43
+ :'restrictions' => :'restrictions'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'accept_affirm' => :'BOOLEAN',
51
+ :'affirm_accounting_code' => :'String',
52
+ :'affirm_deposit_to_account' => :'String',
53
+ :'affirm_environment' => :'String',
54
+ :'affirm_financial_product_key' => :'String',
55
+ :'affirm_private_api_key' => :'String',
56
+ :'affirm_public_api_key' => :'String',
57
+ :'restrictions' => :'PaymentsConfigurationRestrictions'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ if attributes.has_key?(:'acceptAffirm')
70
+ self.accept_affirm = attributes[:'acceptAffirm']
71
+ end
72
+
73
+ if attributes.has_key?(:'affirmAccountingCode')
74
+ self.affirm_accounting_code = attributes[:'affirmAccountingCode']
75
+ end
76
+
77
+ if attributes.has_key?(:'affirmDepositToAccount')
78
+ self.affirm_deposit_to_account = attributes[:'affirmDepositToAccount']
79
+ end
80
+
81
+ if attributes.has_key?(:'affirmEnvironment')
82
+ self.affirm_environment = attributes[:'affirmEnvironment']
83
+ end
84
+
85
+ if attributes.has_key?(:'affirmFinancialProductKey')
86
+ self.affirm_financial_product_key = attributes[:'affirmFinancialProductKey']
87
+ end
88
+
89
+ if attributes.has_key?(:'affirmPrivateApiKey')
90
+ self.affirm_private_api_key = attributes[:'affirmPrivateApiKey']
91
+ end
92
+
93
+ if attributes.has_key?(:'affirmPublicApiKey')
94
+ self.affirm_public_api_key = attributes[:'affirmPublicApiKey']
95
+ end
96
+
97
+ if attributes.has_key?(:'restrictions')
98
+ self.restrictions = attributes[:'restrictions']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ accept_affirm == o.accept_affirm &&
121
+ affirm_accounting_code == o.affirm_accounting_code &&
122
+ affirm_deposit_to_account == o.affirm_deposit_to_account &&
123
+ affirm_environment == o.affirm_environment &&
124
+ affirm_financial_product_key == o.affirm_financial_product_key &&
125
+ affirm_private_api_key == o.affirm_private_api_key &&
126
+ affirm_public_api_key == o.affirm_public_api_key &&
127
+ restrictions == o.restrictions
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Fixnum] Hash code
138
+ def hash
139
+ [accept_affirm, affirm_accounting_code, affirm_deposit_to_account, affirm_environment, affirm_financial_product_key, affirm_private_api_key, affirm_public_api_key, restrictions].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ self.class.swagger_types.each_pair do |key, type|
148
+ if type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :DateTime
169
+ DateTime.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :BOOLEAN
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ temp_model = UltracartClient.const_get(type).new
200
+ temp_model.build_from_hash(value)
201
+ end
202
+ end
203
+
204
+ # Returns the string representation of the object
205
+ # @return [String] String presentation of the object
206
+ def to_s
207
+ to_hash.to_s
208
+ end
209
+
210
+ # to_body is an alias to to_hash (backward compatibility)
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_body
213
+ to_hash
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ next if value.nil?
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.compact.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to? :to_hash
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+
246
+ end
247
+ end