ultracart_api 3.4.8 → 3.4.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -4
- data/docs/EmailWebhookEditorValuesResponse.md +14 -0
- data/docs/PaymentsConfiguration.md +4 -4
- data/docs/PaymentsConfigurationAffirm.md +7 -7
- data/docs/PaymentsConfigurationAmazon.md +7 -7
- data/docs/PaymentsConfigurationCOD.md +5 -5
- data/docs/PaymentsConfigurationCash.md +1 -1
- data/docs/PaymentsConfigurationCheck.md +12 -13
- data/docs/PaymentsConfigurationCreditCard.md +11 -8
- data/docs/PaymentsConfigurationCreditCardType.md +17 -0
- data/docs/PaymentsConfigurationEcheck.md +3 -3
- data/docs/PaymentsConfigurationLoanHero.md +4 -4
- data/docs/PaymentsConfigurationMoneyOrder.md +3 -1
- data/docs/PaymentsConfigurationPayPal.md +28 -28
- data/docs/PaymentsConfigurationPurchaseOrder.md +3 -3
- data/docs/PaymentsConfigurationQuoteRequest.md +2 -2
- data/docs/PaymentsConfigurationRestrictions.md +14 -12
- data/docs/PaymentsConfigurationRestrictionsTheme.md +10 -0
- data/docs/PaymentsConfigurationSezzle.md +8 -7
- data/docs/PaymentsConfigurationTestMethod.md +18 -0
- data/docs/PaymentsConfigurationWePay.md +26 -26
- data/docs/PaymentsConfigurationWireTransfer.md +10 -10
- data/docs/StorefrontApi.md +52 -0
- data/lib/ultracart_api.rb +4 -0
- data/lib/ultracart_api/api/storefront_api.rb +59 -0
- data/lib/ultracart_api/models/email_webhook_editor_values_response.rb +243 -0
- data/lib/ultracart_api/models/payments_configuration.rb +41 -40
- data/lib/ultracart_api/models/payments_configuration_affirm.rb +81 -40
- data/lib/ultracart_api/models/payments_configuration_amazon.rb +51 -44
- data/lib/ultracart_api/models/payments_configuration_cash.rb +4 -3
- data/lib/ultracart_api/models/payments_configuration_check.rb +73 -68
- data/lib/ultracart_api/models/payments_configuration_cod.rb +39 -34
- data/lib/ultracart_api/models/payments_configuration_credit_card.rb +78 -34
- data/lib/ultracart_api/models/payments_configuration_credit_card_type.rb +309 -0
- data/lib/ultracart_api/models/payments_configuration_echeck.rb +22 -19
- data/lib/ultracart_api/models/payments_configuration_loan_hero.rb +23 -19
- data/lib/ultracart_api/models/payments_configuration_money_order.rb +25 -4
- data/lib/ultracart_api/models/payments_configuration_pay_pal.rb +270 -172
- data/lib/ultracart_api/models/payments_configuration_purchase_order.rb +19 -16
- data/lib/ultracart_api/models/payments_configuration_quote_request.rb +12 -10
- data/lib/ultracart_api/models/payments_configuration_restrictions.rb +75 -41
- data/lib/ultracart_api/models/payments_configuration_restrictions_theme.rb +202 -0
- data/lib/ultracart_api/models/payments_configuration_sezzle.rb +99 -46
- data/lib/ultracart_api/models/payments_configuration_test_method.rb +319 -0
- data/lib/ultracart_api/models/payments_configuration_we_pay.rb +186 -160
- data/lib/ultracart_api/models/payments_configuration_wire_transfer.rb +71 -61
- data/lib/ultracart_api/version.rb +1 -1
- metadata +10 -2
@@ -14,33 +14,66 @@ require 'date'
|
|
14
14
|
|
15
15
|
module UltracartClient
|
16
16
|
class PaymentsConfigurationSezzle
|
17
|
+
# Master flag for this merchant accepting Sezzle payments
|
17
18
|
attr_accessor :accept_sezzle
|
18
19
|
|
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
|
20
28
|
|
21
|
-
|
29
|
+
# Sezzle environment
|
30
|
+
attr_accessor :environment
|
22
31
|
|
23
|
-
|
32
|
+
# List of environments possible
|
33
|
+
attr_accessor :environments
|
24
34
|
|
25
|
-
|
35
|
+
# Private API key
|
36
|
+
attr_accessor :private_api_key
|
26
37
|
|
27
|
-
|
38
|
+
# Public API key
|
39
|
+
attr_accessor :public_api_key
|
40
|
+
|
41
|
+
attr_accessor :restrictions
|
28
42
|
|
29
|
-
|
43
|
+
class EnumAttributeValidator
|
44
|
+
attr_reader :datatype
|
45
|
+
attr_reader :allowable_values
|
46
|
+
|
47
|
+
def initialize(datatype, allowable_values)
|
48
|
+
@allowable_values = allowable_values.map do |value|
|
49
|
+
case datatype.to_s
|
50
|
+
when /Integer/i
|
51
|
+
value.to_i
|
52
|
+
when /Float/i
|
53
|
+
value.to_f
|
54
|
+
else
|
55
|
+
value
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
30
59
|
|
31
|
-
|
60
|
+
def valid?(value)
|
61
|
+
!value || allowable_values.include?(value)
|
62
|
+
end
|
63
|
+
end
|
32
64
|
|
33
65
|
# Attribute mapping from ruby-style variable name to JSON key.
|
34
66
|
def self.attribute_map
|
35
67
|
{
|
36
|
-
:'accept_sezzle' => :'
|
37
|
-
:'
|
38
|
-
:'
|
39
|
-
:'
|
40
|
-
:'
|
41
|
-
:'
|
42
|
-
:'
|
43
|
-
:'
|
68
|
+
:'accept_sezzle' => :'accept_sezzle',
|
69
|
+
:'accounting_code' => :'accounting_code',
|
70
|
+
:'business_id' => :'business_id',
|
71
|
+
:'deposit_to_account' => :'deposit_to_account',
|
72
|
+
:'environment' => :'environment',
|
73
|
+
:'environments' => :'environments',
|
74
|
+
:'private_api_key' => :'private_api_key',
|
75
|
+
:'public_api_key' => :'public_api_key',
|
76
|
+
:'restrictions' => :'restrictions'
|
44
77
|
}
|
45
78
|
end
|
46
79
|
|
@@ -48,13 +81,14 @@ module UltracartClient
|
|
48
81
|
def self.swagger_types
|
49
82
|
{
|
50
83
|
:'accept_sezzle' => :'BOOLEAN',
|
51
|
-
:'
|
52
|
-
:'
|
53
|
-
:'
|
54
|
-
:'
|
55
|
-
:'
|
56
|
-
:'
|
57
|
-
:'
|
84
|
+
:'accounting_code' => :'String',
|
85
|
+
:'business_id' => :'String',
|
86
|
+
:'deposit_to_account' => :'String',
|
87
|
+
:'environment' => :'String',
|
88
|
+
:'environments' => :'Array<String>',
|
89
|
+
:'private_api_key' => :'String',
|
90
|
+
:'public_api_key' => :'String',
|
91
|
+
:'restrictions' => :'PaymentsConfigurationRestrictions'
|
58
92
|
}
|
59
93
|
end
|
60
94
|
|
@@ -66,36 +100,42 @@ module UltracartClient
|
|
66
100
|
# convert string to symbol for hash key
|
67
101
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
68
102
|
|
69
|
-
if attributes.has_key?(:'
|
70
|
-
self.accept_sezzle = attributes[:'
|
103
|
+
if attributes.has_key?(:'accept_sezzle')
|
104
|
+
self.accept_sezzle = attributes[:'accept_sezzle']
|
71
105
|
end
|
72
106
|
|
73
|
-
if attributes.has_key?(:'
|
74
|
-
self.
|
107
|
+
if attributes.has_key?(:'accounting_code')
|
108
|
+
self.accounting_code = attributes[:'accounting_code']
|
75
109
|
end
|
76
110
|
|
77
|
-
if attributes.has_key?(:'
|
78
|
-
self.
|
111
|
+
if attributes.has_key?(:'business_id')
|
112
|
+
self.business_id = attributes[:'business_id']
|
79
113
|
end
|
80
114
|
|
81
|
-
if attributes.has_key?(:'
|
82
|
-
self.
|
115
|
+
if attributes.has_key?(:'deposit_to_account')
|
116
|
+
self.deposit_to_account = attributes[:'deposit_to_account']
|
83
117
|
end
|
84
118
|
|
85
|
-
if attributes.has_key?(:'
|
86
|
-
self.
|
119
|
+
if attributes.has_key?(:'environment')
|
120
|
+
self.environment = attributes[:'environment']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.has_key?(:'environments')
|
124
|
+
if (value = attributes[:'environments']).is_a?(Array)
|
125
|
+
self.environments = value
|
126
|
+
end
|
87
127
|
end
|
88
128
|
|
89
|
-
if attributes.has_key?(:'
|
90
|
-
self.
|
129
|
+
if attributes.has_key?(:'private_api_key')
|
130
|
+
self.private_api_key = attributes[:'private_api_key']
|
91
131
|
end
|
92
132
|
|
93
|
-
if attributes.has_key?(:'
|
94
|
-
self.
|
133
|
+
if attributes.has_key?(:'public_api_key')
|
134
|
+
self.public_api_key = attributes[:'public_api_key']
|
95
135
|
end
|
96
136
|
|
97
|
-
if attributes.has_key?(:'
|
98
|
-
self.
|
137
|
+
if attributes.has_key?(:'restrictions')
|
138
|
+
self.restrictions = attributes[:'restrictions']
|
99
139
|
end
|
100
140
|
end
|
101
141
|
|
@@ -109,22 +149,35 @@ module UltracartClient
|
|
109
149
|
# Check to see if the all the properties in the model are valid
|
110
150
|
# @return true if the model is valid
|
111
151
|
def valid?
|
152
|
+
environment_validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
|
153
|
+
return false unless environment_validator.valid?(@environment)
|
112
154
|
true
|
113
155
|
end
|
114
156
|
|
157
|
+
# Custom attribute writer method checking allowed values (enum).
|
158
|
+
# @param [Object] environment Object to be assigned
|
159
|
+
def environment=(environment)
|
160
|
+
validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
|
161
|
+
unless validator.valid?(environment)
|
162
|
+
fail ArgumentError, 'invalid value for "environment", must be one of #{validator.allowable_values}.'
|
163
|
+
end
|
164
|
+
@environment = environment
|
165
|
+
end
|
166
|
+
|
115
167
|
# Checks equality by comparing each attribute.
|
116
168
|
# @param [Object] Object to be compared
|
117
169
|
def ==(o)
|
118
170
|
return true if self.equal?(o)
|
119
171
|
self.class == o.class &&
|
120
172
|
accept_sezzle == o.accept_sezzle &&
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
173
|
+
accounting_code == o.accounting_code &&
|
174
|
+
business_id == o.business_id &&
|
175
|
+
deposit_to_account == o.deposit_to_account &&
|
176
|
+
environment == o.environment &&
|
177
|
+
environments == o.environments &&
|
178
|
+
private_api_key == o.private_api_key &&
|
179
|
+
public_api_key == o.public_api_key &&
|
180
|
+
restrictions == o.restrictions
|
128
181
|
end
|
129
182
|
|
130
183
|
# @see the `==` method
|
@@ -136,7 +189,7 @@ module UltracartClient
|
|
136
189
|
# Calculates hash code according to all attributes.
|
137
190
|
# @return [Fixnum] Hash code
|
138
191
|
def hash
|
139
|
-
[accept_sezzle,
|
192
|
+
[accept_sezzle, accounting_code, business_id, deposit_to_account, environment, environments, private_api_key, public_api_key, restrictions].hash
|
140
193
|
end
|
141
194
|
|
142
195
|
# Builds the object from hash
|
@@ -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 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
|