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,288 +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 PaymentsConfigurationSezzle
17
- # Master flag for this merchant accepting Sezzle payments
18
- attr_accessor :accept_sezzle
19
-
20
- # Optional Quickbooks code for this payment method
21
- attr_accessor :accounting_code
22
-
23
- # Business ID
24
- attr_accessor :business_id
25
-
26
- # Optional Quickbooks Deposit to Account value
27
- attr_accessor :deposit_to_account
28
-
29
- # Sezzle environment
30
- attr_accessor :environment
31
-
32
- # Private API key
33
- attr_accessor :private_api_key
34
-
35
- # Public API key
36
- attr_accessor :public_api_key
37
-
38
- attr_accessor :restrictions
39
-
40
- class EnumAttributeValidator
41
- attr_reader :datatype
42
- attr_reader :allowable_values
43
-
44
- def initialize(datatype, allowable_values)
45
- @allowable_values = allowable_values.map do |value|
46
- case datatype.to_s
47
- when /Integer/i
48
- value.to_i
49
- when /Float/i
50
- value.to_f
51
- else
52
- value
53
- end
54
- end
55
- end
56
-
57
- def valid?(value)
58
- !value || allowable_values.include?(value)
59
- end
60
- end
61
-
62
- # Attribute mapping from ruby-style variable name to JSON key.
63
- def self.attribute_map
64
- {
65
- :'accept_sezzle' => :'accept_sezzle',
66
- :'accounting_code' => :'accounting_code',
67
- :'business_id' => :'business_id',
68
- :'deposit_to_account' => :'deposit_to_account',
69
- :'environment' => :'environment',
70
- :'private_api_key' => :'private_api_key',
71
- :'public_api_key' => :'public_api_key',
72
- :'restrictions' => :'restrictions'
73
- }
74
- end
75
-
76
- # Attribute type mapping.
77
- def self.swagger_types
78
- {
79
- :'accept_sezzle' => :'BOOLEAN',
80
- :'accounting_code' => :'String',
81
- :'business_id' => :'String',
82
- :'deposit_to_account' => :'String',
83
- :'environment' => :'String',
84
- :'private_api_key' => :'String',
85
- :'public_api_key' => :'String',
86
- :'restrictions' => :'PaymentsConfigurationRestrictions'
87
- }
88
- end
89
-
90
- # Initializes the object
91
- # @param [Hash] attributes Model attributes in the form of hash
92
- def initialize(attributes = {})
93
- return unless attributes.is_a?(Hash)
94
-
95
- # convert string to symbol for hash key
96
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
97
-
98
- if attributes.has_key?(:'accept_sezzle')
99
- self.accept_sezzle = attributes[:'accept_sezzle']
100
- end
101
-
102
- if attributes.has_key?(:'accounting_code')
103
- self.accounting_code = attributes[:'accounting_code']
104
- end
105
-
106
- if attributes.has_key?(:'business_id')
107
- self.business_id = attributes[:'business_id']
108
- end
109
-
110
- if attributes.has_key?(:'deposit_to_account')
111
- self.deposit_to_account = attributes[:'deposit_to_account']
112
- end
113
-
114
- if attributes.has_key?(:'environment')
115
- self.environment = attributes[:'environment']
116
- end
117
-
118
- if attributes.has_key?(:'private_api_key')
119
- self.private_api_key = attributes[:'private_api_key']
120
- end
121
-
122
- if attributes.has_key?(:'public_api_key')
123
- self.public_api_key = attributes[:'public_api_key']
124
- end
125
-
126
- if attributes.has_key?(:'restrictions')
127
- self.restrictions = attributes[:'restrictions']
128
- end
129
- end
130
-
131
- # Show invalid properties with the reasons. Usually used together with valid?
132
- # @return Array for valid properties with the reasons
133
- def list_invalid_properties
134
- invalid_properties = Array.new
135
- invalid_properties
136
- end
137
-
138
- # Check to see if the all the properties in the model are valid
139
- # @return true if the model is valid
140
- def valid?
141
- environment_validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
142
- return false unless environment_validator.valid?(@environment)
143
- true
144
- end
145
-
146
- # Custom attribute writer method checking allowed values (enum).
147
- # @param [Object] environment Object to be assigned
148
- def environment=(environment)
149
- validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
150
- unless validator.valid?(environment)
151
- fail ArgumentError, 'invalid value for "environment", must be one of #{validator.allowable_values}.'
152
- end
153
- @environment = environment
154
- end
155
-
156
- # Checks equality by comparing each attribute.
157
- # @param [Object] Object to be compared
158
- def ==(o)
159
- return true if self.equal?(o)
160
- self.class == o.class &&
161
- accept_sezzle == o.accept_sezzle &&
162
- accounting_code == o.accounting_code &&
163
- business_id == o.business_id &&
164
- deposit_to_account == o.deposit_to_account &&
165
- environment == o.environment &&
166
- private_api_key == o.private_api_key &&
167
- public_api_key == o.public_api_key &&
168
- restrictions == o.restrictions
169
- end
170
-
171
- # @see the `==` method
172
- # @param [Object] Object to be compared
173
- def eql?(o)
174
- self == o
175
- end
176
-
177
- # Calculates hash code according to all attributes.
178
- # @return [Fixnum] Hash code
179
- def hash
180
- [accept_sezzle, accounting_code, business_id, deposit_to_account, environment, private_api_key, public_api_key, restrictions].hash
181
- end
182
-
183
- # Builds the object from hash
184
- # @param [Hash] attributes Model attributes in the form of hash
185
- # @return [Object] Returns the model itself
186
- def build_from_hash(attributes)
187
- return nil unless attributes.is_a?(Hash)
188
- self.class.swagger_types.each_pair do |key, type|
189
- if type =~ /\AArray<(.*)>/i
190
- # check to ensure the input is an array given that the attribute
191
- # is documented as an array but the input is not
192
- if attributes[self.class.attribute_map[key]].is_a?(Array)
193
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
194
- end
195
- elsif !attributes[self.class.attribute_map[key]].nil?
196
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
197
- end # or else data not found in attributes(hash), not an issue as the data can be optional
198
- end
199
-
200
- self
201
- end
202
-
203
- # Deserializes the data based on type
204
- # @param string type Data type
205
- # @param string value Value to be deserialized
206
- # @return [Object] Deserialized data
207
- def _deserialize(type, value)
208
- case type.to_sym
209
- when :DateTime
210
- DateTime.parse(value)
211
- when :Date
212
- Date.parse(value)
213
- when :String
214
- value.to_s
215
- when :Integer
216
- value.to_i
217
- when :Float
218
- value.to_f
219
- when :BOOLEAN
220
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
221
- true
222
- else
223
- false
224
- end
225
- when :Object
226
- # generic object (usually a Hash), return directly
227
- value
228
- when /\AArray<(?<inner_type>.+)>\z/
229
- inner_type = Regexp.last_match[:inner_type]
230
- value.map { |v| _deserialize(inner_type, v) }
231
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
232
- k_type = Regexp.last_match[:k_type]
233
- v_type = Regexp.last_match[:v_type]
234
- {}.tap do |hash|
235
- value.each do |k, v|
236
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
237
- end
238
- end
239
- else # model
240
- temp_model = UltracartClient.const_get(type).new
241
- temp_model.build_from_hash(value)
242
- end
243
- end
244
-
245
- # Returns the string representation of the object
246
- # @return [String] String presentation of the object
247
- def to_s
248
- to_hash.to_s
249
- end
250
-
251
- # to_body is an alias to to_hash (backward compatibility)
252
- # @return [Hash] Returns the object in the form of hash
253
- def to_body
254
- to_hash
255
- end
256
-
257
- # Returns the object in the form of hash
258
- # @return [Hash] Returns the object in the form of hash
259
- def to_hash
260
- hash = {}
261
- self.class.attribute_map.each_pair do |attr, param|
262
- value = self.send(attr)
263
- next if value.nil?
264
- hash[param] = _to_hash(value)
265
- end
266
- hash
267
- end
268
-
269
- # Outputs non-array value in the form of hash
270
- # For object, use to_hash. Otherwise, just return the value
271
- # @param [Object] value Any valid value
272
- # @return [Hash] Returns the value in the form of hash
273
- def _to_hash(value)
274
- if value.is_a?(Array)
275
- value.compact.map { |v| _to_hash(v) }
276
- elsif value.is_a?(Hash)
277
- {}.tap do |hash|
278
- value.each { |k, v| hash[k] = _to_hash(v) }
279
- end
280
- elsif value.respond_to? :to_hash
281
- value.to_hash
282
- else
283
- value
284
- end
285
- end
286
-
287
- end
288
- end
@@ -1,319 +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 PaymentsConfigurationTestMethod
17
- # Bank account number
18
- attr_accessor :bank_account_number
19
-
20
- # Bank routing number
21
- attr_accessor :bank_routing_number
22
-
23
- # Credit card number
24
- attr_accessor :credit_card_number
25
-
26
- # The existing credit card number
27
- attr_accessor :credit_card_number_existing
28
-
29
- # Description
30
- attr_accessor :description
31
-
32
- # Payment action
33
- attr_accessor :payment_action
34
-
35
- # Payment method
36
- attr_accessor :payment_method
37
-
38
- # Payment method test oid
39
- attr_accessor :payment_method_test_oid
40
-
41
- # Skip affiliate transaction
42
- attr_accessor :skip_affiliate_transaction
43
-
44
- # If true, skips recording any conversion pixels to avoid sending test orders to your analysis sites
45
- attr_accessor :skip_conversion_pixels
46
-
47
- # Skip fraud filter
48
- attr_accessor :skip_fraud_filter
49
-
50
- class EnumAttributeValidator
51
- attr_reader :datatype
52
- attr_reader :allowable_values
53
-
54
- def initialize(datatype, allowable_values)
55
- @allowable_values = allowable_values.map do |value|
56
- case datatype.to_s
57
- when /Integer/i
58
- value.to_i
59
- when /Float/i
60
- value.to_f
61
- else
62
- value
63
- end
64
- end
65
- end
66
-
67
- def valid?(value)
68
- !value || allowable_values.include?(value)
69
- end
70
- end
71
-
72
- # Attribute mapping from ruby-style variable name to JSON key.
73
- def self.attribute_map
74
- {
75
- :'bank_account_number' => :'bank_account_number',
76
- :'bank_routing_number' => :'bank_routing_number',
77
- :'credit_card_number' => :'credit_card_number',
78
- :'credit_card_number_existing' => :'credit_card_number_existing',
79
- :'description' => :'description',
80
- :'payment_action' => :'payment_action',
81
- :'payment_method' => :'payment_method',
82
- :'payment_method_test_oid' => :'payment_method_test_oid',
83
- :'skip_affiliate_transaction' => :'skip_affiliate_transaction',
84
- :'skip_conversion_pixels' => :'skip_conversion_pixels',
85
- :'skip_fraud_filter' => :'skip_fraud_filter'
86
- }
87
- end
88
-
89
- # Attribute type mapping.
90
- def self.swagger_types
91
- {
92
- :'bank_account_number' => :'String',
93
- :'bank_routing_number' => :'String',
94
- :'credit_card_number' => :'String',
95
- :'credit_card_number_existing' => :'String',
96
- :'description' => :'String',
97
- :'payment_action' => :'String',
98
- :'payment_method' => :'String',
99
- :'payment_method_test_oid' => :'Integer',
100
- :'skip_affiliate_transaction' => :'BOOLEAN',
101
- :'skip_conversion_pixels' => :'BOOLEAN',
102
- :'skip_fraud_filter' => :'BOOLEAN'
103
- }
104
- end
105
-
106
- # Initializes the object
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- def initialize(attributes = {})
109
- return unless attributes.is_a?(Hash)
110
-
111
- # convert string to symbol for hash key
112
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
113
-
114
- if attributes.has_key?(:'bank_account_number')
115
- self.bank_account_number = attributes[:'bank_account_number']
116
- end
117
-
118
- if attributes.has_key?(:'bank_routing_number')
119
- self.bank_routing_number = attributes[:'bank_routing_number']
120
- end
121
-
122
- if attributes.has_key?(:'credit_card_number')
123
- self.credit_card_number = attributes[:'credit_card_number']
124
- end
125
-
126
- if attributes.has_key?(:'credit_card_number_existing')
127
- self.credit_card_number_existing = attributes[:'credit_card_number_existing']
128
- end
129
-
130
- if attributes.has_key?(:'description')
131
- self.description = attributes[:'description']
132
- end
133
-
134
- if attributes.has_key?(:'payment_action')
135
- self.payment_action = attributes[:'payment_action']
136
- end
137
-
138
- if attributes.has_key?(:'payment_method')
139
- self.payment_method = attributes[:'payment_method']
140
- end
141
-
142
- if attributes.has_key?(:'payment_method_test_oid')
143
- self.payment_method_test_oid = attributes[:'payment_method_test_oid']
144
- end
145
-
146
- if attributes.has_key?(:'skip_affiliate_transaction')
147
- self.skip_affiliate_transaction = attributes[:'skip_affiliate_transaction']
148
- end
149
-
150
- if attributes.has_key?(:'skip_conversion_pixels')
151
- self.skip_conversion_pixels = attributes[:'skip_conversion_pixels']
152
- end
153
-
154
- if attributes.has_key?(:'skip_fraud_filter')
155
- self.skip_fraud_filter = attributes[:'skip_fraud_filter']
156
- end
157
- end
158
-
159
- # Show invalid properties with the reasons. Usually used together with valid?
160
- # @return Array for valid properties with the reasons
161
- def list_invalid_properties
162
- invalid_properties = Array.new
163
- invalid_properties
164
- end
165
-
166
- # Check to see if the all the properties in the model are valid
167
- # @return true if the model is valid
168
- def valid?
169
- payment_action_validator = EnumAttributeValidator.new('String', ['skip payment', 'skip pmt rej', 'skip pmt co', 'hold in ar'])
170
- return false unless payment_action_validator.valid?(@payment_action)
171
- true
172
- end
173
-
174
- # Custom attribute writer method checking allowed values (enum).
175
- # @param [Object] payment_action Object to be assigned
176
- def payment_action=(payment_action)
177
- validator = EnumAttributeValidator.new('String', ['skip payment', 'skip pmt rej', 'skip pmt co', 'hold in ar'])
178
- unless validator.valid?(payment_action)
179
- fail ArgumentError, 'invalid value for "payment_action", must be one of #{validator.allowable_values}.'
180
- end
181
- @payment_action = payment_action
182
- end
183
-
184
- # Checks equality by comparing each attribute.
185
- # @param [Object] Object to be compared
186
- def ==(o)
187
- return true if self.equal?(o)
188
- self.class == o.class &&
189
- bank_account_number == o.bank_account_number &&
190
- bank_routing_number == o.bank_routing_number &&
191
- credit_card_number == o.credit_card_number &&
192
- credit_card_number_existing == o.credit_card_number_existing &&
193
- description == o.description &&
194
- payment_action == o.payment_action &&
195
- payment_method == o.payment_method &&
196
- payment_method_test_oid == o.payment_method_test_oid &&
197
- skip_affiliate_transaction == o.skip_affiliate_transaction &&
198
- skip_conversion_pixels == o.skip_conversion_pixels &&
199
- skip_fraud_filter == o.skip_fraud_filter
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
- [bank_account_number, bank_routing_number, credit_card_number, credit_card_number_existing, description, payment_action, payment_method, payment_method_test_oid, skip_affiliate_transaction, skip_conversion_pixels, skip_fraud_filter].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