conekta 6.0.3 → 6.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -5
- data/VERSION +1 -1
- data/config-ruby.json +1 -1
- data/docs/ChargeRequest.md +1 -1
- data/docs/ChargeRequestPaymentMethod.md +39 -18
- data/docs/ChargeResponse.md +6 -6
- data/docs/ChargesApi.md +79 -1
- data/docs/ChargesDataResponse.md +6 -6
- data/docs/ChargesOrderResponse.md +22 -0
- data/docs/ChargesOrderResponseAllOfData.md +52 -0
- data/docs/Checkout.md +2 -0
- data/docs/CheckoutRequest.md +2 -0
- data/docs/CreateCustomerPaymentMethodsRequest.md +4 -4
- data/docs/Customer.md +4 -0
- data/docs/CustomerPaymentMethodsRequest.md +4 -4
- data/docs/CustomerResponse.md +4 -0
- data/docs/OrderRefundRequest.md +2 -2
- data/docs/OrderRequest.md +1 -1
- data/docs/OrderResponseCheckout.md +2 -0
- data/docs/PaymentMethodBankTransfer.md +3 -1
- data/docs/PaymentMethodCard.md +12 -10
- data/docs/PaymentMethodCardRequest.md +12 -2
- data/docs/PaymentMethodCash.md +7 -1
- data/docs/PaymentMethodGeneralRequest.md +32 -0
- data/docs/PaymentMethodTokenRequest.md +20 -0
- data/docs/PaymentMethodsApi.md +1 -1
- data/docs/PayoutOrdersApi.md +74 -0
- data/docs/SubscriptionResponse.md +2 -0
- data/docs/UpdateCustomer.md +4 -0
- data/lib/conekta/api/charges_api.rb +84 -0
- data/lib/conekta/api/payout_orders_api.rb +70 -0
- data/lib/conekta/models/charge_request.rb +1 -0
- data/lib/conekta/models/charge_request_payment_method.rb +74 -239
- data/lib/conekta/models/charge_response.rb +4 -0
- data/lib/conekta/models/charges_data_response.rb +4 -0
- data/lib/conekta/models/charges_order_response.rb +258 -0
- data/lib/conekta/models/charges_order_response_all_of_data.rb +382 -0
- data/lib/conekta/models/checkout.rb +11 -1
- data/lib/conekta/models/checkout_request.rb +11 -1
- data/lib/conekta/models/create_customer_payment_methods_request.rb +2 -2
- data/lib/conekta/models/customer.rb +21 -1
- data/lib/conekta/models/customer_payment_methods_request.rb +2 -2
- data/lib/conekta/models/customer_response.rb +21 -1
- data/lib/conekta/models/order_refund_request.rb +2 -1
- data/lib/conekta/models/order_request.rb +1 -1
- data/lib/conekta/models/order_response_checkout.rb +12 -1
- data/lib/conekta/models/payment_method_bank_transfer.rb +14 -5
- data/lib/conekta/models/payment_method_card.rb +22 -4
- data/lib/conekta/models/payment_method_card_request.rb +174 -12
- data/lib/conekta/models/payment_method_cash.rb +33 -4
- data/lib/conekta/models/payment_method_general_request.rb +291 -0
- data/lib/conekta/models/payment_method_token_request.rb +246 -0
- data/lib/conekta/models/subscription_response.rb +11 -1
- data/lib/conekta/models/update_customer.rb +21 -1
- data/lib/conekta/version.rb +1 -1
- data/lib/conekta.rb +4 -0
- data/spec/api/charges_api_spec.rb +18 -10
- data/spec/api/customers_api_spec.rb +10 -4
- data/spec/api/orders_api_spec.rb +6 -6
- metadata +32 -24
@@ -19,6 +19,9 @@ module Conekta
|
|
19
19
|
|
20
20
|
attr_accessor :object
|
21
21
|
|
22
|
+
# Agreement ID
|
23
|
+
attr_accessor :agreement
|
24
|
+
|
22
25
|
attr_accessor :auth_code
|
23
26
|
|
24
27
|
attr_accessor :cashier_id
|
@@ -29,25 +32,33 @@ module Conekta
|
|
29
32
|
|
30
33
|
attr_accessor :expires_at
|
31
34
|
|
35
|
+
# Product type, e.g. bbva_cash_in, cash_in, pespay_cash_in, etc.
|
36
|
+
attr_accessor :product_type
|
37
|
+
|
32
38
|
attr_accessor :service_name
|
33
39
|
|
34
40
|
attr_accessor :store
|
35
41
|
|
36
42
|
attr_accessor :store_name
|
37
43
|
|
44
|
+
attr_accessor :customer_ip_address
|
45
|
+
|
38
46
|
# Attribute mapping from ruby-style variable name to JSON key.
|
39
47
|
def self.attribute_map
|
40
48
|
{
|
41
49
|
:'type' => :'type',
|
42
50
|
:'object' => :'object',
|
51
|
+
:'agreement' => :'agreement',
|
43
52
|
:'auth_code' => :'auth_code',
|
44
53
|
:'cashier_id' => :'cashier_id',
|
45
54
|
:'reference' => :'reference',
|
46
55
|
:'barcode_url' => :'barcode_url',
|
47
56
|
:'expires_at' => :'expires_at',
|
57
|
+
:'product_type' => :'product_type',
|
48
58
|
:'service_name' => :'service_name',
|
49
59
|
:'store' => :'store',
|
50
|
-
:'store_name' => :'store_name'
|
60
|
+
:'store_name' => :'store_name',
|
61
|
+
:'customer_ip_address' => :'customer_ip_address'
|
51
62
|
}
|
52
63
|
end
|
53
64
|
|
@@ -61,14 +72,17 @@ module Conekta
|
|
61
72
|
{
|
62
73
|
:'type' => :'String',
|
63
74
|
:'object' => :'String',
|
75
|
+
:'agreement' => :'String',
|
64
76
|
:'auth_code' => :'Integer',
|
65
77
|
:'cashier_id' => :'String',
|
66
78
|
:'reference' => :'String',
|
67
79
|
:'barcode_url' => :'String',
|
68
80
|
:'expires_at' => :'Integer',
|
81
|
+
:'product_type' => :'String',
|
69
82
|
:'service_name' => :'String',
|
70
83
|
:'store' => :'String',
|
71
|
-
:'store_name' => :'String'
|
84
|
+
:'store_name' => :'String',
|
85
|
+
:'customer_ip_address' => :'String'
|
72
86
|
}
|
73
87
|
end
|
74
88
|
|
@@ -113,6 +127,10 @@ module Conekta
|
|
113
127
|
self.object = nil
|
114
128
|
end
|
115
129
|
|
130
|
+
if attributes.key?(:'agreement')
|
131
|
+
self.agreement = attributes[:'agreement']
|
132
|
+
end
|
133
|
+
|
116
134
|
if attributes.key?(:'auth_code')
|
117
135
|
self.auth_code = attributes[:'auth_code']
|
118
136
|
end
|
@@ -133,6 +151,10 @@ module Conekta
|
|
133
151
|
self.expires_at = attributes[:'expires_at']
|
134
152
|
end
|
135
153
|
|
154
|
+
if attributes.key?(:'product_type')
|
155
|
+
self.product_type = attributes[:'product_type']
|
156
|
+
end
|
157
|
+
|
136
158
|
if attributes.key?(:'service_name')
|
137
159
|
self.service_name = attributes[:'service_name']
|
138
160
|
end
|
@@ -144,6 +166,10 @@ module Conekta
|
|
144
166
|
if attributes.key?(:'store_name')
|
145
167
|
self.store_name = attributes[:'store_name']
|
146
168
|
end
|
169
|
+
|
170
|
+
if attributes.key?(:'customer_ip_address')
|
171
|
+
self.customer_ip_address = attributes[:'customer_ip_address']
|
172
|
+
end
|
147
173
|
end
|
148
174
|
|
149
175
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -173,14 +199,17 @@ module Conekta
|
|
173
199
|
self.class == o.class &&
|
174
200
|
type == o.type &&
|
175
201
|
object == o.object &&
|
202
|
+
agreement == o.agreement &&
|
176
203
|
auth_code == o.auth_code &&
|
177
204
|
cashier_id == o.cashier_id &&
|
178
205
|
reference == o.reference &&
|
179
206
|
barcode_url == o.barcode_url &&
|
180
207
|
expires_at == o.expires_at &&
|
208
|
+
product_type == o.product_type &&
|
181
209
|
service_name == o.service_name &&
|
182
210
|
store == o.store &&
|
183
|
-
store_name == o.store_name
|
211
|
+
store_name == o.store_name &&
|
212
|
+
customer_ip_address == o.customer_ip_address
|
184
213
|
end
|
185
214
|
|
186
215
|
# @see the `==` method
|
@@ -192,7 +221,7 @@ module Conekta
|
|
192
221
|
# Calculates hash code according to all attributes.
|
193
222
|
# @return [Integer] Hash code
|
194
223
|
def hash
|
195
|
-
[type, object, auth_code, cashier_id, reference, barcode_url, expires_at, service_name, store, store_name].hash
|
224
|
+
[type, object, agreement, auth_code, cashier_id, reference, barcode_url, expires_at, product_type, service_name, store, store_name, customer_ip_address].hash
|
196
225
|
end
|
197
226
|
|
198
227
|
# Builds the object from hash
|
@@ -0,0 +1,291 @@
|
|
1
|
+
=begin
|
2
|
+
#Conekta API
|
3
|
+
|
4
|
+
#Conekta sdk
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.1.0
|
7
|
+
Contact: engineering@conekta.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.5.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Conekta
|
17
|
+
# Payment method used in the charge. Go to the [payment methods](https://developers.conekta.com/reference/m%C3%A9todos-de-pago) section for more details
|
18
|
+
class PaymentMethodGeneralRequest
|
19
|
+
# Method expiration date as unix timestamp
|
20
|
+
attr_accessor :expires_at
|
21
|
+
|
22
|
+
# How many months without interest to apply, it can be 3, 6, 9, 12 or 18
|
23
|
+
attr_accessor :monthly_installments
|
24
|
+
|
25
|
+
# Type of payment method
|
26
|
+
attr_accessor :type
|
27
|
+
|
28
|
+
attr_accessor :token_id
|
29
|
+
|
30
|
+
attr_accessor :payment_source_id
|
31
|
+
|
32
|
+
# Optional, It is a value that allows identifying the security code of the card. Only for PCI merchants
|
33
|
+
attr_accessor :cvc
|
34
|
+
|
35
|
+
# Optional id sent to indicate the bank contract for recurrent card charges.
|
36
|
+
attr_accessor :contract_id
|
37
|
+
|
38
|
+
# Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes
|
39
|
+
attr_accessor :customer_ip_address
|
40
|
+
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
42
|
+
def self.attribute_map
|
43
|
+
{
|
44
|
+
:'expires_at' => :'expires_at',
|
45
|
+
:'monthly_installments' => :'monthly_installments',
|
46
|
+
:'type' => :'type',
|
47
|
+
:'token_id' => :'token_id',
|
48
|
+
:'payment_source_id' => :'payment_source_id',
|
49
|
+
:'cvc' => :'cvc',
|
50
|
+
:'contract_id' => :'contract_id',
|
51
|
+
:'customer_ip_address' => :'customer_ip_address'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# Returns all the JSON keys this model knows about
|
56
|
+
def self.acceptable_attributes
|
57
|
+
attribute_map.values
|
58
|
+
end
|
59
|
+
|
60
|
+
# Attribute type mapping.
|
61
|
+
def self.openapi_types
|
62
|
+
{
|
63
|
+
:'expires_at' => :'Integer',
|
64
|
+
:'monthly_installments' => :'Integer',
|
65
|
+
:'type' => :'String',
|
66
|
+
:'token_id' => :'String',
|
67
|
+
:'payment_source_id' => :'String',
|
68
|
+
:'cvc' => :'String',
|
69
|
+
:'contract_id' => :'String',
|
70
|
+
:'customer_ip_address' => :'String'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# List of attributes with nullable: true
|
75
|
+
def self.openapi_nullable
|
76
|
+
Set.new([
|
77
|
+
])
|
78
|
+
end
|
79
|
+
|
80
|
+
# Initializes the object
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
def initialize(attributes = {})
|
83
|
+
if (!attributes.is_a?(Hash))
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodGeneralRequest` initialize method"
|
85
|
+
end
|
86
|
+
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
89
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodGeneralRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
91
|
+
end
|
92
|
+
h[k.to_sym] = v
|
93
|
+
}
|
94
|
+
|
95
|
+
if attributes.key?(:'expires_at')
|
96
|
+
self.expires_at = attributes[:'expires_at']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'monthly_installments')
|
100
|
+
self.monthly_installments = attributes[:'monthly_installments']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'type')
|
104
|
+
self.type = attributes[:'type']
|
105
|
+
else
|
106
|
+
self.type = nil
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'token_id')
|
110
|
+
self.token_id = attributes[:'token_id']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'payment_source_id')
|
114
|
+
self.payment_source_id = attributes[:'payment_source_id']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'cvc')
|
118
|
+
self.cvc = attributes[:'cvc']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'contract_id')
|
122
|
+
self.contract_id = attributes[:'contract_id']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'customer_ip_address')
|
126
|
+
self.customer_ip_address = attributes[:'customer_ip_address']
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
131
|
+
# @return Array for valid properties with the reasons
|
132
|
+
def list_invalid_properties
|
133
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
134
|
+
invalid_properties = Array.new
|
135
|
+
if @type.nil?
|
136
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
137
|
+
end
|
138
|
+
|
139
|
+
invalid_properties
|
140
|
+
end
|
141
|
+
|
142
|
+
# Check to see if the all the properties in the model are valid
|
143
|
+
# @return true if the model is valid
|
144
|
+
def valid?
|
145
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
146
|
+
return false if @type.nil?
|
147
|
+
true
|
148
|
+
end
|
149
|
+
|
150
|
+
# Checks equality by comparing each attribute.
|
151
|
+
# @param [Object] Object to be compared
|
152
|
+
def ==(o)
|
153
|
+
return true if self.equal?(o)
|
154
|
+
self.class == o.class &&
|
155
|
+
expires_at == o.expires_at &&
|
156
|
+
monthly_installments == o.monthly_installments &&
|
157
|
+
type == o.type &&
|
158
|
+
token_id == o.token_id &&
|
159
|
+
payment_source_id == o.payment_source_id &&
|
160
|
+
cvc == o.cvc &&
|
161
|
+
contract_id == o.contract_id &&
|
162
|
+
customer_ip_address == o.customer_ip_address
|
163
|
+
end
|
164
|
+
|
165
|
+
# @see the `==` method
|
166
|
+
# @param [Object] Object to be compared
|
167
|
+
def eql?(o)
|
168
|
+
self == o
|
169
|
+
end
|
170
|
+
|
171
|
+
# Calculates hash code according to all attributes.
|
172
|
+
# @return [Integer] Hash code
|
173
|
+
def hash
|
174
|
+
[expires_at, monthly_installments, type, token_id, payment_source_id, cvc, contract_id, customer_ip_address].hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Builds the object from hash
|
178
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
179
|
+
# @return [Object] Returns the model itself
|
180
|
+
def self.build_from_hash(attributes)
|
181
|
+
return nil unless attributes.is_a?(Hash)
|
182
|
+
attributes = attributes.transform_keys(&:to_sym)
|
183
|
+
transformed_hash = {}
|
184
|
+
openapi_types.each_pair do |key, type|
|
185
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
186
|
+
transformed_hash["#{key}"] = nil
|
187
|
+
elsif type =~ /\AArray<(.*)>/i
|
188
|
+
# check to ensure the input is an array given that the attribute
|
189
|
+
# is documented as an array but the input is not
|
190
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
191
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
192
|
+
end
|
193
|
+
elsif !attributes[attribute_map[key]].nil?
|
194
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
195
|
+
end
|
196
|
+
end
|
197
|
+
new(transformed_hash)
|
198
|
+
end
|
199
|
+
|
200
|
+
# Deserializes the data based on type
|
201
|
+
# @param string type Data type
|
202
|
+
# @param string value Value to be deserialized
|
203
|
+
# @return [Object] Deserialized data
|
204
|
+
def self._deserialize(type, value)
|
205
|
+
case type.to_sym
|
206
|
+
when :Time
|
207
|
+
Time.parse(value)
|
208
|
+
when :Date
|
209
|
+
Date.parse(value)
|
210
|
+
when :String
|
211
|
+
value.to_s
|
212
|
+
when :Integer
|
213
|
+
value.to_i
|
214
|
+
when :Float
|
215
|
+
value.to_f
|
216
|
+
when :Boolean
|
217
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
218
|
+
true
|
219
|
+
else
|
220
|
+
false
|
221
|
+
end
|
222
|
+
when :Object
|
223
|
+
# generic object (usually a Hash), return directly
|
224
|
+
value
|
225
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
226
|
+
inner_type = Regexp.last_match[:inner_type]
|
227
|
+
value.map { |v| _deserialize(inner_type, v) }
|
228
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
229
|
+
k_type = Regexp.last_match[:k_type]
|
230
|
+
v_type = Regexp.last_match[:v_type]
|
231
|
+
{}.tap do |hash|
|
232
|
+
value.each do |k, v|
|
233
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
else # model
|
237
|
+
# models (e.g. Pet) or oneOf
|
238
|
+
klass = Conekta.const_get(type)
|
239
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Returns the string representation of the object
|
244
|
+
# @return [String] String presentation of the object
|
245
|
+
def to_s
|
246
|
+
to_hash.to_s
|
247
|
+
end
|
248
|
+
|
249
|
+
# to_body is an alias to to_hash (backward compatibility)
|
250
|
+
# @return [Hash] Returns the object in the form of hash
|
251
|
+
def to_body
|
252
|
+
to_hash
|
253
|
+
end
|
254
|
+
|
255
|
+
# Returns the object in the form of hash
|
256
|
+
# @return [Hash] Returns the object in the form of hash
|
257
|
+
def to_hash
|
258
|
+
hash = {}
|
259
|
+
self.class.attribute_map.each_pair do |attr, param|
|
260
|
+
value = self.send(attr)
|
261
|
+
if value.nil?
|
262
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
263
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
264
|
+
end
|
265
|
+
|
266
|
+
hash[param] = _to_hash(value)
|
267
|
+
end
|
268
|
+
hash
|
269
|
+
end
|
270
|
+
|
271
|
+
# Outputs non-array value in the form of hash
|
272
|
+
# For object, use to_hash. Otherwise, just return the value
|
273
|
+
# @param [Object] value Any valid value
|
274
|
+
# @return [Hash] Returns the value in the form of hash
|
275
|
+
def _to_hash(value)
|
276
|
+
if value.is_a?(Array)
|
277
|
+
value.compact.map { |v| _to_hash(v) }
|
278
|
+
elsif value.is_a?(Hash)
|
279
|
+
{}.tap do |hash|
|
280
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
281
|
+
end
|
282
|
+
elsif value.respond_to? :to_hash
|
283
|
+
value.to_hash
|
284
|
+
else
|
285
|
+
value
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
290
|
+
|
291
|
+
end
|
@@ -0,0 +1,246 @@
|
|
1
|
+
=begin
|
2
|
+
#Conekta API
|
3
|
+
|
4
|
+
#Conekta sdk
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.1.0
|
7
|
+
Contact: engineering@conekta.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.5.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Conekta
|
17
|
+
class PaymentMethodTokenRequest
|
18
|
+
# Type of payment method
|
19
|
+
attr_accessor :type
|
20
|
+
|
21
|
+
# Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.1.0/reference/createsubscription] tutorial for more information on how to tokenize cards.
|
22
|
+
attr_accessor :token_id
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'type' => :'type',
|
28
|
+
:'token_id' => :'token_id'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns all the JSON keys this model knows about
|
33
|
+
def self.acceptable_attributes
|
34
|
+
attribute_map.values
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.openapi_types
|
39
|
+
{
|
40
|
+
:'type' => :'String',
|
41
|
+
:'token_id' => :'String'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of class defined in allOf (OpenAPI v3)
|
52
|
+
def self.openapi_all_of
|
53
|
+
[
|
54
|
+
:'CustomerPaymentMethodRequest'
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
# Initializes the object
|
59
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
60
|
+
def initialize(attributes = {})
|
61
|
+
if (!attributes.is_a?(Hash))
|
62
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodTokenRequest` initialize method"
|
63
|
+
end
|
64
|
+
|
65
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
66
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
67
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
68
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodTokenRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
69
|
+
end
|
70
|
+
h[k.to_sym] = v
|
71
|
+
}
|
72
|
+
|
73
|
+
if attributes.key?(:'type')
|
74
|
+
self.type = attributes[:'type']
|
75
|
+
else
|
76
|
+
self.type = nil
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'token_id')
|
80
|
+
self.token_id = attributes[:'token_id']
|
81
|
+
else
|
82
|
+
self.token_id = nil
|
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
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
90
|
+
invalid_properties = Array.new
|
91
|
+
if @type.nil?
|
92
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
93
|
+
end
|
94
|
+
|
95
|
+
if @token_id.nil?
|
96
|
+
invalid_properties.push('invalid value for "token_id", token_id cannot be nil.')
|
97
|
+
end
|
98
|
+
|
99
|
+
invalid_properties
|
100
|
+
end
|
101
|
+
|
102
|
+
# Check to see if the all the properties in the model are valid
|
103
|
+
# @return true if the model is valid
|
104
|
+
def valid?
|
105
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
106
|
+
return false if @type.nil?
|
107
|
+
return false if @token_id.nil?
|
108
|
+
true
|
109
|
+
end
|
110
|
+
|
111
|
+
# Checks equality by comparing each attribute.
|
112
|
+
# @param [Object] Object to be compared
|
113
|
+
def ==(o)
|
114
|
+
return true if self.equal?(o)
|
115
|
+
self.class == o.class &&
|
116
|
+
type == o.type &&
|
117
|
+
token_id == o.token_id
|
118
|
+
end
|
119
|
+
|
120
|
+
# @see the `==` method
|
121
|
+
# @param [Object] Object to be compared
|
122
|
+
def eql?(o)
|
123
|
+
self == o
|
124
|
+
end
|
125
|
+
|
126
|
+
# Calculates hash code according to all attributes.
|
127
|
+
# @return [Integer] Hash code
|
128
|
+
def hash
|
129
|
+
[type, token_id].hash
|
130
|
+
end
|
131
|
+
|
132
|
+
# Builds the object from hash
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
134
|
+
# @return [Object] Returns the model itself
|
135
|
+
def self.build_from_hash(attributes)
|
136
|
+
return nil unless attributes.is_a?(Hash)
|
137
|
+
attributes = attributes.transform_keys(&:to_sym)
|
138
|
+
transformed_hash = {}
|
139
|
+
openapi_types.each_pair do |key, type|
|
140
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
141
|
+
transformed_hash["#{key}"] = nil
|
142
|
+
elsif type =~ /\AArray<(.*)>/i
|
143
|
+
# check to ensure the input is an array given that the attribute
|
144
|
+
# is documented as an array but the input is not
|
145
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
146
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
147
|
+
end
|
148
|
+
elsif !attributes[attribute_map[key]].nil?
|
149
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
150
|
+
end
|
151
|
+
end
|
152
|
+
new(transformed_hash)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Deserializes the data based on type
|
156
|
+
# @param string type Data type
|
157
|
+
# @param string value Value to be deserialized
|
158
|
+
# @return [Object] Deserialized data
|
159
|
+
def self._deserialize(type, value)
|
160
|
+
case type.to_sym
|
161
|
+
when :Time
|
162
|
+
Time.parse(value)
|
163
|
+
when :Date
|
164
|
+
Date.parse(value)
|
165
|
+
when :String
|
166
|
+
value.to_s
|
167
|
+
when :Integer
|
168
|
+
value.to_i
|
169
|
+
when :Float
|
170
|
+
value.to_f
|
171
|
+
when :Boolean
|
172
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
173
|
+
true
|
174
|
+
else
|
175
|
+
false
|
176
|
+
end
|
177
|
+
when :Object
|
178
|
+
# generic object (usually a Hash), return directly
|
179
|
+
value
|
180
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
181
|
+
inner_type = Regexp.last_match[:inner_type]
|
182
|
+
value.map { |v| _deserialize(inner_type, v) }
|
183
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
184
|
+
k_type = Regexp.last_match[:k_type]
|
185
|
+
v_type = Regexp.last_match[:v_type]
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each do |k, v|
|
188
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
else # model
|
192
|
+
# models (e.g. Pet) or oneOf
|
193
|
+
klass = Conekta.const_get(type)
|
194
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns the string representation of the object
|
199
|
+
# @return [String] String presentation of the object
|
200
|
+
def to_s
|
201
|
+
to_hash.to_s
|
202
|
+
end
|
203
|
+
|
204
|
+
# to_body is an alias to to_hash (backward compatibility)
|
205
|
+
# @return [Hash] Returns the object in the form of hash
|
206
|
+
def to_body
|
207
|
+
to_hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Returns the object in the form of hash
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
212
|
+
def to_hash
|
213
|
+
hash = {}
|
214
|
+
self.class.attribute_map.each_pair do |attr, param|
|
215
|
+
value = self.send(attr)
|
216
|
+
if value.nil?
|
217
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
218
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
219
|
+
end
|
220
|
+
|
221
|
+
hash[param] = _to_hash(value)
|
222
|
+
end
|
223
|
+
hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Outputs non-array value in the form of hash
|
227
|
+
# For object, use to_hash. Otherwise, just return the value
|
228
|
+
# @param [Object] value Any valid value
|
229
|
+
# @return [Hash] Returns the value in the form of hash
|
230
|
+
def _to_hash(value)
|
231
|
+
if value.is_a?(Array)
|
232
|
+
value.compact.map { |v| _to_hash(v) }
|
233
|
+
elsif value.is_a?(Hash)
|
234
|
+
{}.tap do |hash|
|
235
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
236
|
+
end
|
237
|
+
elsif value.respond_to? :to_hash
|
238
|
+
value.to_hash
|
239
|
+
else
|
240
|
+
value
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|