ultracart_api 3.2.15 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +61 -4
- data/docs/ConfigurationApi.md +756 -0
- data/docs/DelayAutoOrdersResponse.md +12 -0
- data/docs/PaymentsConfiguration.md +23 -0
- data/docs/PaymentsConfigurationAffirm.md +15 -0
- data/docs/PaymentsConfigurationAmazon.md +15 -0
- data/docs/PaymentsConfigurationCOD.md +13 -0
- data/docs/PaymentsConfigurationCash.md +9 -0
- data/docs/PaymentsConfigurationCheck.md +25 -0
- data/docs/PaymentsConfigurationCreditCard.md +16 -0
- data/docs/PaymentsConfigurationLoanHero.md +12 -0
- data/docs/PaymentsConfigurationPayPal.md +36 -0
- data/docs/PaymentsConfigurationPurchaseOrder.md +11 -0
- data/docs/PaymentsConfigurationQuoteRequest.md +10 -0
- data/docs/PaymentsConfigurationResponse.md +12 -0
- data/docs/PaymentsConfigurationRestrictions.md +19 -0
- data/docs/PaymentsConfigurationSezzle.md +15 -0
- data/docs/PaymentsConfigurationWePay.md +35 -0
- data/docs/PaymentsConfigurationWireTransfer.md +18 -0
- data/docs/PaymentsThemeTransactionType.md +10 -0
- data/docs/PaymentsWepayEnroll.md +22 -0
- data/docs/RotatingTransactionGateway.md +50 -0
- data/docs/RtgCurrency.md +10 -0
- data/docs/RtgDayOfMonthRestriction.md +9 -0
- data/docs/RtgDayOfWeekRestriction.md +10 -0
- data/docs/RtgThemeRestriction.md +10 -0
- data/docs/ScreenRecordingPageViewEvent.md +1 -0
- data/docs/SingleSignOnAuthorizeRequest.md +9 -0
- data/docs/SingleSignOnAuthorizeResponse.md +9 -0
- data/docs/SingleSignOnTokenRequest.md +9 -0
- data/docs/SingleSignOnTokenResponse.md +10 -0
- data/docs/SsoApi.md +201 -0
- data/docs/StripeConnectResponse.md +12 -0
- data/docs/TransactionGateway.md +71 -0
- data/docs/TransactionGatewaysRequest.md +10 -0
- data/docs/TransactionGatewaysResponse.md +12 -0
- data/lib/ultracart_api.rb +34 -0
- data/lib/ultracart_api/api/configuration_api.rb +843 -0
- data/lib/ultracart_api/api/sso_api.rb +243 -0
- data/lib/ultracart_api/models/delay_auto_orders_response.rb +221 -0
- data/lib/ultracart_api/models/payments_configuration.rb +319 -0
- data/lib/ultracart_api/models/payments_configuration_affirm.rb +247 -0
- data/lib/ultracart_api/models/payments_configuration_amazon.rb +247 -0
- data/lib/ultracart_api/models/payments_configuration_cash.rb +193 -0
- data/lib/ultracart_api/models/payments_configuration_check.rb +337 -0
- data/lib/ultracart_api/models/payments_configuration_cod.rb +229 -0
- data/lib/ultracart_api/models/payments_configuration_credit_card.rb +256 -0
- data/lib/ultracart_api/models/payments_configuration_loan_hero.rb +220 -0
- data/lib/ultracart_api/models/payments_configuration_pay_pal.rb +436 -0
- data/lib/ultracart_api/models/payments_configuration_purchase_order.rb +211 -0
- data/lib/ultracart_api/models/payments_configuration_quote_request.rb +202 -0
- data/lib/ultracart_api/models/payments_configuration_response.rb +221 -0
- data/lib/ultracart_api/models/payments_configuration_restrictions.rb +283 -0
- data/lib/ultracart_api/models/payments_configuration_sezzle.rb +247 -0
- data/lib/ultracart_api/models/payments_configuration_we_pay.rb +427 -0
- data/lib/ultracart_api/models/payments_configuration_wire_transfer.rb +274 -0
- data/lib/ultracart_api/models/payments_theme_transaction_type.rb +239 -0
- data/lib/ultracart_api/models/payments_wepay_enroll.rb +310 -0
- data/lib/ultracart_api/models/rotating_transaction_gateway.rb +665 -0
- data/lib/ultracart_api/models/rtg_currency.rb +205 -0
- data/lib/ultracart_api/models/rtg_day_of_month_restriction.rb +195 -0
- data/lib/ultracart_api/models/rtg_day_of_week_restriction.rb +205 -0
- data/lib/ultracart_api/models/rtg_theme_restriction.rb +239 -0
- data/lib/ultracart_api/models/screen_recording_page_view_event.rb +10 -1
- data/lib/ultracart_api/models/single_sign_on_authorize_request.rb +195 -0
- data/lib/ultracart_api/models/single_sign_on_authorize_response.rb +195 -0
- data/lib/ultracart_api/models/single_sign_on_token_request.rb +195 -0
- data/lib/ultracart_api/models/single_sign_on_token_response.rb +205 -0
- data/lib/ultracart_api/models/stripe_connect_response.rb +221 -0
- data/lib/ultracart_api/models/transaction_gateway.rb +823 -0
- data/lib/ultracart_api/models/transaction_gateways_request.rb +242 -0
- data/lib/ultracart_api/models/transaction_gateways_response.rb +223 -0
- data/lib/ultracart_api/version.rb +1 -1
- metadata +70 -2
@@ -0,0 +1,229 @@
|
|
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 PaymentsConfigurationCOD
|
17
|
+
attr_accessor :accept_cod
|
18
|
+
|
19
|
+
attr_accessor :cod_approved_customers_only
|
20
|
+
|
21
|
+
attr_accessor :cod_surcharge_accounting_code
|
22
|
+
|
23
|
+
attr_accessor :cod_surcharge_fee
|
24
|
+
|
25
|
+
attr_accessor :cod_surcharge_perc
|
26
|
+
|
27
|
+
attr_accessor :restrictions
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'accept_cod' => :'acceptCod',
|
33
|
+
:'cod_approved_customers_only' => :'codApprovedCustomersOnly',
|
34
|
+
:'cod_surcharge_accounting_code' => :'codSurchargeAccountingCode',
|
35
|
+
:'cod_surcharge_fee' => :'codSurchargeFee',
|
36
|
+
:'cod_surcharge_perc' => :'codSurchargePerc',
|
37
|
+
:'restrictions' => :'restrictions'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.swagger_types
|
43
|
+
{
|
44
|
+
:'accept_cod' => :'BOOLEAN',
|
45
|
+
:'cod_approved_customers_only' => :'BOOLEAN',
|
46
|
+
:'cod_surcharge_accounting_code' => :'String',
|
47
|
+
:'cod_surcharge_fee' => :'String',
|
48
|
+
:'cod_surcharge_perc' => :'String',
|
49
|
+
:'restrictions' => :'PaymentsConfigurationRestrictions'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
return unless attributes.is_a?(Hash)
|
57
|
+
|
58
|
+
# convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
60
|
+
|
61
|
+
if attributes.has_key?(:'acceptCod')
|
62
|
+
self.accept_cod = attributes[:'acceptCod']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'codApprovedCustomersOnly')
|
66
|
+
self.cod_approved_customers_only = attributes[:'codApprovedCustomersOnly']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.has_key?(:'codSurchargeAccountingCode')
|
70
|
+
self.cod_surcharge_accounting_code = attributes[:'codSurchargeAccountingCode']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.has_key?(:'codSurchargeFee')
|
74
|
+
self.cod_surcharge_fee = attributes[:'codSurchargeFee']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.has_key?(:'codSurchargePerc')
|
78
|
+
self.cod_surcharge_perc = attributes[:'codSurchargePerc']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.has_key?(:'restrictions')
|
82
|
+
self.restrictions = attributes[:'restrictions']
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
+
# @return Array for valid properties with the reasons
|
88
|
+
def list_invalid_properties
|
89
|
+
invalid_properties = Array.new
|
90
|
+
invalid_properties
|
91
|
+
end
|
92
|
+
|
93
|
+
# Check to see if the all the properties in the model are valid
|
94
|
+
# @return true if the model is valid
|
95
|
+
def valid?
|
96
|
+
true
|
97
|
+
end
|
98
|
+
|
99
|
+
# Checks equality by comparing each attribute.
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def ==(o)
|
102
|
+
return true if self.equal?(o)
|
103
|
+
self.class == o.class &&
|
104
|
+
accept_cod == o.accept_cod &&
|
105
|
+
cod_approved_customers_only == o.cod_approved_customers_only &&
|
106
|
+
cod_surcharge_accounting_code == o.cod_surcharge_accounting_code &&
|
107
|
+
cod_surcharge_fee == o.cod_surcharge_fee &&
|
108
|
+
cod_surcharge_perc == o.cod_surcharge_perc &&
|
109
|
+
restrictions == o.restrictions
|
110
|
+
end
|
111
|
+
|
112
|
+
# @see the `==` method
|
113
|
+
# @param [Object] Object to be compared
|
114
|
+
def eql?(o)
|
115
|
+
self == o
|
116
|
+
end
|
117
|
+
|
118
|
+
# Calculates hash code according to all attributes.
|
119
|
+
# @return [Fixnum] Hash code
|
120
|
+
def hash
|
121
|
+
[accept_cod, cod_approved_customers_only, cod_surcharge_accounting_code, cod_surcharge_fee, cod_surcharge_perc, restrictions].hash
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def build_from_hash(attributes)
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
129
|
+
self.class.swagger_types.each_pair do |key, type|
|
130
|
+
if type =~ /\AArray<(.*)>/i
|
131
|
+
# check to ensure the input is an array given that the attribute
|
132
|
+
# is documented as an array but the input is not
|
133
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
134
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
135
|
+
end
|
136
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
137
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
138
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
139
|
+
end
|
140
|
+
|
141
|
+
self
|
142
|
+
end
|
143
|
+
|
144
|
+
# Deserializes the data based on type
|
145
|
+
# @param string type Data type
|
146
|
+
# @param string value Value to be deserialized
|
147
|
+
# @return [Object] Deserialized data
|
148
|
+
def _deserialize(type, value)
|
149
|
+
case type.to_sym
|
150
|
+
when :DateTime
|
151
|
+
DateTime.parse(value)
|
152
|
+
when :Date
|
153
|
+
Date.parse(value)
|
154
|
+
when :String
|
155
|
+
value.to_s
|
156
|
+
when :Integer
|
157
|
+
value.to_i
|
158
|
+
when :Float
|
159
|
+
value.to_f
|
160
|
+
when :BOOLEAN
|
161
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
162
|
+
true
|
163
|
+
else
|
164
|
+
false
|
165
|
+
end
|
166
|
+
when :Object
|
167
|
+
# generic object (usually a Hash), return directly
|
168
|
+
value
|
169
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
170
|
+
inner_type = Regexp.last_match[:inner_type]
|
171
|
+
value.map { |v| _deserialize(inner_type, v) }
|
172
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
173
|
+
k_type = Regexp.last_match[:k_type]
|
174
|
+
v_type = Regexp.last_match[:v_type]
|
175
|
+
{}.tap do |hash|
|
176
|
+
value.each do |k, v|
|
177
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
else # model
|
181
|
+
temp_model = UltracartClient.const_get(type).new
|
182
|
+
temp_model.build_from_hash(value)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the string representation of the object
|
187
|
+
# @return [String] String presentation of the object
|
188
|
+
def to_s
|
189
|
+
to_hash.to_s
|
190
|
+
end
|
191
|
+
|
192
|
+
# to_body is an alias to to_hash (backward compatibility)
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_body
|
195
|
+
to_hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns the object in the form of hash
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
200
|
+
def to_hash
|
201
|
+
hash = {}
|
202
|
+
self.class.attribute_map.each_pair do |attr, param|
|
203
|
+
value = self.send(attr)
|
204
|
+
next if value.nil?
|
205
|
+
hash[param] = _to_hash(value)
|
206
|
+
end
|
207
|
+
hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Outputs non-array value in the form of hash
|
211
|
+
# For object, use to_hash. Otherwise, just return the value
|
212
|
+
# @param [Object] value Any valid value
|
213
|
+
# @return [Hash] Returns the value in the form of hash
|
214
|
+
def _to_hash(value)
|
215
|
+
if value.is_a?(Array)
|
216
|
+
value.compact.map { |v| _to_hash(v) }
|
217
|
+
elsif value.is_a?(Hash)
|
218
|
+
{}.tap do |hash|
|
219
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
220
|
+
end
|
221
|
+
elsif value.respond_to? :to_hash
|
222
|
+
value.to_hash
|
223
|
+
else
|
224
|
+
value
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
229
|
+
end
|
@@ -0,0 +1,256 @@
|
|
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 PaymentsConfigurationCreditCard
|
17
|
+
attr_accessor :accept_credit_cards
|
18
|
+
|
19
|
+
attr_accessor :billed_by
|
20
|
+
|
21
|
+
attr_accessor :charge_during_checkout
|
22
|
+
|
23
|
+
attr_accessor :collect_cvv2
|
24
|
+
|
25
|
+
attr_accessor :configured_gateways_details
|
26
|
+
|
27
|
+
attr_accessor :failed_attempts
|
28
|
+
|
29
|
+
attr_accessor :hide_connect_single_gateway
|
30
|
+
|
31
|
+
attr_accessor :immediate_finalize_domains
|
32
|
+
|
33
|
+
attr_accessor :send_customer_billing_update_on_decline
|
34
|
+
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
+
def self.attribute_map
|
37
|
+
{
|
38
|
+
:'accept_credit_cards' => :'acceptCreditCards',
|
39
|
+
:'billed_by' => :'billedBy',
|
40
|
+
:'charge_during_checkout' => :'chargeDuringCheckout',
|
41
|
+
:'collect_cvv2' => :'collectCvv2',
|
42
|
+
:'configured_gateways_details' => :'configuredGatewaysDetails',
|
43
|
+
:'failed_attempts' => :'failedAttempts',
|
44
|
+
:'hide_connect_single_gateway' => :'hideConnectSingleGateway',
|
45
|
+
:'immediate_finalize_domains' => :'immediateFinalizeDomains',
|
46
|
+
:'send_customer_billing_update_on_decline' => :'sendCustomerBillingUpdateOnDecline'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Attribute type mapping.
|
51
|
+
def self.swagger_types
|
52
|
+
{
|
53
|
+
:'accept_credit_cards' => :'BOOLEAN',
|
54
|
+
:'billed_by' => :'String',
|
55
|
+
:'charge_during_checkout' => :'BOOLEAN',
|
56
|
+
:'collect_cvv2' => :'BOOLEAN',
|
57
|
+
:'configured_gateways_details' => :'String',
|
58
|
+
:'failed_attempts' => :'String',
|
59
|
+
:'hide_connect_single_gateway' => :'BOOLEAN',
|
60
|
+
:'immediate_finalize_domains' => :'String',
|
61
|
+
:'send_customer_billing_update_on_decline' => :'BOOLEAN'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Initializes the object
|
66
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
67
|
+
def initialize(attributes = {})
|
68
|
+
return unless attributes.is_a?(Hash)
|
69
|
+
|
70
|
+
# convert string to symbol for hash key
|
71
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
72
|
+
|
73
|
+
if attributes.has_key?(:'acceptCreditCards')
|
74
|
+
self.accept_credit_cards = attributes[:'acceptCreditCards']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.has_key?(:'billedBy')
|
78
|
+
self.billed_by = attributes[:'billedBy']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.has_key?(:'chargeDuringCheckout')
|
82
|
+
self.charge_during_checkout = attributes[:'chargeDuringCheckout']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'collectCvv2')
|
86
|
+
self.collect_cvv2 = attributes[:'collectCvv2']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'configuredGatewaysDetails')
|
90
|
+
self.configured_gateways_details = attributes[:'configuredGatewaysDetails']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.has_key?(:'failedAttempts')
|
94
|
+
self.failed_attempts = attributes[:'failedAttempts']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.has_key?(:'hideConnectSingleGateway')
|
98
|
+
self.hide_connect_single_gateway = attributes[:'hideConnectSingleGateway']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'immediateFinalizeDomains')
|
102
|
+
self.immediate_finalize_domains = attributes[:'immediateFinalizeDomains']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'sendCustomerBillingUpdateOnDecline')
|
106
|
+
self.send_customer_billing_update_on_decline = attributes[:'sendCustomerBillingUpdateOnDecline']
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
111
|
+
# @return Array for valid properties with the reasons
|
112
|
+
def list_invalid_properties
|
113
|
+
invalid_properties = Array.new
|
114
|
+
invalid_properties
|
115
|
+
end
|
116
|
+
|
117
|
+
# Check to see if the all the properties in the model are valid
|
118
|
+
# @return true if the model is valid
|
119
|
+
def valid?
|
120
|
+
true
|
121
|
+
end
|
122
|
+
|
123
|
+
# Checks equality by comparing each attribute.
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def ==(o)
|
126
|
+
return true if self.equal?(o)
|
127
|
+
self.class == o.class &&
|
128
|
+
accept_credit_cards == o.accept_credit_cards &&
|
129
|
+
billed_by == o.billed_by &&
|
130
|
+
charge_during_checkout == o.charge_during_checkout &&
|
131
|
+
collect_cvv2 == o.collect_cvv2 &&
|
132
|
+
configured_gateways_details == o.configured_gateways_details &&
|
133
|
+
failed_attempts == o.failed_attempts &&
|
134
|
+
hide_connect_single_gateway == o.hide_connect_single_gateway &&
|
135
|
+
immediate_finalize_domains == o.immediate_finalize_domains &&
|
136
|
+
send_customer_billing_update_on_decline == o.send_customer_billing_update_on_decline
|
137
|
+
end
|
138
|
+
|
139
|
+
# @see the `==` method
|
140
|
+
# @param [Object] Object to be compared
|
141
|
+
def eql?(o)
|
142
|
+
self == o
|
143
|
+
end
|
144
|
+
|
145
|
+
# Calculates hash code according to all attributes.
|
146
|
+
# @return [Fixnum] Hash code
|
147
|
+
def hash
|
148
|
+
[accept_credit_cards, billed_by, charge_during_checkout, collect_cvv2, configured_gateways_details, failed_attempts, hide_connect_single_gateway, immediate_finalize_domains, send_customer_billing_update_on_decline].hash
|
149
|
+
end
|
150
|
+
|
151
|
+
# Builds the object from hash
|
152
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
153
|
+
# @return [Object] Returns the model itself
|
154
|
+
def build_from_hash(attributes)
|
155
|
+
return nil unless attributes.is_a?(Hash)
|
156
|
+
self.class.swagger_types.each_pair do |key, type|
|
157
|
+
if type =~ /\AArray<(.*)>/i
|
158
|
+
# check to ensure the input is an array given that the attribute
|
159
|
+
# is documented as an array but the input is not
|
160
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
161
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
162
|
+
end
|
163
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
164
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
165
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
166
|
+
end
|
167
|
+
|
168
|
+
self
|
169
|
+
end
|
170
|
+
|
171
|
+
# Deserializes the data based on type
|
172
|
+
# @param string type Data type
|
173
|
+
# @param string value Value to be deserialized
|
174
|
+
# @return [Object] Deserialized data
|
175
|
+
def _deserialize(type, value)
|
176
|
+
case type.to_sym
|
177
|
+
when :DateTime
|
178
|
+
DateTime.parse(value)
|
179
|
+
when :Date
|
180
|
+
Date.parse(value)
|
181
|
+
when :String
|
182
|
+
value.to_s
|
183
|
+
when :Integer
|
184
|
+
value.to_i
|
185
|
+
when :Float
|
186
|
+
value.to_f
|
187
|
+
when :BOOLEAN
|
188
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
189
|
+
true
|
190
|
+
else
|
191
|
+
false
|
192
|
+
end
|
193
|
+
when :Object
|
194
|
+
# generic object (usually a Hash), return directly
|
195
|
+
value
|
196
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
197
|
+
inner_type = Regexp.last_match[:inner_type]
|
198
|
+
value.map { |v| _deserialize(inner_type, v) }
|
199
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
200
|
+
k_type = Regexp.last_match[:k_type]
|
201
|
+
v_type = Regexp.last_match[:v_type]
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each do |k, v|
|
204
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
else # model
|
208
|
+
temp_model = UltracartClient.const_get(type).new
|
209
|
+
temp_model.build_from_hash(value)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns the string representation of the object
|
214
|
+
# @return [String] String presentation of the object
|
215
|
+
def to_s
|
216
|
+
to_hash.to_s
|
217
|
+
end
|
218
|
+
|
219
|
+
# to_body is an alias to to_hash (backward compatibility)
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
221
|
+
def to_body
|
222
|
+
to_hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns the object in the form of hash
|
226
|
+
# @return [Hash] Returns the object in the form of hash
|
227
|
+
def to_hash
|
228
|
+
hash = {}
|
229
|
+
self.class.attribute_map.each_pair do |attr, param|
|
230
|
+
value = self.send(attr)
|
231
|
+
next if value.nil?
|
232
|
+
hash[param] = _to_hash(value)
|
233
|
+
end
|
234
|
+
hash
|
235
|
+
end
|
236
|
+
|
237
|
+
# Outputs non-array value in the form of hash
|
238
|
+
# For object, use to_hash. Otherwise, just return the value
|
239
|
+
# @param [Object] value Any valid value
|
240
|
+
# @return [Hash] Returns the value in the form of hash
|
241
|
+
def _to_hash(value)
|
242
|
+
if value.is_a?(Array)
|
243
|
+
value.compact.map { |v| _to_hash(v) }
|
244
|
+
elsif value.is_a?(Hash)
|
245
|
+
{}.tap do |hash|
|
246
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
247
|
+
end
|
248
|
+
elsif value.respond_to? :to_hash
|
249
|
+
value.to_hash
|
250
|
+
else
|
251
|
+
value
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|
256
|
+
end
|