ultracart_api 3.10.14 → 3.10.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -97
  3. data/docs/ChannelPartnerApi.md +51 -0
  4. data/docs/{DelayAutoOrdersResponse.md → ChannelPartnerEstimateTaxResponse.md} +2 -2
  5. data/lib/ultracart_api/api/channel_partner_api.rb +55 -0
  6. data/lib/ultracart_api/models/{stripe_connect_response.rb → channel_partner_estimate_tax_response.rb} +8 -8
  7. data/lib/ultracart_api/version.rb +1 -1
  8. data/lib/ultracart_api.rb +1 -39
  9. metadata +4 -80
  10. data/docs/ConfigurationApi.md +0 -756
  11. data/docs/PaymentsConfiguration.md +0 -24
  12. data/docs/PaymentsConfigurationAffirm.md +0 -15
  13. data/docs/PaymentsConfigurationAmazon.md +0 -15
  14. data/docs/PaymentsConfigurationCOD.md +0 -13
  15. data/docs/PaymentsConfigurationCash.md +0 -9
  16. data/docs/PaymentsConfigurationCheck.md +0 -19
  17. data/docs/PaymentsConfigurationCreditCard.md +0 -17
  18. data/docs/PaymentsConfigurationCreditCardType.md +0 -18
  19. data/docs/PaymentsConfigurationEcheck.md +0 -12
  20. data/docs/PaymentsConfigurationInsurance.md +0 -9
  21. data/docs/PaymentsConfigurationLoanHero.md +0 -12
  22. data/docs/PaymentsConfigurationMoneyOrder.md +0 -11
  23. data/docs/PaymentsConfigurationPayPal.md +0 -36
  24. data/docs/PaymentsConfigurationPurchaseOrder.md +0 -11
  25. data/docs/PaymentsConfigurationQuoteRequest.md +0 -10
  26. data/docs/PaymentsConfigurationResponse.md +0 -12
  27. data/docs/PaymentsConfigurationRestrictions.md +0 -21
  28. data/docs/PaymentsConfigurationRestrictionsTheme.md +0 -10
  29. data/docs/PaymentsConfigurationSezzle.md +0 -15
  30. data/docs/PaymentsConfigurationTestMethod.md +0 -18
  31. data/docs/PaymentsConfigurationWePay.md +0 -35
  32. data/docs/PaymentsConfigurationWireTransfer.md +0 -18
  33. data/docs/PaymentsThemeTransactionType.md +0 -10
  34. data/docs/PaymentsWepayEnroll.md +0 -22
  35. data/docs/RotatingTransactionGateway.md +0 -51
  36. data/docs/RotatingTransactionGatewayResponse.md +0 -12
  37. data/docs/RotatingTransactionGatewaysResponse.md +0 -12
  38. data/docs/RtgCurrency.md +0 -10
  39. data/docs/RtgDayOfMonthRestriction.md +0 -9
  40. data/docs/RtgDayOfWeekRestriction.md +0 -10
  41. data/docs/RtgSummaryGateway.md +0 -24
  42. data/docs/RtgSummaryResponse.md +0 -14
  43. data/docs/RtgThemeRestriction.md +0 -10
  44. data/docs/StripeConnectResponse.md +0 -12
  45. data/docs/TransactionGateway.md +0 -71
  46. data/docs/TransactionGatewaysRequest.md +0 -10
  47. data/docs/TransactionGatewaysResponse.md +0 -12
  48. data/lib/ultracart_api/api/configuration_api.rb +0 -843
  49. data/lib/ultracart_api/models/delay_auto_orders_response.rb +0 -221
  50. data/lib/ultracart_api/models/payments_configuration.rb +0 -329
  51. data/lib/ultracart_api/models/payments_configuration_affirm.rb +0 -288
  52. data/lib/ultracart_api/models/payments_configuration_amazon.rb +0 -288
  53. data/lib/ultracart_api/models/payments_configuration_cash.rb +0 -194
  54. data/lib/ultracart_api/models/payments_configuration_check.rb +0 -294
  55. data/lib/ultracart_api/models/payments_configuration_cod.rb +0 -234
  56. data/lib/ultracart_api/models/payments_configuration_credit_card.rb +0 -279
  57. data/lib/ultracart_api/models/payments_configuration_credit_card_type.rb +0 -318
  58. data/lib/ultracart_api/models/payments_configuration_echeck.rb +0 -226
  59. data/lib/ultracart_api/models/payments_configuration_insurance.rb +0 -194
  60. data/lib/ultracart_api/models/payments_configuration_loan_hero.rb +0 -224
  61. data/lib/ultracart_api/models/payments_configuration_money_order.rb +0 -214
  62. data/lib/ultracart_api/models/payments_configuration_pay_pal.rb +0 -534
  63. data/lib/ultracart_api/models/payments_configuration_purchase_order.rb +0 -214
  64. data/lib/ultracart_api/models/payments_configuration_quote_request.rb +0 -204
  65. data/lib/ultracart_api/models/payments_configuration_response.rb +0 -221
  66. data/lib/ultracart_api/models/payments_configuration_restrictions.rb +0 -447
  67. data/lib/ultracart_api/models/payments_configuration_restrictions_theme.rb +0 -202
  68. data/lib/ultracart_api/models/payments_configuration_sezzle.rb +0 -288
  69. data/lib/ultracart_api/models/payments_configuration_test_method.rb +0 -319
  70. data/lib/ultracart_api/models/payments_configuration_we_pay.rb +0 -454
  71. data/lib/ultracart_api/models/payments_configuration_wire_transfer.rb +0 -284
  72. data/lib/ultracart_api/models/payments_theme_transaction_type.rb +0 -239
  73. data/lib/ultracart_api/models/payments_wepay_enroll.rb +0 -310
  74. data/lib/ultracart_api/models/rotating_transaction_gateway.rb +0 -675
  75. data/lib/ultracart_api/models/rotating_transaction_gateway_response.rb +0 -221
  76. data/lib/ultracart_api/models/rotating_transaction_gateways_response.rb +0 -223
  77. data/lib/ultracart_api/models/rtg_currency.rb +0 -205
  78. data/lib/ultracart_api/models/rtg_day_of_month_restriction.rb +0 -195
  79. data/lib/ultracart_api/models/rtg_day_of_week_restriction.rb +0 -205
  80. data/lib/ultracart_api/models/rtg_summary_gateway.rb +0 -329
  81. data/lib/ultracart_api/models/rtg_summary_response.rb +0 -240
  82. data/lib/ultracart_api/models/rtg_theme_restriction.rb +0 -239
  83. data/lib/ultracart_api/models/transaction_gateway.rb +0 -823
  84. data/lib/ultracart_api/models/transaction_gateways_request.rb +0 -242
  85. data/lib/ultracart_api/models/transaction_gateways_response.rb +0 -223
@@ -1,534 +0,0 @@
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 PaymentsConfigurationPayPal
17
- # Master flag that determine if PayPal is an active payment for this account
18
- attr_accessor :accept_paypal
19
-
20
- # Optional accounting code that is set to Quickbooks when an order uses this payment method.
21
- attr_accessor :accounting_code
22
-
23
- # PayPal API password
24
- attr_accessor :api_password
25
-
26
- # PayPal API username
27
- attr_accessor :api_username
28
-
29
- # (Legacy) true if there is a PayPal certificate already on file. Used to manage the internal UI
30
- attr_accessor :certificate_on_file
31
-
32
- # The account to deposit funds
33
- attr_accessor :deposit_to_account
34
-
35
- # The main PayPal email address
36
- attr_accessor :email
37
-
38
- # PayPal configuration, live or sandbox
39
- attr_accessor :environment
40
-
41
- # The URL for the PayPal header
42
- attr_accessor :header_image_url
43
-
44
- # True if the Bill Me Later button should be hidden during checkout
45
- attr_accessor :hide_bill_me_later
46
-
47
- # True if the PayPal express checkout button should be hidden on the view cart page. This will force the customer to enter address information before being able to checkout with PayPal
48
- attr_accessor :hide_express_checkout_on_view_cart
49
-
50
- # True if PayPal should be hidden for orders with no shippable product, such as digital orders
51
- attr_accessor :hide_for_unshipped_orders
52
-
53
- # If true, PayPal orders are held in Accounts Receivable for review
54
- attr_accessor :hold_in_ar
55
-
56
- # PayPal landing page
57
- attr_accessor :landing_page
58
-
59
- # The PayPal mode
60
- attr_accessor :mode
61
-
62
- # PayPal API private key password
63
- attr_accessor :private_key_password
64
-
65
- # Optional additional fee to charge if PayPal is used. It is rare for this to be used.
66
- attr_accessor :processing_fee
67
-
68
- # The processing percentage charged by PayPal
69
- attr_accessor :processing_percentage
70
-
71
- # True if the internal UI should recommend opening a PayPal account
72
- attr_accessor :push_paypal
73
-
74
- attr_accessor :restrictions
75
-
76
- # True if UltraCart should send recurring orders to PayPal. There are restrictions to what PayPal will accept for recurring orders. Be careful.
77
- attr_accessor :send_recurring
78
-
79
- # Short marketing text
80
- attr_accessor :short_paypal_marketing_text
81
-
82
- # internal ui flag
83
- attr_accessor :show_card_logos_not_directly_supported
84
-
85
- # Internal flag used to manage UI
86
- attr_accessor :show_signature
87
-
88
- # PayPal signature
89
- attr_accessor :signature
90
-
91
- # PayPal solution type
92
- attr_accessor :solution_type
93
-
94
- # The email where PayPal summaries should be sent
95
- attr_accessor :summary_email
96
-
97
- # Description of what mode PayPal is operating
98
- attr_accessor :summary_mode
99
-
100
- # Send free items to PayPal as one cent items and subtract this penny from shipping. PayPal does not allow the sale of free items.
101
- attr_accessor :zero_dollar_penny
102
-
103
- class EnumAttributeValidator
104
- attr_reader :datatype
105
- attr_reader :allowable_values
106
-
107
- def initialize(datatype, allowable_values)
108
- @allowable_values = allowable_values.map do |value|
109
- case datatype.to_s
110
- when /Integer/i
111
- value.to_i
112
- when /Float/i
113
- value.to_f
114
- else
115
- value
116
- end
117
- end
118
- end
119
-
120
- def valid?(value)
121
- !value || allowable_values.include?(value)
122
- end
123
- end
124
-
125
- # Attribute mapping from ruby-style variable name to JSON key.
126
- def self.attribute_map
127
- {
128
- :'accept_paypal' => :'accept_paypal',
129
- :'accounting_code' => :'accounting_code',
130
- :'api_password' => :'api_password',
131
- :'api_username' => :'api_username',
132
- :'certificate_on_file' => :'certificate_on_file',
133
- :'deposit_to_account' => :'deposit_to_account',
134
- :'email' => :'email',
135
- :'environment' => :'environment',
136
- :'header_image_url' => :'header_image_url',
137
- :'hide_bill_me_later' => :'hide_bill_me_later',
138
- :'hide_express_checkout_on_view_cart' => :'hide_express_checkout_on_view_cart',
139
- :'hide_for_unshipped_orders' => :'hide_for_unshipped_orders',
140
- :'hold_in_ar' => :'hold_in_ar',
141
- :'landing_page' => :'landing_page',
142
- :'mode' => :'mode',
143
- :'private_key_password' => :'private_key_password',
144
- :'processing_fee' => :'processing_fee',
145
- :'processing_percentage' => :'processing_percentage',
146
- :'push_paypal' => :'push_paypal',
147
- :'restrictions' => :'restrictions',
148
- :'send_recurring' => :'send_recurring',
149
- :'short_paypal_marketing_text' => :'short_paypal_marketing_text',
150
- :'show_card_logos_not_directly_supported' => :'show_card_logos_not_directly_supported',
151
- :'show_signature' => :'show_signature',
152
- :'signature' => :'signature',
153
- :'solution_type' => :'solution_type',
154
- :'summary_email' => :'summary_email',
155
- :'summary_mode' => :'summary_mode',
156
- :'zero_dollar_penny' => :'zero_dollar_penny'
157
- }
158
- end
159
-
160
- # Attribute type mapping.
161
- def self.swagger_types
162
- {
163
- :'accept_paypal' => :'BOOLEAN',
164
- :'accounting_code' => :'String',
165
- :'api_password' => :'String',
166
- :'api_username' => :'String',
167
- :'certificate_on_file' => :'BOOLEAN',
168
- :'deposit_to_account' => :'String',
169
- :'email' => :'String',
170
- :'environment' => :'String',
171
- :'header_image_url' => :'String',
172
- :'hide_bill_me_later' => :'BOOLEAN',
173
- :'hide_express_checkout_on_view_cart' => :'BOOLEAN',
174
- :'hide_for_unshipped_orders' => :'BOOLEAN',
175
- :'hold_in_ar' => :'BOOLEAN',
176
- :'landing_page' => :'String',
177
- :'mode' => :'String',
178
- :'private_key_password' => :'String',
179
- :'processing_fee' => :'Float',
180
- :'processing_percentage' => :'Float',
181
- :'push_paypal' => :'BOOLEAN',
182
- :'restrictions' => :'PaymentsConfigurationRestrictions',
183
- :'send_recurring' => :'BOOLEAN',
184
- :'short_paypal_marketing_text' => :'BOOLEAN',
185
- :'show_card_logos_not_directly_supported' => :'BOOLEAN',
186
- :'show_signature' => :'BOOLEAN',
187
- :'signature' => :'String',
188
- :'solution_type' => :'String',
189
- :'summary_email' => :'String',
190
- :'summary_mode' => :'String',
191
- :'zero_dollar_penny' => :'BOOLEAN'
192
- }
193
- end
194
-
195
- # Initializes the object
196
- # @param [Hash] attributes Model attributes in the form of hash
197
- def initialize(attributes = {})
198
- return unless attributes.is_a?(Hash)
199
-
200
- # convert string to symbol for hash key
201
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
202
-
203
- if attributes.has_key?(:'accept_paypal')
204
- self.accept_paypal = attributes[:'accept_paypal']
205
- end
206
-
207
- if attributes.has_key?(:'accounting_code')
208
- self.accounting_code = attributes[:'accounting_code']
209
- end
210
-
211
- if attributes.has_key?(:'api_password')
212
- self.api_password = attributes[:'api_password']
213
- end
214
-
215
- if attributes.has_key?(:'api_username')
216
- self.api_username = attributes[:'api_username']
217
- end
218
-
219
- if attributes.has_key?(:'certificate_on_file')
220
- self.certificate_on_file = attributes[:'certificate_on_file']
221
- end
222
-
223
- if attributes.has_key?(:'deposit_to_account')
224
- self.deposit_to_account = attributes[:'deposit_to_account']
225
- end
226
-
227
- if attributes.has_key?(:'email')
228
- self.email = attributes[:'email']
229
- end
230
-
231
- if attributes.has_key?(:'environment')
232
- self.environment = attributes[:'environment']
233
- end
234
-
235
- if attributes.has_key?(:'header_image_url')
236
- self.header_image_url = attributes[:'header_image_url']
237
- end
238
-
239
- if attributes.has_key?(:'hide_bill_me_later')
240
- self.hide_bill_me_later = attributes[:'hide_bill_me_later']
241
- end
242
-
243
- if attributes.has_key?(:'hide_express_checkout_on_view_cart')
244
- self.hide_express_checkout_on_view_cart = attributes[:'hide_express_checkout_on_view_cart']
245
- end
246
-
247
- if attributes.has_key?(:'hide_for_unshipped_orders')
248
- self.hide_for_unshipped_orders = attributes[:'hide_for_unshipped_orders']
249
- end
250
-
251
- if attributes.has_key?(:'hold_in_ar')
252
- self.hold_in_ar = attributes[:'hold_in_ar']
253
- end
254
-
255
- if attributes.has_key?(:'landing_page')
256
- self.landing_page = attributes[:'landing_page']
257
- end
258
-
259
- if attributes.has_key?(:'mode')
260
- self.mode = attributes[:'mode']
261
- end
262
-
263
- if attributes.has_key?(:'private_key_password')
264
- self.private_key_password = attributes[:'private_key_password']
265
- end
266
-
267
- if attributes.has_key?(:'processing_fee')
268
- self.processing_fee = attributes[:'processing_fee']
269
- end
270
-
271
- if attributes.has_key?(:'processing_percentage')
272
- self.processing_percentage = attributes[:'processing_percentage']
273
- end
274
-
275
- if attributes.has_key?(:'push_paypal')
276
- self.push_paypal = attributes[:'push_paypal']
277
- end
278
-
279
- if attributes.has_key?(:'restrictions')
280
- self.restrictions = attributes[:'restrictions']
281
- end
282
-
283
- if attributes.has_key?(:'send_recurring')
284
- self.send_recurring = attributes[:'send_recurring']
285
- end
286
-
287
- if attributes.has_key?(:'short_paypal_marketing_text')
288
- self.short_paypal_marketing_text = attributes[:'short_paypal_marketing_text']
289
- end
290
-
291
- if attributes.has_key?(:'show_card_logos_not_directly_supported')
292
- self.show_card_logos_not_directly_supported = attributes[:'show_card_logos_not_directly_supported']
293
- end
294
-
295
- if attributes.has_key?(:'show_signature')
296
- self.show_signature = attributes[:'show_signature']
297
- end
298
-
299
- if attributes.has_key?(:'signature')
300
- self.signature = attributes[:'signature']
301
- end
302
-
303
- if attributes.has_key?(:'solution_type')
304
- self.solution_type = attributes[:'solution_type']
305
- end
306
-
307
- if attributes.has_key?(:'summary_email')
308
- self.summary_email = attributes[:'summary_email']
309
- end
310
-
311
- if attributes.has_key?(:'summary_mode')
312
- self.summary_mode = attributes[:'summary_mode']
313
- end
314
-
315
- if attributes.has_key?(:'zero_dollar_penny')
316
- self.zero_dollar_penny = attributes[:'zero_dollar_penny']
317
- end
318
- end
319
-
320
- # Show invalid properties with the reasons. Usually used together with valid?
321
- # @return Array for valid properties with the reasons
322
- def list_invalid_properties
323
- invalid_properties = Array.new
324
- invalid_properties
325
- end
326
-
327
- # Check to see if the all the properties in the model are valid
328
- # @return true if the model is valid
329
- def valid?
330
- environment_validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
331
- return false unless environment_validator.valid?(@environment)
332
- landing_page_validator = EnumAttributeValidator.new('String', ['Billing', 'Login'])
333
- return false unless landing_page_validator.valid?(@landing_page)
334
- mode_validator = EnumAttributeValidator.new('String', ['WPPECO', 'WPPECDP'])
335
- return false unless mode_validator.valid?(@mode)
336
- solution_type_validator = EnumAttributeValidator.new('String', ['Sole', 'Mark'])
337
- return false unless solution_type_validator.valid?(@solution_type)
338
- true
339
- end
340
-
341
- # Custom attribute writer method checking allowed values (enum).
342
- # @param [Object] environment Object to be assigned
343
- def environment=(environment)
344
- validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
345
- unless validator.valid?(environment)
346
- fail ArgumentError, 'invalid value for "environment", must be one of #{validator.allowable_values}.'
347
- end
348
- @environment = environment
349
- end
350
-
351
- # Custom attribute writer method checking allowed values (enum).
352
- # @param [Object] landing_page Object to be assigned
353
- def landing_page=(landing_page)
354
- validator = EnumAttributeValidator.new('String', ['Billing', 'Login'])
355
- unless validator.valid?(landing_page)
356
- fail ArgumentError, 'invalid value for "landing_page", must be one of #{validator.allowable_values}.'
357
- end
358
- @landing_page = landing_page
359
- end
360
-
361
- # Custom attribute writer method checking allowed values (enum).
362
- # @param [Object] mode Object to be assigned
363
- def mode=(mode)
364
- validator = EnumAttributeValidator.new('String', ['WPPECO', 'WPPECDP'])
365
- unless validator.valid?(mode)
366
- fail ArgumentError, 'invalid value for "mode", must be one of #{validator.allowable_values}.'
367
- end
368
- @mode = mode
369
- end
370
-
371
- # Custom attribute writer method checking allowed values (enum).
372
- # @param [Object] solution_type Object to be assigned
373
- def solution_type=(solution_type)
374
- validator = EnumAttributeValidator.new('String', ['Sole', 'Mark'])
375
- unless validator.valid?(solution_type)
376
- fail ArgumentError, 'invalid value for "solution_type", must be one of #{validator.allowable_values}.'
377
- end
378
- @solution_type = solution_type
379
- end
380
-
381
- # Checks equality by comparing each attribute.
382
- # @param [Object] Object to be compared
383
- def ==(o)
384
- return true if self.equal?(o)
385
- self.class == o.class &&
386
- accept_paypal == o.accept_paypal &&
387
- accounting_code == o.accounting_code &&
388
- api_password == o.api_password &&
389
- api_username == o.api_username &&
390
- certificate_on_file == o.certificate_on_file &&
391
- deposit_to_account == o.deposit_to_account &&
392
- email == o.email &&
393
- environment == o.environment &&
394
- header_image_url == o.header_image_url &&
395
- hide_bill_me_later == o.hide_bill_me_later &&
396
- hide_express_checkout_on_view_cart == o.hide_express_checkout_on_view_cart &&
397
- hide_for_unshipped_orders == o.hide_for_unshipped_orders &&
398
- hold_in_ar == o.hold_in_ar &&
399
- landing_page == o.landing_page &&
400
- mode == o.mode &&
401
- private_key_password == o.private_key_password &&
402
- processing_fee == o.processing_fee &&
403
- processing_percentage == o.processing_percentage &&
404
- push_paypal == o.push_paypal &&
405
- restrictions == o.restrictions &&
406
- send_recurring == o.send_recurring &&
407
- short_paypal_marketing_text == o.short_paypal_marketing_text &&
408
- show_card_logos_not_directly_supported == o.show_card_logos_not_directly_supported &&
409
- show_signature == o.show_signature &&
410
- signature == o.signature &&
411
- solution_type == o.solution_type &&
412
- summary_email == o.summary_email &&
413
- summary_mode == o.summary_mode &&
414
- zero_dollar_penny == o.zero_dollar_penny
415
- end
416
-
417
- # @see the `==` method
418
- # @param [Object] Object to be compared
419
- def eql?(o)
420
- self == o
421
- end
422
-
423
- # Calculates hash code according to all attributes.
424
- # @return [Fixnum] Hash code
425
- def hash
426
- [accept_paypal, accounting_code, api_password, api_username, certificate_on_file, deposit_to_account, email, environment, header_image_url, hide_bill_me_later, hide_express_checkout_on_view_cart, hide_for_unshipped_orders, hold_in_ar, landing_page, mode, private_key_password, processing_fee, processing_percentage, push_paypal, restrictions, send_recurring, short_paypal_marketing_text, show_card_logos_not_directly_supported, show_signature, signature, solution_type, summary_email, summary_mode, zero_dollar_penny].hash
427
- end
428
-
429
- # Builds the object from hash
430
- # @param [Hash] attributes Model attributes in the form of hash
431
- # @return [Object] Returns the model itself
432
- def build_from_hash(attributes)
433
- return nil unless attributes.is_a?(Hash)
434
- self.class.swagger_types.each_pair do |key, type|
435
- if type =~ /\AArray<(.*)>/i
436
- # check to ensure the input is an array given that the attribute
437
- # is documented as an array but the input is not
438
- if attributes[self.class.attribute_map[key]].is_a?(Array)
439
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
440
- end
441
- elsif !attributes[self.class.attribute_map[key]].nil?
442
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
443
- end # or else data not found in attributes(hash), not an issue as the data can be optional
444
- end
445
-
446
- self
447
- end
448
-
449
- # Deserializes the data based on type
450
- # @param string type Data type
451
- # @param string value Value to be deserialized
452
- # @return [Object] Deserialized data
453
- def _deserialize(type, value)
454
- case type.to_sym
455
- when :DateTime
456
- DateTime.parse(value)
457
- when :Date
458
- Date.parse(value)
459
- when :String
460
- value.to_s
461
- when :Integer
462
- value.to_i
463
- when :Float
464
- value.to_f
465
- when :BOOLEAN
466
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
467
- true
468
- else
469
- false
470
- end
471
- when :Object
472
- # generic object (usually a Hash), return directly
473
- value
474
- when /\AArray<(?<inner_type>.+)>\z/
475
- inner_type = Regexp.last_match[:inner_type]
476
- value.map { |v| _deserialize(inner_type, v) }
477
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
478
- k_type = Regexp.last_match[:k_type]
479
- v_type = Regexp.last_match[:v_type]
480
- {}.tap do |hash|
481
- value.each do |k, v|
482
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
483
- end
484
- end
485
- else # model
486
- temp_model = UltracartClient.const_get(type).new
487
- temp_model.build_from_hash(value)
488
- end
489
- end
490
-
491
- # Returns the string representation of the object
492
- # @return [String] String presentation of the object
493
- def to_s
494
- to_hash.to_s
495
- end
496
-
497
- # to_body is an alias to to_hash (backward compatibility)
498
- # @return [Hash] Returns the object in the form of hash
499
- def to_body
500
- to_hash
501
- end
502
-
503
- # Returns the object in the form of hash
504
- # @return [Hash] Returns the object in the form of hash
505
- def to_hash
506
- hash = {}
507
- self.class.attribute_map.each_pair do |attr, param|
508
- value = self.send(attr)
509
- next if value.nil?
510
- hash[param] = _to_hash(value)
511
- end
512
- hash
513
- end
514
-
515
- # Outputs non-array value in the form of hash
516
- # For object, use to_hash. Otherwise, just return the value
517
- # @param [Object] value Any valid value
518
- # @return [Hash] Returns the value in the form of hash
519
- def _to_hash(value)
520
- if value.is_a?(Array)
521
- value.compact.map { |v| _to_hash(v) }
522
- elsif value.is_a?(Hash)
523
- {}.tap do |hash|
524
- value.each { |k, v| hash[k] = _to_hash(v) }
525
- end
526
- elsif value.respond_to? :to_hash
527
- value.to_hash
528
- else
529
- value
530
- end
531
- end
532
-
533
- end
534
- end