conekta 6.0.0 → 6.0.1
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/Makefile +9 -1
- data/README.md +17 -10
- data/VERSION +1 -1
- data/conekta.gemspec +4 -3
- data/config-ruby.json +32 -0
- data/docs/BalancesApi.md +1 -1
- data/docs/ChargeOrderResponse.md +0 -2
- data/docs/ChargeRequest.md +0 -2
- data/docs/ChargeRequestPaymentMethod.md +2 -0
- data/docs/ChargeResponse.md +0 -2
- data/docs/ChargeUpdateRequest.md +18 -0
- data/docs/ChargesApi.md +76 -0
- data/docs/ChargesDataResponse.md +0 -2
- data/docs/Checkout.md +2 -2
- data/docs/CheckoutOrderTemplate.md +1 -1
- data/docs/CheckoutRequest.md +2 -2
- data/docs/CheckoutResponse.md +3 -3
- data/docs/Customer.md +1 -1
- data/docs/CustomerAddress.md +3 -3
- data/docs/CustomerFiscalEntitiesRequestAddress.md +3 -3
- data/docs/CustomerResponse.md +11 -9
- data/docs/CustomerShippingContacts.md +4 -2
- data/docs/CustomerShippingContactsAddress.md +2 -2
- data/docs/CustomerShippingContactsDataResponse.md +3 -1
- data/docs/CustomerShippingContactsResponse.md +3 -1
- data/docs/CustomerShippingContactsResponseAddress.md +2 -2
- data/docs/CustomerUpdateShippingContacts.md +1 -1
- data/docs/CustomersApi.md +2 -2
- data/docs/EventResponse.md +1 -1
- data/docs/FiscalEntityAddress.md +30 -0
- data/docs/LogResponse.md +5 -5
- data/docs/LogsResponseData.md +5 -5
- data/docs/{CustomerInfoResponse.md → OrderCustomerInfoResponse.md} +4 -2
- data/docs/OrderFiscalEntityAddressResponse.md +32 -0
- data/docs/{OrderResponseFiscalEntityAddressAllOf.md → OrderFiscalEntityAddressResponseAllOf.md} +2 -2
- data/docs/OrderFiscalEntityRequest.md +28 -0
- data/docs/OrderFiscalEntityResponse.md +34 -0
- data/docs/OrderNextActionResponse.md +20 -0
- data/docs/OrderNextActionResponseRedirectToUrl.md +20 -0
- data/docs/OrderRequest.md +7 -1
- data/docs/OrderResponse.md +3 -1
- data/docs/OrderResponseCustomerInfo.md +2 -0
- data/docs/OrderResponseShippingContact.md +3 -1
- data/docs/OrderTaxRequest.md +1 -1
- data/docs/OrderUpdateFiscalEntityRequest.md +28 -0
- data/docs/OrderUpdateRequest.md +2 -0
- data/docs/PaymentLinkApi.md +1 -1
- data/docs/Product.md +3 -3
- data/docs/ShippingRequest.md +1 -1
- data/docs/TokenResponseCheckout.md +1 -1
- data/docs/TransactionsApi.md +9 -3
- data/docs/UpdateCustomer.md +1 -1
- data/docs/WebhookLog.md +1 -1
- data/docs/WebhookResponse.md +1 -1
- data/docs/WebhookUpdateRequest.md +2 -2
- data/lib/conekta/api/antifraud_api.rb +1 -1
- data/lib/conekta/api/api_keys_api.rb +1 -1
- data/lib/conekta/api/balances_api.rb +2 -2
- data/lib/conekta/api/charges_api.rb +83 -1
- data/lib/conekta/api/companies_api.rb +1 -1
- data/lib/conekta/api/customers_api.rb +1 -1
- data/lib/conekta/api/discounts_api.rb +1 -1
- data/lib/conekta/api/events_api.rb +1 -1
- data/lib/conekta/api/logs_api.rb +1 -1
- data/lib/conekta/api/orders_api.rb +1 -1
- data/lib/conekta/api/payment_link_api.rb +1 -1
- data/lib/conekta/api/payment_methods_api.rb +1 -1
- data/lib/conekta/api/plans_api.rb +1 -1
- data/lib/conekta/api/products_api.rb +1 -1
- data/lib/conekta/api/shipping_contacts_api.rb +1 -1
- data/lib/conekta/api/shippings_api.rb +1 -1
- data/lib/conekta/api/subscriptions_api.rb +1 -1
- data/lib/conekta/api/taxes_api.rb +1 -1
- data/lib/conekta/api/tokens_api.rb +1 -1
- data/lib/conekta/api/transactions_api.rb +13 -4
- data/lib/conekta/api/transfers_api.rb +1 -1
- data/lib/conekta/api/webhook_keys_api.rb +1 -1
- data/lib/conekta/api/webhooks_api.rb +1 -1
- data/lib/conekta/api_client.rb +39 -36
- data/lib/conekta/api_error.rb +1 -1
- data/lib/conekta/configuration.rb +13 -10
- data/lib/conekta/models/api_key_create_response.rb +14 -19
- data/lib/conekta/models/api_key_create_response_all_of.rb +14 -19
- data/lib/conekta/models/api_key_request.rb +16 -19
- data/lib/conekta/models/api_key_response.rb +14 -19
- data/lib/conekta/models/api_key_response_on_delete.rb +14 -19
- data/lib/conekta/models/api_key_update_request.rb +14 -19
- data/lib/conekta/models/balance_common_field.rb +14 -19
- data/lib/conekta/models/balance_response.rb +14 -19
- data/lib/conekta/models/blacklist_rule_response.rb +14 -19
- data/lib/conekta/models/charge_data_payment_method_bank_transfer_response.rb +14 -19
- data/lib/conekta/models/charge_data_payment_method_card_response.rb +14 -43
- data/lib/conekta/models/charge_data_payment_method_cash_response.rb +14 -19
- data/lib/conekta/models/charge_order_response.rb +15 -29
- data/lib/conekta/models/charge_order_response_payment_method.rb +1 -1
- data/lib/conekta/models/charge_request.rb +17 -30
- data/lib/conekta/models/charge_request_payment_method.rb +27 -44
- data/lib/conekta/models/charge_response.rb +15 -29
- data/lib/conekta/models/charge_response_channel.rb +14 -19
- data/lib/conekta/models/charge_response_payment_method.rb +1 -1
- data/lib/conekta/models/charge_response_refunds.rb +18 -19
- data/lib/conekta/models/charge_response_refunds_all_of.rb +14 -19
- data/lib/conekta/models/charge_response_refunds_data.rb +22 -19
- data/lib/conekta/models/charge_update_request.rb +216 -0
- data/lib/conekta/models/charges_data_response.rb +15 -29
- data/lib/conekta/models/checkout.rb +26 -19
- data/lib/conekta/models/checkout_order_template.rb +23 -20
- data/lib/conekta/models/checkout_order_template_customer_info.rb +2 -2
- data/lib/conekta/models/checkout_request.rb +16 -19
- data/lib/conekta/models/checkout_response.rb +22 -19
- data/lib/conekta/models/checkouts_response.rb +18 -19
- data/lib/conekta/models/checkouts_response_all_of.rb +14 -19
- data/lib/conekta/models/company_fiscal_info_address_response.rb +14 -19
- data/lib/conekta/models/company_fiscal_info_response.rb +14 -19
- data/lib/conekta/models/company_payout_destination_response.rb +14 -19
- data/lib/conekta/models/company_response.rb +14 -19
- data/lib/conekta/models/create_customer_fiscal_entities_response.rb +22 -19
- data/lib/conekta/models/create_customer_fiscal_entities_response_all_of.rb +20 -19
- data/lib/conekta/models/create_customer_payment_methods_request.rb +2 -2
- data/lib/conekta/models/create_customer_payment_methods_response.rb +1 -1
- data/lib/conekta/models/create_risk_rules_data.rb +20 -19
- data/lib/conekta/models/customer.rb +25 -20
- data/lib/conekta/models/customer_address.rb +22 -19
- data/lib/conekta/models/customer_antifraud_info.rb +14 -19
- data/lib/conekta/models/customer_antifraud_info_response.rb +14 -19
- data/lib/conekta/models/customer_fiscal_entities_data_response.rb +22 -19
- data/lib/conekta/models/customer_fiscal_entities_request.rb +16 -19
- data/lib/conekta/models/customer_fiscal_entities_request_address.rb +22 -19
- data/lib/conekta/models/customer_fiscal_entities_response.rb +18 -19
- data/lib/conekta/models/customer_fiscal_entities_response_all_of.rb +14 -19
- data/lib/conekta/models/customer_info.rb +20 -19
- data/lib/conekta/models/customer_info_just_customer_id.rb +16 -19
- data/lib/conekta/models/customer_info_just_customer_id_response.rb +14 -19
- data/lib/conekta/models/customer_payment_method_request.rb +16 -19
- data/lib/conekta/models/customer_payment_methods.rb +14 -19
- data/lib/conekta/models/customer_payment_methods_data.rb +1 -1
- data/lib/conekta/models/customer_payment_methods_request.rb +2 -2
- data/lib/conekta/models/customer_payment_methods_response.rb +18 -19
- data/lib/conekta/models/customer_response.rb +67 -20
- data/lib/conekta/models/customer_response_shipping_contacts.rb +18 -19
- data/lib/conekta/models/customer_response_shipping_contacts_all_of.rb +14 -19
- data/lib/conekta/models/customer_shipping_contacts.rb +52 -24
- data/lib/conekta/models/customer_shipping_contacts_address.rb +14 -19
- data/lib/conekta/models/customer_shipping_contacts_data_response.rb +54 -20
- data/lib/conekta/models/customer_shipping_contacts_data_response_all_of.rb +20 -19
- data/lib/conekta/models/customer_shipping_contacts_response.rb +46 -20
- data/lib/conekta/models/customer_shipping_contacts_response_address.rb +15 -19
- data/lib/conekta/models/customer_update_fiscal_entities_request.rb +14 -19
- data/lib/conekta/models/customer_update_shipping_contacts.rb +14 -19
- data/lib/conekta/models/customers_response.rb +18 -19
- data/lib/conekta/models/customers_response_all_of.rb +14 -19
- data/lib/conekta/models/delete_api_keys_response.rb +14 -19
- data/lib/conekta/models/delete_api_keys_response_all_of.rb +14 -19
- data/lib/conekta/models/deleted_blacklist_rule_response.rb +14 -19
- data/lib/conekta/models/deleted_whitelist_rule_response.rb +14 -19
- data/lib/conekta/models/details.rb +14 -19
- data/lib/conekta/models/details_error.rb +14 -19
- data/lib/conekta/models/discount_lines_data_response.rb +26 -19
- data/lib/conekta/models/discount_lines_response.rb +26 -19
- data/lib/conekta/models/discount_lines_response_all_of.rb +20 -19
- data/lib/conekta/models/email_checkout_request.rb +16 -19
- data/lib/conekta/models/error.rb +14 -19
- data/lib/conekta/models/error_all_of.rb +14 -19
- data/lib/conekta/models/event_response.rb +19 -20
- data/lib/conekta/models/events_resend_response.rb +19 -20
- data/lib/conekta/models/fiscal_entity_address.rb +312 -0
- data/lib/conekta/models/get_api_keys_response.rb +18 -19
- data/lib/conekta/models/get_api_keys_response_all_of.rb +14 -19
- data/lib/conekta/models/get_charges_response.rb +18 -19
- data/lib/conekta/models/get_charges_response_all_of.rb +14 -19
- data/lib/conekta/models/get_companies_response.rb +18 -19
- data/lib/conekta/models/get_companies_response_all_of.rb +14 -19
- data/lib/conekta/models/get_customer_payment_method_data_response.rb +1 -1
- data/lib/conekta/models/get_events_response.rb +18 -19
- data/lib/conekta/models/get_events_response_all_of.rb +14 -19
- data/lib/conekta/models/get_order_discount_lines_response.rb +18 -19
- data/lib/conekta/models/get_order_discount_lines_response_all_of.rb +14 -19
- data/lib/conekta/models/get_orders_response.rb +20 -19
- data/lib/conekta/models/get_payment_method_response.rb +18 -19
- data/lib/conekta/models/get_payment_method_response_all_of.rb +14 -19
- data/lib/conekta/models/get_plans_response.rb +18 -19
- data/lib/conekta/models/get_plans_response_all_of.rb +14 -19
- data/lib/conekta/models/get_transactions_response.rb +18 -19
- data/lib/conekta/models/get_transactions_response_all_of.rb +14 -19
- data/lib/conekta/models/get_transfers_response.rb +18 -19
- data/lib/conekta/models/get_transfers_response_all_of.rb +14 -19
- data/lib/conekta/models/get_webhook_keys_response.rb +18 -19
- data/lib/conekta/models/get_webhook_keys_response_all_of.rb +14 -19
- data/lib/conekta/models/get_webhooks_response.rb +18 -19
- data/lib/conekta/models/get_webhooks_response_all_of.rb +14 -19
- data/lib/conekta/models/log_response.rb +20 -19
- data/lib/conekta/models/logs_response.rb +14 -19
- data/lib/conekta/models/logs_response_data.rb +14 -19
- data/lib/conekta/models/order_capture_request.rb +16 -19
- data/lib/conekta/models/{customer_info_response.rb → order_customer_info_response.rb} +29 -23
- data/lib/conekta/models/order_discount_lines_request.rb +20 -19
- data/lib/conekta/models/{order_response_fiscal_entity_address.rb → order_fiscal_entity_address_response.rb} +48 -34
- data/lib/conekta/models/{order_response_fiscal_entity_address_all_of.rb → order_fiscal_entity_address_response_all_of.rb} +17 -22
- data/lib/conekta/models/order_fiscal_entity_request.rb +295 -0
- data/lib/conekta/models/order_fiscal_entity_response.rb +347 -0
- data/lib/conekta/models/{order_response_fiscal_entity.rb → order_next_action_response.rb} +32 -53
- data/lib/conekta/models/order_next_action_response_redirect_to_url.rb +226 -0
- data/lib/conekta/models/order_refund_request.rb +18 -19
- data/lib/conekta/models/order_request.rb +58 -24
- data/lib/conekta/models/order_request_customer_info.rb +2 -2
- data/lib/conekta/models/order_response.rb +31 -22
- data/lib/conekta/models/order_response_charges.rb +18 -19
- data/lib/conekta/models/order_response_charges_all_of.rb +14 -19
- data/lib/conekta/models/order_response_checkout.rb +19 -20
- data/lib/conekta/models/order_response_customer_info.rb +27 -21
- data/lib/conekta/models/order_response_customer_info_all_of.rb +14 -19
- data/lib/conekta/models/order_response_discount_lines.rb +18 -19
- data/lib/conekta/models/order_response_discount_lines_all_of.rb +14 -19
- data/lib/conekta/models/order_response_products.rb +18 -19
- data/lib/conekta/models/order_response_products_all_of.rb +14 -19
- data/lib/conekta/models/order_response_shipping_contact.rb +46 -20
- data/lib/conekta/models/order_response_shipping_contact_all_of.rb +14 -19
- data/lib/conekta/models/order_tax_request.rb +23 -20
- data/lib/conekta/models/order_update_fiscal_entity_request.rb +295 -0
- data/lib/conekta/models/order_update_request.rb +29 -21
- data/lib/conekta/models/order_update_request_customer_info.rb +2 -2
- data/lib/conekta/models/orders_response.rb +16 -19
- data/lib/conekta/models/page.rb +14 -19
- data/lib/conekta/models/pagination.rb +18 -19
- data/lib/conekta/models/payment_method.rb +16 -19
- data/lib/conekta/models/payment_method_bank_transfer.rb +16 -19
- data/lib/conekta/models/payment_method_card.rb +16 -43
- data/lib/conekta/models/payment_method_card_request.rb +18 -19
- data/lib/conekta/models/payment_method_card_request_all_of.rb +14 -19
- data/lib/conekta/models/payment_method_card_response.rb +22 -19
- data/lib/conekta/models/payment_method_card_response_all_of.rb +14 -19
- data/lib/conekta/models/payment_method_cash.rb +16 -19
- data/lib/conekta/models/payment_method_cash_request.rb +16 -19
- data/lib/conekta/models/payment_method_cash_request_all_of.rb +14 -19
- data/lib/conekta/models/payment_method_cash_response.rb +22 -19
- data/lib/conekta/models/payment_method_cash_response_all_of.rb +14 -19
- data/lib/conekta/models/payment_method_response.rb +22 -19
- data/lib/conekta/models/payment_method_spei_recurrent.rb +22 -19
- data/lib/conekta/models/payment_method_spei_recurrent_all_of.rb +14 -19
- data/lib/conekta/models/payment_method_spei_request.rb +16 -19
- data/lib/conekta/models/plan_request.rb +27 -20
- data/lib/conekta/models/plan_response.rb +19 -20
- data/lib/conekta/models/plan_update_request.rb +24 -21
- data/lib/conekta/models/product.rb +30 -21
- data/lib/conekta/models/product_data_response.rb +30 -21
- data/lib/conekta/models/product_data_response_all_of.rb +14 -19
- data/lib/conekta/models/product_order_response.rb +30 -21
- data/lib/conekta/models/product_order_response_all_of.rb +14 -19
- data/lib/conekta/models/risk_rules.rb +14 -19
- data/lib/conekta/models/risk_rules_data.rb +14 -19
- data/lib/conekta/models/risk_rules_list.rb +18 -19
- data/lib/conekta/models/shipping_order_response.rb +21 -20
- data/lib/conekta/models/shipping_request.rb +21 -20
- data/lib/conekta/models/sms_checkout_request.rb +16 -19
- data/lib/conekta/models/subscription_events_response.rb +18 -19
- data/lib/conekta/models/subscription_request.rb +16 -19
- data/lib/conekta/models/subscription_response.rb +14 -19
- data/lib/conekta/models/subscription_update_request.rb +14 -19
- data/lib/conekta/models/token.rb +14 -19
- data/lib/conekta/models/token_card.rb +24 -19
- data/lib/conekta/models/token_checkout.rb +14 -19
- data/lib/conekta/models/token_response.rb +22 -19
- data/lib/conekta/models/token_response_checkout.rb +14 -19
- data/lib/conekta/models/transaction_response.rb +36 -19
- data/lib/conekta/models/transfer_destination_response.rb +14 -19
- data/lib/conekta/models/transfer_method_response.rb +14 -19
- data/lib/conekta/models/transfer_response.rb +19 -20
- data/lib/conekta/models/transfers_response.rb +19 -20
- data/lib/conekta/models/update_customer.rb +19 -20
- data/lib/conekta/models/update_customer_antifraud_info.rb +14 -19
- data/lib/conekta/models/update_customer_fiscal_entities_response.rb +22 -19
- data/lib/conekta/models/update_customer_fiscal_entities_response_all_of.rb +20 -19
- data/lib/conekta/models/update_customer_payment_methods_response.rb +1 -1
- data/lib/conekta/models/update_order_discount_lines_request.rb +19 -20
- data/lib/conekta/models/update_order_tax_request.rb +29 -22
- data/lib/conekta/models/update_order_tax_response.rb +25 -20
- data/lib/conekta/models/update_order_tax_response_all_of.rb +14 -19
- data/lib/conekta/models/update_payment_methods.rb +14 -19
- data/lib/conekta/models/update_product.rb +29 -22
- data/lib/conekta/models/webhook_key_create_response.rb +14 -19
- data/lib/conekta/models/webhook_key_delete_response.rb +14 -19
- data/lib/conekta/models/webhook_key_request.rb +14 -19
- data/lib/conekta/models/webhook_key_response.rb +14 -19
- data/lib/conekta/models/webhook_key_update_request.rb +14 -19
- data/lib/conekta/models/webhook_log.rb +19 -20
- data/lib/conekta/models/webhook_request.rb +16 -19
- data/lib/conekta/models/webhook_response.rb +14 -19
- data/lib/conekta/models/webhook_update_request.rb +24 -27
- data/lib/conekta/models/whitelistlist_rule_response.rb +14 -19
- data/lib/conekta/version.rb +2 -2
- data/lib/conekta.rb +11 -5
- data/spec/api/orders_api_spec.rb +27 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -8
- data/ssl_data/ca_bundle.crt +4039 -0
- data/templates/ruby/CUSTOM_VERSION.mustache +1 -0
- data/templates/ruby/api_client.mustache +256 -0
- data/templates/ruby/configuration.mustache +481 -0
- metadata +46 -29
- data/docs/OrderResponseFiscalEntity.md +0 -24
- data/docs/OrderResponseFiscalEntityAddress.md +0 -34
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 2.1.0
|
7
7
|
Contact: engineering@conekta.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -68,6 +68,8 @@ module Conekta
|
|
68
68
|
|
69
69
|
if attributes.key?(:'plan_id')
|
70
70
|
self.plan_id = attributes[:'plan_id']
|
71
|
+
else
|
72
|
+
self.plan_id = nil
|
71
73
|
end
|
72
74
|
|
73
75
|
if attributes.key?(:'card_id')
|
@@ -82,6 +84,7 @@ module Conekta
|
|
82
84
|
# Show invalid properties with the reasons. Usually used together with valid?
|
83
85
|
# @return Array for valid properties with the reasons
|
84
86
|
def list_invalid_properties
|
87
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
85
88
|
invalid_properties = Array.new
|
86
89
|
if @plan_id.nil?
|
87
90
|
invalid_properties.push('invalid value for "plan_id", plan_id cannot be nil.')
|
@@ -93,6 +96,7 @@ module Conekta
|
|
93
96
|
# Check to see if the all the properties in the model are valid
|
94
97
|
# @return true if the model is valid
|
95
98
|
def valid?
|
99
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
96
100
|
return false if @plan_id.nil?
|
97
101
|
true
|
98
102
|
end
|
@@ -123,37 +127,30 @@ module Conekta
|
|
123
127
|
# @param [Hash] attributes Model attributes in the form of hash
|
124
128
|
# @return [Object] Returns the model itself
|
125
129
|
def self.build_from_hash(attributes)
|
126
|
-
new.build_from_hash(attributes)
|
127
|
-
end
|
128
|
-
|
129
|
-
# Builds the object from hash
|
130
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
-
# @return [Object] Returns the model itself
|
132
|
-
def build_from_hash(attributes)
|
133
130
|
return nil unless attributes.is_a?(Hash)
|
134
131
|
attributes = attributes.transform_keys(&:to_sym)
|
135
|
-
|
136
|
-
|
137
|
-
|
132
|
+
transformed_hash = {}
|
133
|
+
openapi_types.each_pair do |key, type|
|
134
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = nil
|
138
136
|
elsif type =~ /\AArray<(.*)>/i
|
139
137
|
# check to ensure the input is an array given that the attribute
|
140
138
|
# is documented as an array but the input is not
|
141
|
-
if attributes[
|
142
|
-
|
139
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
140
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
143
141
|
end
|
144
|
-
elsif !attributes[
|
145
|
-
|
142
|
+
elsif !attributes[attribute_map[key]].nil?
|
143
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
146
144
|
end
|
147
145
|
end
|
148
|
-
|
149
|
-
self
|
146
|
+
new(transformed_hash)
|
150
147
|
end
|
151
148
|
|
152
149
|
# Deserializes the data based on type
|
153
150
|
# @param string type Data type
|
154
151
|
# @param string value Value to be deserialized
|
155
152
|
# @return [Object] Deserialized data
|
156
|
-
def _deserialize(type, value)
|
153
|
+
def self._deserialize(type, value)
|
157
154
|
case type.to_sym
|
158
155
|
when :Time
|
159
156
|
Time.parse(value)
|
@@ -188,7 +185,7 @@ module Conekta
|
|
188
185
|
else # model
|
189
186
|
# models (e.g. Pet) or oneOf
|
190
187
|
klass = Conekta.const_get(type)
|
191
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
188
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
192
189
|
end
|
193
190
|
end
|
194
191
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 2.1.0
|
7
7
|
Contact: engineering@conekta.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -201,6 +201,7 @@ module Conekta
|
|
201
201
|
# Show invalid properties with the reasons. Usually used together with valid?
|
202
202
|
# @return Array for valid properties with the reasons
|
203
203
|
def list_invalid_properties
|
204
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
204
205
|
invalid_properties = Array.new
|
205
206
|
invalid_properties
|
206
207
|
end
|
@@ -208,6 +209,7 @@ module Conekta
|
|
208
209
|
# Check to see if the all the properties in the model are valid
|
209
210
|
# @return true if the model is valid
|
210
211
|
def valid?
|
212
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
211
213
|
true
|
212
214
|
end
|
213
215
|
|
@@ -251,37 +253,30 @@ module Conekta
|
|
251
253
|
# @param [Hash] attributes Model attributes in the form of hash
|
252
254
|
# @return [Object] Returns the model itself
|
253
255
|
def self.build_from_hash(attributes)
|
254
|
-
new.build_from_hash(attributes)
|
255
|
-
end
|
256
|
-
|
257
|
-
# Builds the object from hash
|
258
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
259
|
-
# @return [Object] Returns the model itself
|
260
|
-
def build_from_hash(attributes)
|
261
256
|
return nil unless attributes.is_a?(Hash)
|
262
257
|
attributes = attributes.transform_keys(&:to_sym)
|
263
|
-
|
264
|
-
|
265
|
-
|
258
|
+
transformed_hash = {}
|
259
|
+
openapi_types.each_pair do |key, type|
|
260
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
261
|
+
transformed_hash["#{key}"] = nil
|
266
262
|
elsif type =~ /\AArray<(.*)>/i
|
267
263
|
# check to ensure the input is an array given that the attribute
|
268
264
|
# is documented as an array but the input is not
|
269
|
-
if attributes[
|
270
|
-
|
265
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
266
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
271
267
|
end
|
272
|
-
elsif !attributes[
|
273
|
-
|
268
|
+
elsif !attributes[attribute_map[key]].nil?
|
269
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
274
270
|
end
|
275
271
|
end
|
276
|
-
|
277
|
-
self
|
272
|
+
new(transformed_hash)
|
278
273
|
end
|
279
274
|
|
280
275
|
# Deserializes the data based on type
|
281
276
|
# @param string type Data type
|
282
277
|
# @param string value Value to be deserialized
|
283
278
|
# @return [Object] Deserialized data
|
284
|
-
def _deserialize(type, value)
|
279
|
+
def self._deserialize(type, value)
|
285
280
|
case type.to_sym
|
286
281
|
when :Time
|
287
282
|
Time.parse(value)
|
@@ -316,7 +311,7 @@ module Conekta
|
|
316
311
|
else # model
|
317
312
|
# models (e.g. Pet) or oneOf
|
318
313
|
klass = Conekta.const_get(type)
|
319
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
314
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
320
315
|
end
|
321
316
|
end
|
322
317
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 2.1.0
|
7
7
|
Contact: engineering@conekta.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -82,6 +82,7 @@ module Conekta
|
|
82
82
|
# Show invalid properties with the reasons. Usually used together with valid?
|
83
83
|
# @return Array for valid properties with the reasons
|
84
84
|
def list_invalid_properties
|
85
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
85
86
|
invalid_properties = Array.new
|
86
87
|
invalid_properties
|
87
88
|
end
|
@@ -89,6 +90,7 @@ module Conekta
|
|
89
90
|
# Check to see if the all the properties in the model are valid
|
90
91
|
# @return true if the model is valid
|
91
92
|
def valid?
|
93
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
92
94
|
true
|
93
95
|
end
|
94
96
|
|
@@ -118,37 +120,30 @@ module Conekta
|
|
118
120
|
# @param [Hash] attributes Model attributes in the form of hash
|
119
121
|
# @return [Object] Returns the model itself
|
120
122
|
def self.build_from_hash(attributes)
|
121
|
-
new.build_from_hash(attributes)
|
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
123
|
return nil unless attributes.is_a?(Hash)
|
129
124
|
attributes = attributes.transform_keys(&:to_sym)
|
130
|
-
|
131
|
-
|
132
|
-
|
125
|
+
transformed_hash = {}
|
126
|
+
openapi_types.each_pair do |key, type|
|
127
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
128
|
+
transformed_hash["#{key}"] = nil
|
133
129
|
elsif type =~ /\AArray<(.*)>/i
|
134
130
|
# check to ensure the input is an array given that the attribute
|
135
131
|
# is documented as an array but the input is not
|
136
|
-
if attributes[
|
137
|
-
|
132
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
133
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
138
134
|
end
|
139
|
-
elsif !attributes[
|
140
|
-
|
135
|
+
elsif !attributes[attribute_map[key]].nil?
|
136
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
141
137
|
end
|
142
138
|
end
|
143
|
-
|
144
|
-
self
|
139
|
+
new(transformed_hash)
|
145
140
|
end
|
146
141
|
|
147
142
|
# Deserializes the data based on type
|
148
143
|
# @param string type Data type
|
149
144
|
# @param string value Value to be deserialized
|
150
145
|
# @return [Object] Deserialized data
|
151
|
-
def _deserialize(type, value)
|
146
|
+
def self._deserialize(type, value)
|
152
147
|
case type.to_sym
|
153
148
|
when :Time
|
154
149
|
Time.parse(value)
|
@@ -183,7 +178,7 @@ module Conekta
|
|
183
178
|
else # model
|
184
179
|
# models (e.g. Pet) or oneOf
|
185
180
|
klass = Conekta.const_get(type)
|
186
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
181
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
187
182
|
end
|
188
183
|
end
|
189
184
|
|
data/lib/conekta/models/token.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 2.1.0
|
7
7
|
Contact: engineering@conekta.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -76,6 +76,7 @@ module Conekta
|
|
76
76
|
# Show invalid properties with the reasons. Usually used together with valid?
|
77
77
|
# @return Array for valid properties with the reasons
|
78
78
|
def list_invalid_properties
|
79
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
79
80
|
invalid_properties = Array.new
|
80
81
|
invalid_properties
|
81
82
|
end
|
@@ -83,6 +84,7 @@ module Conekta
|
|
83
84
|
# Check to see if the all the properties in the model are valid
|
84
85
|
# @return true if the model is valid
|
85
86
|
def valid?
|
87
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
86
88
|
true
|
87
89
|
end
|
88
90
|
|
@@ -111,37 +113,30 @@ module Conekta
|
|
111
113
|
# @param [Hash] attributes Model attributes in the form of hash
|
112
114
|
# @return [Object] Returns the model itself
|
113
115
|
def self.build_from_hash(attributes)
|
114
|
-
new.build_from_hash(attributes)
|
115
|
-
end
|
116
|
-
|
117
|
-
# Builds the object from hash
|
118
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
-
# @return [Object] Returns the model itself
|
120
|
-
def build_from_hash(attributes)
|
121
116
|
return nil unless attributes.is_a?(Hash)
|
122
117
|
attributes = attributes.transform_keys(&:to_sym)
|
123
|
-
|
124
|
-
|
125
|
-
|
118
|
+
transformed_hash = {}
|
119
|
+
openapi_types.each_pair do |key, type|
|
120
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
121
|
+
transformed_hash["#{key}"] = nil
|
126
122
|
elsif type =~ /\AArray<(.*)>/i
|
127
123
|
# check to ensure the input is an array given that the attribute
|
128
124
|
# is documented as an array but the input is not
|
129
|
-
if attributes[
|
130
|
-
|
125
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
126
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
131
127
|
end
|
132
|
-
elsif !attributes[
|
133
|
-
|
128
|
+
elsif !attributes[attribute_map[key]].nil?
|
129
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
134
130
|
end
|
135
131
|
end
|
136
|
-
|
137
|
-
self
|
132
|
+
new(transformed_hash)
|
138
133
|
end
|
139
134
|
|
140
135
|
# Deserializes the data based on type
|
141
136
|
# @param string type Data type
|
142
137
|
# @param string value Value to be deserialized
|
143
138
|
# @return [Object] Deserialized data
|
144
|
-
def _deserialize(type, value)
|
139
|
+
def self._deserialize(type, value)
|
145
140
|
case type.to_sym
|
146
141
|
when :Time
|
147
142
|
Time.parse(value)
|
@@ -176,7 +171,7 @@ module Conekta
|
|
176
171
|
else # model
|
177
172
|
# models (e.g. Pet) or oneOf
|
178
173
|
klass = Conekta.const_get(type)
|
179
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
174
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
180
175
|
end
|
181
176
|
end
|
182
177
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 2.1.0
|
7
7
|
Contact: engineering@conekta.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -85,6 +85,8 @@ module Conekta
|
|
85
85
|
|
86
86
|
if attributes.key?(:'cvc')
|
87
87
|
self.cvc = attributes[:'cvc']
|
88
|
+
else
|
89
|
+
self.cvc = nil
|
88
90
|
end
|
89
91
|
|
90
92
|
if attributes.key?(:'device_fingerprint')
|
@@ -93,24 +95,33 @@ module Conekta
|
|
93
95
|
|
94
96
|
if attributes.key?(:'exp_month')
|
95
97
|
self.exp_month = attributes[:'exp_month']
|
98
|
+
else
|
99
|
+
self.exp_month = nil
|
96
100
|
end
|
97
101
|
|
98
102
|
if attributes.key?(:'exp_year')
|
99
103
|
self.exp_year = attributes[:'exp_year']
|
104
|
+
else
|
105
|
+
self.exp_year = nil
|
100
106
|
end
|
101
107
|
|
102
108
|
if attributes.key?(:'name')
|
103
109
|
self.name = attributes[:'name']
|
110
|
+
else
|
111
|
+
self.name = nil
|
104
112
|
end
|
105
113
|
|
106
114
|
if attributes.key?(:'number')
|
107
115
|
self.number = attributes[:'number']
|
116
|
+
else
|
117
|
+
self.number = nil
|
108
118
|
end
|
109
119
|
end
|
110
120
|
|
111
121
|
# Show invalid properties with the reasons. Usually used together with valid?
|
112
122
|
# @return Array for valid properties with the reasons
|
113
123
|
def list_invalid_properties
|
124
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
114
125
|
invalid_properties = Array.new
|
115
126
|
if @cvc.nil?
|
116
127
|
invalid_properties.push('invalid value for "cvc", cvc cannot be nil.')
|
@@ -150,6 +161,7 @@ module Conekta
|
|
150
161
|
# Check to see if the all the properties in the model are valid
|
151
162
|
# @return true if the model is valid
|
152
163
|
def valid?
|
164
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
153
165
|
return false if @cvc.nil?
|
154
166
|
return false if @cvc.to_s.length > 4
|
155
167
|
return false if @exp_month.nil?
|
@@ -232,37 +244,30 @@ module Conekta
|
|
232
244
|
# @param [Hash] attributes Model attributes in the form of hash
|
233
245
|
# @return [Object] Returns the model itself
|
234
246
|
def self.build_from_hash(attributes)
|
235
|
-
new.build_from_hash(attributes)
|
236
|
-
end
|
237
|
-
|
238
|
-
# Builds the object from hash
|
239
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
240
|
-
# @return [Object] Returns the model itself
|
241
|
-
def build_from_hash(attributes)
|
242
247
|
return nil unless attributes.is_a?(Hash)
|
243
248
|
attributes = attributes.transform_keys(&:to_sym)
|
244
|
-
|
245
|
-
|
246
|
-
|
249
|
+
transformed_hash = {}
|
250
|
+
openapi_types.each_pair do |key, type|
|
251
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
252
|
+
transformed_hash["#{key}"] = nil
|
247
253
|
elsif type =~ /\AArray<(.*)>/i
|
248
254
|
# check to ensure the input is an array given that the attribute
|
249
255
|
# is documented as an array but the input is not
|
250
|
-
if attributes[
|
251
|
-
|
256
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
257
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
252
258
|
end
|
253
|
-
elsif !attributes[
|
254
|
-
|
259
|
+
elsif !attributes[attribute_map[key]].nil?
|
260
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
255
261
|
end
|
256
262
|
end
|
257
|
-
|
258
|
-
self
|
263
|
+
new(transformed_hash)
|
259
264
|
end
|
260
265
|
|
261
266
|
# Deserializes the data based on type
|
262
267
|
# @param string type Data type
|
263
268
|
# @param string value Value to be deserialized
|
264
269
|
# @return [Object] Deserialized data
|
265
|
-
def _deserialize(type, value)
|
270
|
+
def self._deserialize(type, value)
|
266
271
|
case type.to_sym
|
267
272
|
when :Time
|
268
273
|
Time.parse(value)
|
@@ -297,7 +302,7 @@ module Conekta
|
|
297
302
|
else # model
|
298
303
|
# models (e.g. Pet) or oneOf
|
299
304
|
klass = Conekta.const_get(type)
|
300
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
305
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
301
306
|
end
|
302
307
|
end
|
303
308
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 2.1.0
|
7
7
|
Contact: engineering@conekta.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -66,6 +66,7 @@ module Conekta
|
|
66
66
|
# Show invalid properties with the reasons. Usually used together with valid?
|
67
67
|
# @return Array for valid properties with the reasons
|
68
68
|
def list_invalid_properties
|
69
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
69
70
|
invalid_properties = Array.new
|
70
71
|
invalid_properties
|
71
72
|
end
|
@@ -73,6 +74,7 @@ module Conekta
|
|
73
74
|
# Check to see if the all the properties in the model are valid
|
74
75
|
# @return true if the model is valid
|
75
76
|
def valid?
|
77
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
76
78
|
true
|
77
79
|
end
|
78
80
|
|
@@ -100,37 +102,30 @@ module Conekta
|
|
100
102
|
# @param [Hash] attributes Model attributes in the form of hash
|
101
103
|
# @return [Object] Returns the model itself
|
102
104
|
def self.build_from_hash(attributes)
|
103
|
-
new.build_from_hash(attributes)
|
104
|
-
end
|
105
|
-
|
106
|
-
# Builds the object from hash
|
107
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
-
# @return [Object] Returns the model itself
|
109
|
-
def build_from_hash(attributes)
|
110
105
|
return nil unless attributes.is_a?(Hash)
|
111
106
|
attributes = attributes.transform_keys(&:to_sym)
|
112
|
-
|
113
|
-
|
114
|
-
|
107
|
+
transformed_hash = {}
|
108
|
+
openapi_types.each_pair do |key, type|
|
109
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
110
|
+
transformed_hash["#{key}"] = nil
|
115
111
|
elsif type =~ /\AArray<(.*)>/i
|
116
112
|
# check to ensure the input is an array given that the attribute
|
117
113
|
# is documented as an array but the input is not
|
118
|
-
if attributes[
|
119
|
-
|
114
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
115
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
120
116
|
end
|
121
|
-
elsif !attributes[
|
122
|
-
|
117
|
+
elsif !attributes[attribute_map[key]].nil?
|
118
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
123
119
|
end
|
124
120
|
end
|
125
|
-
|
126
|
-
self
|
121
|
+
new(transformed_hash)
|
127
122
|
end
|
128
123
|
|
129
124
|
# Deserializes the data based on type
|
130
125
|
# @param string type Data type
|
131
126
|
# @param string value Value to be deserialized
|
132
127
|
# @return [Object] Deserialized data
|
133
|
-
def _deserialize(type, value)
|
128
|
+
def self._deserialize(type, value)
|
134
129
|
case type.to_sym
|
135
130
|
when :Time
|
136
131
|
Time.parse(value)
|
@@ -165,7 +160,7 @@ module Conekta
|
|
165
160
|
else # model
|
166
161
|
# models (e.g. Pet) or oneOf
|
167
162
|
klass = Conekta.const_get(type)
|
168
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
163
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
169
164
|
end
|
170
165
|
end
|
171
166
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 2.1.0
|
7
7
|
Contact: engineering@conekta.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -85,24 +85,33 @@ module Conekta
|
|
85
85
|
|
86
86
|
if attributes.key?(:'id')
|
87
87
|
self.id = attributes[:'id']
|
88
|
+
else
|
89
|
+
self.id = nil
|
88
90
|
end
|
89
91
|
|
90
92
|
if attributes.key?(:'livemode')
|
91
93
|
self.livemode = attributes[:'livemode']
|
94
|
+
else
|
95
|
+
self.livemode = nil
|
92
96
|
end
|
93
97
|
|
94
98
|
if attributes.key?(:'object')
|
95
99
|
self.object = attributes[:'object']
|
100
|
+
else
|
101
|
+
self.object = nil
|
96
102
|
end
|
97
103
|
|
98
104
|
if attributes.key?(:'used')
|
99
105
|
self.used = attributes[:'used']
|
106
|
+
else
|
107
|
+
self.used = nil
|
100
108
|
end
|
101
109
|
end
|
102
110
|
|
103
111
|
# Show invalid properties with the reasons. Usually used together with valid?
|
104
112
|
# @return Array for valid properties with the reasons
|
105
113
|
def list_invalid_properties
|
114
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
106
115
|
invalid_properties = Array.new
|
107
116
|
if @id.nil?
|
108
117
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
@@ -126,6 +135,7 @@ module Conekta
|
|
126
135
|
# Check to see if the all the properties in the model are valid
|
127
136
|
# @return true if the model is valid
|
128
137
|
def valid?
|
138
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
129
139
|
return false if @id.nil?
|
130
140
|
return false if @livemode.nil?
|
131
141
|
return false if @object.nil?
|
@@ -161,37 +171,30 @@ module Conekta
|
|
161
171
|
# @param [Hash] attributes Model attributes in the form of hash
|
162
172
|
# @return [Object] Returns the model itself
|
163
173
|
def self.build_from_hash(attributes)
|
164
|
-
new.build_from_hash(attributes)
|
165
|
-
end
|
166
|
-
|
167
|
-
# Builds the object from hash
|
168
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
169
|
-
# @return [Object] Returns the model itself
|
170
|
-
def build_from_hash(attributes)
|
171
174
|
return nil unless attributes.is_a?(Hash)
|
172
175
|
attributes = attributes.transform_keys(&:to_sym)
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
+
transformed_hash = {}
|
177
|
+
openapi_types.each_pair do |key, type|
|
178
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
179
|
+
transformed_hash["#{key}"] = nil
|
176
180
|
elsif type =~ /\AArray<(.*)>/i
|
177
181
|
# check to ensure the input is an array given that the attribute
|
178
182
|
# is documented as an array but the input is not
|
179
|
-
if attributes[
|
180
|
-
|
183
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
184
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
181
185
|
end
|
182
|
-
elsif !attributes[
|
183
|
-
|
186
|
+
elsif !attributes[attribute_map[key]].nil?
|
187
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
184
188
|
end
|
185
189
|
end
|
186
|
-
|
187
|
-
self
|
190
|
+
new(transformed_hash)
|
188
191
|
end
|
189
192
|
|
190
193
|
# Deserializes the data based on type
|
191
194
|
# @param string type Data type
|
192
195
|
# @param string value Value to be deserialized
|
193
196
|
# @return [Object] Deserialized data
|
194
|
-
def _deserialize(type, value)
|
197
|
+
def self._deserialize(type, value)
|
195
198
|
case type.to_sym
|
196
199
|
when :Time
|
197
200
|
Time.parse(value)
|
@@ -226,7 +229,7 @@ module Conekta
|
|
226
229
|
else # model
|
227
230
|
# models (e.g. Pet) or oneOf
|
228
231
|
klass = Conekta.const_get(type)
|
229
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
232
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
230
233
|
end
|
231
234
|
end
|
232
235
|
|