diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..36bd035 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# see http://editorconfig.org/ + +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +insert_final_newline = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fa7b027 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# may be useful in hiding large schema changes in pull request diffs (but not +# using it for now) +spec/*.json binary +spec/*.yaml binary diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..c607bb4 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @fcarrero @macuartin @agatto-conekta @fernandosaenzconekta @ezerozen diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index fc5c1a8..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "bundler" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "daily" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..fe24b36 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,52 @@ +name: CI + +on: + workflow_dispatch: {} + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + - name: Lint + run: bundle install + - name: Build + run: gem build conekta.gemspec + + test: + name: Test (${{ matrix.ruby-version }}) + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: [2.6, 2.7, '3.0', 3.1, 3.2] + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + - name: install + run: bundle install + - name: Run Mockoon CLI + uses: mockoon/cli-action@v1 + with: + version: 'latest' + data-file: 'https://raw.githubusercontent.com/conekta/openapi/20230801/mocks/conekta_api.json' + port: 3000 + - name: test + run: make ci-test + env: + BASE_PATH: http://localhost:3000 + diff --git a/.github/workflows/PUBLISH.yml b/.github/workflows/PUBLISH.yml new file mode 100644 index 0000000..7619330 --- /dev/null +++ b/.github/workflows/PUBLISH.yml @@ -0,0 +1,40 @@ +name: PUBLISH +on: + release: + types: [created] + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + steps: + - name: Check if release creator is a code owner + run: | + if [[ $(jq '.sender.type' $GITHUB_EVENT_PATH) == '"User"' ]]; then + creator_login=${{ github.event.release.author.login }} + if ! grep -q $creator_login .github/CODEOWNERS; then + echo "Release creator is not a code owner, skipping the rest of the workflow." + exit 1 + fi + fi + - name: Validate release version + run: | + tag_name=${{ github.event.release.tag_name }} + version=$(cat VERSION) + if [ $tag_name != $version ]; then + echo "Release tag_name is not the same that in file VERSION" + exit 1 + fi + - name: Download all workflow run artifacts + uses: actions/download-artifact@v3 + with: + name: gems + path: gems + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + - name: Publish gems to Rubygems + run: gem push gems/*.gem + env: + GEM_HOST_API_KEY: ${{secrets.GEM_HOST_API_KEY}} diff --git a/.gitignore b/.gitignore index 9c041e8..eb97996 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,45 @@ +# Generated by: https://openapi-generator.tech +# + *.gem *.rbc -.bundle -.config -.yardoc -.byebug_history +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: Gemfile.lock -InstalledFiles -_yardoc -coverage -doc/ -lib/bundler/man -pkg -rdoc -spec/reports -test/tmp -test/version_tmp -tmp -bin/ +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc + +/conekta-*.gem +/Gemfile.lock tags -*.swp -*.un~ -.byebug_history +coverage/ +.idea/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3a253c4 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,26 @@ +.ruby: &ruby + variables: + LANG: "C.UTF-8" + before_script: + - ruby -v + - bundle config set --local deployment true + - bundle install -j $(nproc) + parallel: + matrix: + - RUBY_VERSION: ['2.7', '3.0', '3.1'] + image: "ruby:$RUBY_VERSION" + cache: + paths: + - vendor/ruby + key: 'ruby-$RUBY_VERSION' + +gem: + extends: .ruby + script: + - bundle exec rspec + - bundle exec rake build + - bundle exec rake install + artifacts: + paths: + - pkg/*.gem + diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..5c789b0 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,27 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md + +git_push.sh +.gitignore +.travis.yml diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..f0197a9 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,474 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +AUTHORS.md +CODE_OF_CONDUCT.md +CONTRIBUTING.md +Gemfile +LICENSE +README.md +Rakefile +VERSION +conekta.gemspec +conekta.png +docs/AntifraudApi.md +docs/ApiKeyCreateResponse.md +docs/ApiKeyCreateResponseAllOf.md +docs/ApiKeyRequest.md +docs/ApiKeyResponse.md +docs/ApiKeyResponseOnDelete.md +docs/ApiKeyUpdateRequest.md +docs/ApiKeysApi.md +docs/BalanceCommonField.md +docs/BalanceResponse.md +docs/BalancesApi.md +docs/BlacklistRuleResponse.md +docs/ChargeDataPaymentMethodBankTransferResponse.md +docs/ChargeDataPaymentMethodCardResponse.md +docs/ChargeDataPaymentMethodCashResponse.md +docs/ChargeOrderResponse.md +docs/ChargeOrderResponsePaymentMethod.md +docs/ChargeRequest.md +docs/ChargeRequestPaymentMethod.md +docs/ChargeResponse.md +docs/ChargeResponseChannel.md +docs/ChargeResponsePaymentMethod.md +docs/ChargeResponseRefunds.md +docs/ChargeResponseRefundsAllOf.md +docs/ChargeResponseRefundsData.md +docs/ChargesApi.md +docs/ChargesDataResponse.md +docs/Checkout.md +docs/CheckoutOrderTemplate.md +docs/CheckoutOrderTemplateCustomerInfo.md +docs/CheckoutRequest.md +docs/CheckoutResponse.md +docs/CheckoutsResponse.md +docs/CheckoutsResponseAllOf.md +docs/CompaniesApi.md +docs/CompanyFiscalInfoAddressResponse.md +docs/CompanyFiscalInfoResponse.md +docs/CompanyPayoutDestinationResponse.md +docs/CompanyResponse.md +docs/CreateCustomerFiscalEntitiesResponse.md +docs/CreateCustomerFiscalEntitiesResponseAllOf.md +docs/CreateCustomerPaymentMethodsRequest.md +docs/CreateCustomerPaymentMethodsResponse.md +docs/CreateRiskRulesData.md +docs/Customer.md +docs/CustomerAddress.md +docs/CustomerAntifraudInfo.md +docs/CustomerAntifraudInfoResponse.md +docs/CustomerFiscalEntitiesDataResponse.md +docs/CustomerFiscalEntitiesRequest.md +docs/CustomerFiscalEntitiesRequestAddress.md +docs/CustomerFiscalEntitiesResponse.md +docs/CustomerFiscalEntitiesResponseAllOf.md +docs/CustomerInfo.md +docs/CustomerInfoJustCustomerId.md +docs/CustomerInfoJustCustomerIdResponse.md +docs/CustomerInfoResponse.md +docs/CustomerPaymentMethodRequest.md +docs/CustomerPaymentMethods.md +docs/CustomerPaymentMethodsData.md +docs/CustomerPaymentMethodsRequest.md +docs/CustomerPaymentMethodsResponse.md +docs/CustomerResponse.md +docs/CustomerResponseShippingContacts.md +docs/CustomerResponseShippingContactsAllOf.md +docs/CustomerShippingContacts.md +docs/CustomerShippingContactsAddress.md +docs/CustomerShippingContactsDataResponse.md +docs/CustomerShippingContactsDataResponseAllOf.md +docs/CustomerShippingContactsResponse.md +docs/CustomerShippingContactsResponseAddress.md +docs/CustomerUpdateFiscalEntitiesRequest.md +docs/CustomerUpdateShippingContacts.md +docs/CustomersApi.md +docs/CustomersResponse.md +docs/CustomersResponseAllOf.md +docs/DeleteApiKeysResponse.md +docs/DeleteApiKeysResponseAllOf.md +docs/DeletedBlacklistRuleResponse.md +docs/DeletedWhitelistRuleResponse.md +docs/Details.md +docs/DetailsError.md +docs/DiscountLinesDataResponse.md +docs/DiscountLinesResponse.md +docs/DiscountLinesResponseAllOf.md +docs/DiscountsApi.md +docs/EmailCheckoutRequest.md +docs/Error.md +docs/ErrorAllOf.md +docs/EventResponse.md +docs/EventsApi.md +docs/EventsResendResponse.md +docs/GetApiKeysResponse.md +docs/GetApiKeysResponseAllOf.md +docs/GetChargesResponse.md +docs/GetChargesResponseAllOf.md +docs/GetCompaniesResponse.md +docs/GetCompaniesResponseAllOf.md +docs/GetCustomerPaymentMethodDataResponse.md +docs/GetEventsResponse.md +docs/GetEventsResponseAllOf.md +docs/GetOrderDiscountLinesResponse.md +docs/GetOrderDiscountLinesResponseAllOf.md +docs/GetOrdersResponse.md +docs/GetPaymentMethodResponse.md +docs/GetPaymentMethodResponseAllOf.md +docs/GetPlansResponse.md +docs/GetPlansResponseAllOf.md +docs/GetTransactionsResponse.md +docs/GetTransactionsResponseAllOf.md +docs/GetTransfersResponse.md +docs/GetTransfersResponseAllOf.md +docs/GetWebhookKeysResponse.md +docs/GetWebhookKeysResponseAllOf.md +docs/GetWebhooksResponse.md +docs/GetWebhooksResponseAllOf.md +docs/LogResponse.md +docs/LogsApi.md +docs/LogsResponse.md +docs/LogsResponseData.md +docs/OrderCaptureRequest.md +docs/OrderDiscountLinesRequest.md +docs/OrderRefundRequest.md +docs/OrderRequest.md +docs/OrderRequestCustomerInfo.md +docs/OrderResponse.md +docs/OrderResponseCharges.md +docs/OrderResponseChargesAllOf.md +docs/OrderResponseCheckout.md +docs/OrderResponseCustomerInfo.md +docs/OrderResponseCustomerInfoAllOf.md +docs/OrderResponseDiscountLines.md +docs/OrderResponseDiscountLinesAllOf.md +docs/OrderResponseFiscalEntity.md +docs/OrderResponseFiscalEntityAddress.md +docs/OrderResponseFiscalEntityAddressAllOf.md +docs/OrderResponseProducts.md +docs/OrderResponseProductsAllOf.md +docs/OrderResponseShippingContact.md +docs/OrderResponseShippingContactAllOf.md +docs/OrderTaxRequest.md +docs/OrderUpdateRequest.md +docs/OrderUpdateRequestCustomerInfo.md +docs/OrdersApi.md +docs/OrdersResponse.md +docs/Page.md +docs/Pagination.md +docs/PaymentLinkApi.md +docs/PaymentMethod.md +docs/PaymentMethodBankTransfer.md +docs/PaymentMethodCard.md +docs/PaymentMethodCardRequest.md +docs/PaymentMethodCardRequestAllOf.md +docs/PaymentMethodCardResponse.md +docs/PaymentMethodCardResponseAllOf.md +docs/PaymentMethodCash.md +docs/PaymentMethodCashRequest.md +docs/PaymentMethodCashRequestAllOf.md +docs/PaymentMethodCashResponse.md +docs/PaymentMethodCashResponseAllOf.md +docs/PaymentMethodResponse.md +docs/PaymentMethodSpeiRecurrent.md +docs/PaymentMethodSpeiRecurrentAllOf.md +docs/PaymentMethodSpeiRequest.md +docs/PaymentMethodsApi.md +docs/PlanRequest.md +docs/PlanResponse.md +docs/PlanUpdateRequest.md +docs/PlansApi.md +docs/Product.md +docs/ProductDataResponse.md +docs/ProductDataResponseAllOf.md +docs/ProductOrderResponse.md +docs/ProductOrderResponseAllOf.md +docs/ProductsApi.md +docs/RiskRules.md +docs/RiskRulesData.md +docs/RiskRulesList.md +docs/ShippingContactsApi.md +docs/ShippingOrderResponse.md +docs/ShippingRequest.md +docs/ShippingsApi.md +docs/SmsCheckoutRequest.md +docs/SubscriptionEventsResponse.md +docs/SubscriptionRequest.md +docs/SubscriptionResponse.md +docs/SubscriptionUpdateRequest.md +docs/SubscriptionsApi.md +docs/TaxesApi.md +docs/Token.md +docs/TokenCard.md +docs/TokenCheckout.md +docs/TokenResponse.md +docs/TokenResponseCheckout.md +docs/TokensApi.md +docs/TransactionResponse.md +docs/TransactionsApi.md +docs/TransferDestinationResponse.md +docs/TransferMethodResponse.md +docs/TransferResponse.md +docs/TransfersApi.md +docs/TransfersResponse.md +docs/UpdateCustomer.md +docs/UpdateCustomerAntifraudInfo.md +docs/UpdateCustomerFiscalEntitiesResponse.md +docs/UpdateCustomerFiscalEntitiesResponseAllOf.md +docs/UpdateCustomerPaymentMethodsResponse.md +docs/UpdateOrderDiscountLinesRequest.md +docs/UpdateOrderTaxRequest.md +docs/UpdateOrderTaxResponse.md +docs/UpdateOrderTaxResponseAllOf.md +docs/UpdatePaymentMethods.md +docs/UpdateProduct.md +docs/WebhookKeyCreateResponse.md +docs/WebhookKeyDeleteResponse.md +docs/WebhookKeyRequest.md +docs/WebhookKeyResponse.md +docs/WebhookKeyUpdateRequest.md +docs/WebhookKeysApi.md +docs/WebhookLog.md +docs/WebhookRequest.md +docs/WebhookResponse.md +docs/WebhookUpdateRequest.md +docs/WebhooksApi.md +docs/WhitelistlistRuleResponse.md +lib/conekta.rb +lib/conekta/api/antifraud_api.rb +lib/conekta/api/api_keys_api.rb +lib/conekta/api/balances_api.rb +lib/conekta/api/charges_api.rb +lib/conekta/api/companies_api.rb +lib/conekta/api/customers_api.rb +lib/conekta/api/discounts_api.rb +lib/conekta/api/events_api.rb +lib/conekta/api/logs_api.rb +lib/conekta/api/orders_api.rb +lib/conekta/api/payment_link_api.rb +lib/conekta/api/payment_methods_api.rb +lib/conekta/api/plans_api.rb +lib/conekta/api/products_api.rb +lib/conekta/api/shipping_contacts_api.rb +lib/conekta/api/shippings_api.rb +lib/conekta/api/subscriptions_api.rb +lib/conekta/api/taxes_api.rb +lib/conekta/api/tokens_api.rb +lib/conekta/api/transactions_api.rb +lib/conekta/api/transfers_api.rb +lib/conekta/api/webhook_keys_api.rb +lib/conekta/api/webhooks_api.rb +lib/conekta/api_client.rb +lib/conekta/api_error.rb +lib/conekta/configuration.rb +lib/conekta/models/api_key_create_response.rb +lib/conekta/models/api_key_create_response_all_of.rb +lib/conekta/models/api_key_request.rb +lib/conekta/models/api_key_response.rb +lib/conekta/models/api_key_response_on_delete.rb +lib/conekta/models/api_key_update_request.rb +lib/conekta/models/balance_common_field.rb +lib/conekta/models/balance_response.rb +lib/conekta/models/blacklist_rule_response.rb +lib/conekta/models/charge_data_payment_method_bank_transfer_response.rb +lib/conekta/models/charge_data_payment_method_card_response.rb +lib/conekta/models/charge_data_payment_method_cash_response.rb +lib/conekta/models/charge_order_response.rb +lib/conekta/models/charge_order_response_payment_method.rb +lib/conekta/models/charge_request.rb +lib/conekta/models/charge_request_payment_method.rb +lib/conekta/models/charge_response.rb +lib/conekta/models/charge_response_channel.rb +lib/conekta/models/charge_response_payment_method.rb +lib/conekta/models/charge_response_refunds.rb +lib/conekta/models/charge_response_refunds_all_of.rb +lib/conekta/models/charge_response_refunds_data.rb +lib/conekta/models/charges_data_response.rb +lib/conekta/models/checkout.rb +lib/conekta/models/checkout_order_template.rb +lib/conekta/models/checkout_order_template_customer_info.rb +lib/conekta/models/checkout_request.rb +lib/conekta/models/checkout_response.rb +lib/conekta/models/checkouts_response.rb +lib/conekta/models/checkouts_response_all_of.rb +lib/conekta/models/company_fiscal_info_address_response.rb +lib/conekta/models/company_fiscal_info_response.rb +lib/conekta/models/company_payout_destination_response.rb +lib/conekta/models/company_response.rb +lib/conekta/models/create_customer_fiscal_entities_response.rb +lib/conekta/models/create_customer_fiscal_entities_response_all_of.rb +lib/conekta/models/create_customer_payment_methods_request.rb +lib/conekta/models/create_customer_payment_methods_response.rb +lib/conekta/models/create_risk_rules_data.rb +lib/conekta/models/customer.rb +lib/conekta/models/customer_address.rb +lib/conekta/models/customer_antifraud_info.rb +lib/conekta/models/customer_antifraud_info_response.rb +lib/conekta/models/customer_fiscal_entities_data_response.rb +lib/conekta/models/customer_fiscal_entities_request.rb +lib/conekta/models/customer_fiscal_entities_request_address.rb +lib/conekta/models/customer_fiscal_entities_response.rb +lib/conekta/models/customer_fiscal_entities_response_all_of.rb +lib/conekta/models/customer_info.rb +lib/conekta/models/customer_info_just_customer_id.rb +lib/conekta/models/customer_info_just_customer_id_response.rb +lib/conekta/models/customer_info_response.rb +lib/conekta/models/customer_payment_method_request.rb +lib/conekta/models/customer_payment_methods.rb +lib/conekta/models/customer_payment_methods_data.rb +lib/conekta/models/customer_payment_methods_request.rb +lib/conekta/models/customer_payment_methods_response.rb +lib/conekta/models/customer_response.rb +lib/conekta/models/customer_response_shipping_contacts.rb +lib/conekta/models/customer_response_shipping_contacts_all_of.rb +lib/conekta/models/customer_shipping_contacts.rb +lib/conekta/models/customer_shipping_contacts_address.rb +lib/conekta/models/customer_shipping_contacts_data_response.rb +lib/conekta/models/customer_shipping_contacts_data_response_all_of.rb +lib/conekta/models/customer_shipping_contacts_response.rb +lib/conekta/models/customer_shipping_contacts_response_address.rb +lib/conekta/models/customer_update_fiscal_entities_request.rb +lib/conekta/models/customer_update_shipping_contacts.rb +lib/conekta/models/customers_response.rb +lib/conekta/models/customers_response_all_of.rb +lib/conekta/models/delete_api_keys_response.rb +lib/conekta/models/delete_api_keys_response_all_of.rb +lib/conekta/models/deleted_blacklist_rule_response.rb +lib/conekta/models/deleted_whitelist_rule_response.rb +lib/conekta/models/details.rb +lib/conekta/models/details_error.rb +lib/conekta/models/discount_lines_data_response.rb +lib/conekta/models/discount_lines_response.rb +lib/conekta/models/discount_lines_response_all_of.rb +lib/conekta/models/email_checkout_request.rb +lib/conekta/models/error.rb +lib/conekta/models/error_all_of.rb +lib/conekta/models/event_response.rb +lib/conekta/models/events_resend_response.rb +lib/conekta/models/get_api_keys_response.rb +lib/conekta/models/get_api_keys_response_all_of.rb +lib/conekta/models/get_charges_response.rb +lib/conekta/models/get_charges_response_all_of.rb +lib/conekta/models/get_companies_response.rb +lib/conekta/models/get_companies_response_all_of.rb +lib/conekta/models/get_customer_payment_method_data_response.rb +lib/conekta/models/get_events_response.rb +lib/conekta/models/get_events_response_all_of.rb +lib/conekta/models/get_order_discount_lines_response.rb +lib/conekta/models/get_order_discount_lines_response_all_of.rb +lib/conekta/models/get_orders_response.rb +lib/conekta/models/get_payment_method_response.rb +lib/conekta/models/get_payment_method_response_all_of.rb +lib/conekta/models/get_plans_response.rb +lib/conekta/models/get_plans_response_all_of.rb +lib/conekta/models/get_transactions_response.rb +lib/conekta/models/get_transactions_response_all_of.rb +lib/conekta/models/get_transfers_response.rb +lib/conekta/models/get_transfers_response_all_of.rb +lib/conekta/models/get_webhook_keys_response.rb +lib/conekta/models/get_webhook_keys_response_all_of.rb +lib/conekta/models/get_webhooks_response.rb +lib/conekta/models/get_webhooks_response_all_of.rb +lib/conekta/models/log_response.rb +lib/conekta/models/logs_response.rb +lib/conekta/models/logs_response_data.rb +lib/conekta/models/order_capture_request.rb +lib/conekta/models/order_discount_lines_request.rb +lib/conekta/models/order_refund_request.rb +lib/conekta/models/order_request.rb +lib/conekta/models/order_request_customer_info.rb +lib/conekta/models/order_response.rb +lib/conekta/models/order_response_charges.rb +lib/conekta/models/order_response_charges_all_of.rb +lib/conekta/models/order_response_checkout.rb +lib/conekta/models/order_response_customer_info.rb +lib/conekta/models/order_response_customer_info_all_of.rb +lib/conekta/models/order_response_discount_lines.rb +lib/conekta/models/order_response_discount_lines_all_of.rb +lib/conekta/models/order_response_fiscal_entity.rb +lib/conekta/models/order_response_fiscal_entity_address.rb +lib/conekta/models/order_response_fiscal_entity_address_all_of.rb +lib/conekta/models/order_response_products.rb +lib/conekta/models/order_response_products_all_of.rb +lib/conekta/models/order_response_shipping_contact.rb +lib/conekta/models/order_response_shipping_contact_all_of.rb +lib/conekta/models/order_tax_request.rb +lib/conekta/models/order_update_request.rb +lib/conekta/models/order_update_request_customer_info.rb +lib/conekta/models/orders_response.rb +lib/conekta/models/page.rb +lib/conekta/models/pagination.rb +lib/conekta/models/payment_method.rb +lib/conekta/models/payment_method_bank_transfer.rb +lib/conekta/models/payment_method_card.rb +lib/conekta/models/payment_method_card_request.rb +lib/conekta/models/payment_method_card_request_all_of.rb +lib/conekta/models/payment_method_card_response.rb +lib/conekta/models/payment_method_card_response_all_of.rb +lib/conekta/models/payment_method_cash.rb +lib/conekta/models/payment_method_cash_request.rb +lib/conekta/models/payment_method_cash_request_all_of.rb +lib/conekta/models/payment_method_cash_response.rb +lib/conekta/models/payment_method_cash_response_all_of.rb +lib/conekta/models/payment_method_response.rb +lib/conekta/models/payment_method_spei_recurrent.rb +lib/conekta/models/payment_method_spei_recurrent_all_of.rb +lib/conekta/models/payment_method_spei_request.rb +lib/conekta/models/plan_request.rb +lib/conekta/models/plan_response.rb +lib/conekta/models/plan_update_request.rb +lib/conekta/models/product.rb +lib/conekta/models/product_data_response.rb +lib/conekta/models/product_data_response_all_of.rb +lib/conekta/models/product_order_response.rb +lib/conekta/models/product_order_response_all_of.rb +lib/conekta/models/risk_rules.rb +lib/conekta/models/risk_rules_data.rb +lib/conekta/models/risk_rules_list.rb +lib/conekta/models/shipping_order_response.rb +lib/conekta/models/shipping_request.rb +lib/conekta/models/sms_checkout_request.rb +lib/conekta/models/subscription_events_response.rb +lib/conekta/models/subscription_request.rb +lib/conekta/models/subscription_response.rb +lib/conekta/models/subscription_update_request.rb +lib/conekta/models/token.rb +lib/conekta/models/token_card.rb +lib/conekta/models/token_checkout.rb +lib/conekta/models/token_response.rb +lib/conekta/models/token_response_checkout.rb +lib/conekta/models/transaction_response.rb +lib/conekta/models/transfer_destination_response.rb +lib/conekta/models/transfer_method_response.rb +lib/conekta/models/transfer_response.rb +lib/conekta/models/transfers_response.rb +lib/conekta/models/update_customer.rb +lib/conekta/models/update_customer_antifraud_info.rb +lib/conekta/models/update_customer_fiscal_entities_response.rb +lib/conekta/models/update_customer_fiscal_entities_response_all_of.rb +lib/conekta/models/update_customer_payment_methods_response.rb +lib/conekta/models/update_order_discount_lines_request.rb +lib/conekta/models/update_order_tax_request.rb +lib/conekta/models/update_order_tax_response.rb +lib/conekta/models/update_order_tax_response_all_of.rb +lib/conekta/models/update_payment_methods.rb +lib/conekta/models/update_product.rb +lib/conekta/models/webhook_key_create_response.rb +lib/conekta/models/webhook_key_delete_response.rb +lib/conekta/models/webhook_key_request.rb +lib/conekta/models/webhook_key_response.rb +lib/conekta/models/webhook_key_update_request.rb +lib/conekta/models/webhook_log.rb +lib/conekta/models/webhook_request.rb +lib/conekta/models/webhook_response.rb +lib/conekta/models/webhook_update_request.rb +lib/conekta/models/whitelistlist_rule_response.rb +lib/conekta/version.rb +lib/ssl_data/ca_bundle.crt +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/spec_helper.rb diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..cd802a1 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/.rspec b/.rspec index 4e1e0d2..83e16f8 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,2 @@ --color +--require spec_helper diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..d32b2b1 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,148 @@ +# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) +# Automatically generated by OpenAPI Generator (https://openapi-generator.tech) +AllCops: + TargetRubyVersion: 2.4 + # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop + # to ignore them, so only the ones explicitly set in this file are enabled. + DisabledByDefault: true + Exclude: + - '**/templates/**/*' + - '**/vendor/**/*' + - 'actionpack/lib/action_dispatch/journey/parser.rb' + +# Prefer &&/|| over and/or. +Style/AndOr: + Enabled: true + +# Align `when` with `case`. +Layout/CaseIndentation: + Enabled: true + +# Align comments with method definitions. +Layout/CommentIndentation: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true + +# In a regular class definition, no empty lines around the body. +Layout/EmptyLinesAroundClassBody: + Enabled: true + +# In a regular method definition, no empty lines around the body. +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +# In a regular module definition, no empty lines around the body. +Layout/EmptyLinesAroundModuleBody: + Enabled: true + +Layout/FirstArgumentIndentation: + Enabled: true + +# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. +Style/HashSyntax: + Enabled: false + +# Method definitions after `private` or `protected` isolated calls need one +# extra level of indentation. +Layout/IndentationConsistency: + Enabled: true + EnforcedStyle: indented_internal_methods + +# Two spaces, no tabs (for indentation). +Layout/IndentationWidth: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/SpaceAfterColon: + Enabled: true + +Layout/SpaceAfterComma: + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/SpaceAroundOperators: + Enabled: true + +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +# Defining a method with parameters needs parentheses. +Style/MethodDefParentheses: + Enabled: true + +Style/FrozenStringLiteralComment: + Enabled: false + EnforcedStyle: always + +# Use `foo {}` not `foo{}`. +Layout/SpaceBeforeBlockBraces: + Enabled: true + +# Use `foo { bar }` not `foo {bar}`. +Layout/SpaceInsideBlockBraces: + Enabled: true + +# Use `{ a: 1 }` not `{a:1}`. +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +# Check quotes usage according to lint rule below. +#Style/StringLiterals: +# Enabled: true +# EnforcedStyle: single_quotes + +# Detect hard tabs, no hard tabs. +Layout/IndentationStyle: + Enabled: true + +# Blank lines should not have any spaces. +Layout/TrailingEmptyLines: + Enabled: true + +# No trailing whitespace. +Layout/TrailingWhitespace: + Enabled: false + +# Use quotes for string literals when they are enough. +Style/RedundantPercentQ: + Enabled: true + +# Align `end` with the matching keyword or starting expression except for +# assignments, where it should be aligned with the LHS. +Layout/EndAlignment: + Enabled: true + EnforcedStyleAlignWith: variable + AutoCorrect: true + +# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. +Lint/RequireParentheses: + Enabled: true + +Style/RedundantReturn: + Enabled: true + AllowMultipleReturnValues: true + +Style/Semicolon: + Enabled: true + AllowAsExpressionSeparator: true diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..4b48cf0 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,28 @@ +title: Authors + +Primary Authors +=============== + +* __[Franklin Carrero](https://github.com/fcarrero)__ + + @fcarrero is the current maintainer of the code and has written much of the + current code base, including a complete refactor of the core for version 2.0. + He started out by authoring many of the available extensions and later was + asked to join Yuri, where he began fixing numerous bugs, adding + documentation and making general improvements to the existing code base. + +* __[Jorge Alberto Alonso](https://github.com/jalonsoDevConekta)__ + + @jalonsoDevConekta is the current maintainer of the code and has written much of the + current code base, including a complete refactor of the core for version 2.0. + He started out by authoring many of the available extensions and later was + asked to join Yuri, where he began fixing numerous bugs, adding + documentation and making general improvements to the existing code base. + +* __[Ezequiel Rozen](https://github.com/ezerozen)__ + + @ezerozen is the current maintainer of the code and has written much of the + current code base, including a complete refactor of the core for version 2.0. + He started out by authoring many of the available extensions and later was + asked to join Yuri, where he began fixing numerous bugs, adding + documentation and making general improvements to the existing code base. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..eaa8122 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,77 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at engineering@conekta.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..63e0da6 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contribution guidelines + +## How to contribute step-by-step + +1. Fork the `conekta/#$repo repository. +2. Create a new branch from `main` in your fork. This makes it easier for you to keep track of your changes. +3. Make the desired changes to the code. + * If you are adding new functionality or fixing a bug, we recommend you add unit tests that cover it. +4. Push the changes to your fork. +5. Create a pull request to the `conekta/#$repo` repository. +6. In your pull request, please describe in detail: + * What problem you’re solving + * Your approach to fixing the problem + * Any tests you wrote +7. Check Allow edits from maintainers. +8. Create the pull request. +9. Ensure that all checks have passed. + +After you create your pull request, one of the code owners will review your code. We aim to review your request within 2-3 business days. diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index b41c059..0000000 --- a/Dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -FROM ubuntu:14.04 - -MAINTAINER Leo Fischer - -RUN apt-get update -RUN apt-get install -y vim git wget curl - -#setup test_user user -RUN useradd -ms /bin/bash test_user -RUN echo "test_user:sudo" | chpasswd -RUN usermod -aG sudo test_user -RUN mkdir -p /data/db/ -RUN chown test_user /data/db -RUN sudo echo "test_user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers - -USER test_user -ENV HOME /home/test_user - -RUN echo "set tabstop=2" >> ~/.vimrc -RUN echo "set shiftwidth=2" >> ~/.vimrc -RUN echo "set softtabstop=2" >> ~/.vimrc - -#install RVM and Ruby -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 -RUN \curl -sSL https://get.rvm.io | sudo bash -s stable -RUN sudo usermod -a -G rvm test_user -RUN /bin/bash -l -c "rvm requirements" -RUN /bin/bash -l -c "rvm install 1.9.3" -RUN /bin/bash -l -c "rvm install 2.1.9" -RUN /bin/bash -l -c "rvm install 2.2.4" -RUN /bin/bash -l -c "rvm install 2.3.0" - -#configure external fs links -WORKDIR $HOME - -#One Time Staging Steps -RUN git clone https://github.com/conekta/conekta-ruby - -WORKDIR $HOME/conekta-ruby - -RUN /bin/bash -l -c "rvm use 1.9.3 && gem install bundle && bundle install" -RUN /bin/bash -l -c "rvm use 2.1.9 && gem install bundle && bundle install" -RUN /bin/bash -l -c "rvm use 2.2.4 && gem install bundle && bundle install" -RUN /bin/bash -l -c "rvm use 2.3.0 && gem install bundle && bundle install" diff --git a/Gemfile b/Gemfile index 35d07f6..c2e3127 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,9 @@ source 'https://rubygems.org' -gem 'sys-uname' -gem 'rspec' -gem 'faraday' -gem 'json' -gem 'i18n' + +gemspec group :development, :test do - gem 'byebug' + gem 'rake', '~> 13.0.1' + gem 'pry-byebug' + gem 'rubocop', '~> 0.66.0' end - -# Specify your gem's dependencies in conekta.gemspec -gemspec diff --git a/LICENSE.txt b/LICENSE similarity index 94% rename from LICENSE.txt rename to LICENSE index b0a31fb..afabd14 100644 --- a/LICENSE.txt +++ b/LICENSE @@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3bf8d46 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +ci-test: + bundle exec rspec \ No newline at end of file diff --git a/README.md b/README.md index bdc9a54..9bae534 100644 --- a/README.md +++ b/README.md @@ -1,123 +1,399 @@ -# Conekta Ruby +# conekta -This is a [Ruby](https://www.ruby-lang.org/) library that allows interaction with [Conekta's API](https://api.conekta.io). +Conekta - the Ruby gem for the Conekta API + +Conekta sdk + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 2.1.0 +- Package version: 6.0.0 +- Build date: 2023-07-25T20:01:00.519004-05:00[America/Bogota] +- Build package: org.openapitools.codegen.languages.RubyClientCodegen +For more information, please visit [https://github.com/conekta/openapi/issues](https://github.com/conekta/openapi/issues) ## Installation -Add this line to your application's Gemfile: +### Build a gem - gem 'conekta' +To build the Ruby code into a gem: -And then execute: +```shell +gem build conekta.gemspec +``` - bundle +Then either install the gem locally: -Or install it yourself as: +```shell +gem install ./conekta-6.0.0.gem +``` - gem install conekta +(for development, run `gem install --dev ./conekta-6.0.0.gem` to install the development dependencies) -## Usage -```ruby -# Set your configuration variables +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). -# This changes the Accept-Language Header to the locale specified -Conekta.locale = :es -Conekta.api_key = '1tv5yJp3xnVZ7eK67m4h' +Finally add this to the Gemfile: -# Or via an initializer in config/initializers/conekta.rb -Conekta.config do |c| - c.locale = :es - c.api_key = '1tv5yJp3xnVZ7eK67m4h' - c.api_version = '2.0.0' -end + gem 'conekta', '~> 6.0.0' -YOUR_DOMAIN = 'localhost:9292'.freeze +### Install from Git -# Order creation example -begin - customer = Conekta::Customer.create( - { - name: 'Matz', - email: 'matz@rules.com' - } - ) - - order_params = - { - currency: 'MXN', - customer_info: { - customer_id: customer.id - }, - line_items: [ - { - name: 'T-Rex', - unit_price: 10000, - quantity: 1 - } - ], - checkout: { - type: 'HostedPayment', - name: 'Checkout Dummy', - allowed_payment_methods: %w[cash card bank_transfer], - success_url: YOUR_DOMAIN + '/success.html', - failure_url: YOUR_DOMAIN + '/cancel.html', - } - } - - order = Conekta::Order.create(order_params) -rescue Conekta::Error => error - error.details.each do |error_details| - puts error_detail.message - end -end +If the Ruby gem is hosted at a git repository: https://github.com/conekta/conekta-ruby, then add the following in the Gemfile: + + gem 'conekta', :git => 'https://github.com/conekta/conekta-ruby.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb ``` -## Documentation +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: -Please visit the [Rdoc](https://www.rubydoc.info/gems/conekta/2.6.0/Conekta) or you can take a look to the [official API reference](https://developers.conekta.com/api) for an up-to-date documentation. +```ruby +# Load the gem +require 'conekta' -## How to contribute to the project +# Setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } + # Configure faraday connection + config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' } +end -1. Fork the repository +api_instance = Conekta::AntifraudApi.new +create_risk_rules_data = Conekta::CreateRiskRulesData.new({description: 'this client email was verified at 20/09/22 by internal process', field: 'email | phone | card_token', value: 'email@example.com | 818081808180 | src_2qUCNd5AyQqfPMBuV'}) # CreateRiskRulesData | requested field for blacklist rule +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + #Create blacklisted rule + result = api_instance.create_rule_blacklist(create_risk_rules_data, opts) + p result +rescue Conekta::ApiError => e + puts "Exception when calling AntifraudApi->create_rule_blacklist: #{e}" +end -2. Clone the repository -``` - git clone git@github.com:yourUserName/conekta-ruby.git -``` -3. Create a branch -``` - git checkout develop - git pull origin develop - # You should choose the name of your branch - git checkout -b -``` -4. Make necessary changes and commit those changes -``` - git add . - git commit -m "my changes" -``` -5. Push changes to GitHub -``` - git push origin ``` -6. Submit your changes for review, create a pull request - To create a pull request, you need to have made your code changes on a separate branch. This branch should be named like this: **feature/my_feature** or **fix/my_fix**. +## Documentation for API Endpoints + +All URIs are relative to *https://api.conekta.io* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*Conekta::AntifraudApi* | [**create_rule_blacklist**](docs/AntifraudApi.md#create_rule_blacklist) | **POST** /antifraud/blacklists | Create blacklisted rule +*Conekta::AntifraudApi* | [**create_rule_whitelist**](docs/AntifraudApi.md#create_rule_whitelist) | **POST** /antifraud/whitelists | Create whitelisted rule +*Conekta::AntifraudApi* | [**delete_rule_blacklist**](docs/AntifraudApi.md#delete_rule_blacklist) | **DELETE** /antifraud/blacklists/{id} | Delete blacklisted rule +*Conekta::AntifraudApi* | [**delete_rule_whitelist**](docs/AntifraudApi.md#delete_rule_whitelist) | **DELETE** /antifraud/whitelists/{id} | Delete whitelisted rule +*Conekta::AntifraudApi* | [**get_rule_blacklist**](docs/AntifraudApi.md#get_rule_blacklist) | **GET** /antifraud/blacklists | Get list of blacklisted rules +*Conekta::AntifraudApi* | [**get_rule_whitelist**](docs/AntifraudApi.md#get_rule_whitelist) | **GET** /antifraud/whitelists | Get a list of whitelisted rules +*Conekta::ApiKeysApi* | [**create_api_key**](docs/ApiKeysApi.md#create_api_key) | **POST** /api_keys | Create Api Key +*Conekta::ApiKeysApi* | [**delete_api_key**](docs/ApiKeysApi.md#delete_api_key) | **DELETE** /api_keys/{id} | Delete Api Key +*Conekta::ApiKeysApi* | [**get_api_key**](docs/ApiKeysApi.md#get_api_key) | **GET** /api_keys/{id} | Get Api Key +*Conekta::ApiKeysApi* | [**get_api_keys**](docs/ApiKeysApi.md#get_api_keys) | **GET** /api_keys | Get list of Api Keys +*Conekta::ApiKeysApi* | [**update_api_key**](docs/ApiKeysApi.md#update_api_key) | **PUT** /api_keys/{id} | Update Api Key +*Conekta::BalancesApi* | [**get_balance**](docs/BalancesApi.md#get_balance) | **GET** /balances | Get a company's balance +*Conekta::ChargesApi* | [**get_charges**](docs/ChargesApi.md#get_charges) | **GET** /charges | Get A List of Charges +*Conekta::ChargesApi* | [**orders_create_charge**](docs/ChargesApi.md#orders_create_charge) | **POST** /orders/{id}/charges | Create charge +*Conekta::CompaniesApi* | [**get_companies**](docs/CompaniesApi.md#get_companies) | **GET** /companies | Get List of Companies +*Conekta::CompaniesApi* | [**get_company**](docs/CompaniesApi.md#get_company) | **GET** /companies/{id} | Get Company +*Conekta::CustomersApi* | [**create_customer**](docs/CustomersApi.md#create_customer) | **POST** /customers | Create customer +*Conekta::CustomersApi* | [**create_customer_fiscal_entities**](docs/CustomersApi.md#create_customer_fiscal_entities) | **POST** /customers/{id}/fiscal_entities | Create Fiscal Entity +*Conekta::CustomersApi* | [**delete_customer_by_id**](docs/CustomersApi.md#delete_customer_by_id) | **DELETE** /customers/{id} | Delete Customer +*Conekta::CustomersApi* | [**get_customer_by_id**](docs/CustomersApi.md#get_customer_by_id) | **GET** /customers/{id} | Get Customer +*Conekta::CustomersApi* | [**get_customers**](docs/CustomersApi.md#get_customers) | **GET** /customers | Get a list of customers +*Conekta::CustomersApi* | [**update_customer**](docs/CustomersApi.md#update_customer) | **PUT** /customers/{id} | Update customer +*Conekta::CustomersApi* | [**update_customer_fiscal_entities**](docs/CustomersApi.md#update_customer_fiscal_entities) | **PUT** /customers/{id}/fiscal_entities/{fiscal_entities_id} | Update Fiscal Entity +*Conekta::DiscountsApi* | [**orders_create_discount_line**](docs/DiscountsApi.md#orders_create_discount_line) | **POST** /orders/{id}/discount_lines | Create Discount +*Conekta::DiscountsApi* | [**orders_delete_discount_lines**](docs/DiscountsApi.md#orders_delete_discount_lines) | **DELETE** /orders/{id}/discount_lines/{discount_lines_id} | Delete Discount +*Conekta::DiscountsApi* | [**orders_get_discount_line**](docs/DiscountsApi.md#orders_get_discount_line) | **GET** /orders/{id}/discount_lines/{discount_lines_id} | Get Discount +*Conekta::DiscountsApi* | [**orders_get_discount_lines**](docs/DiscountsApi.md#orders_get_discount_lines) | **GET** /orders/{id}/discount_lines | Get a List of Discount +*Conekta::DiscountsApi* | [**orders_update_discount_lines**](docs/DiscountsApi.md#orders_update_discount_lines) | **PUT** /orders/{id}/discount_lines/{discount_lines_id} | Update Discount +*Conekta::EventsApi* | [**get_event**](docs/EventsApi.md#get_event) | **GET** /events/{id} | Get Event +*Conekta::EventsApi* | [**get_events**](docs/EventsApi.md#get_events) | **GET** /events | Get list of Events +*Conekta::EventsApi* | [**resend_event**](docs/EventsApi.md#resend_event) | **POST** /events/{event_id}/webhook_logs/{webhook_log_id}/resend | Resend Event +*Conekta::LogsApi* | [**get_log_by_id**](docs/LogsApi.md#get_log_by_id) | **GET** /logs/{id} | Get Log +*Conekta::LogsApi* | [**get_logs**](docs/LogsApi.md#get_logs) | **GET** /logs | Get List Of Logs +*Conekta::OrdersApi* | [**cancel_order**](docs/OrdersApi.md#cancel_order) | **POST** /orders/{id}/cancel | Cancel Order +*Conekta::OrdersApi* | [**create_order**](docs/OrdersApi.md#create_order) | **POST** /orders | Create order +*Conekta::OrdersApi* | [**get_order_by_id**](docs/OrdersApi.md#get_order_by_id) | **GET** /orders/{id} | Get Order +*Conekta::OrdersApi* | [**get_orders**](docs/OrdersApi.md#get_orders) | **GET** /orders | Get a list of Orders +*Conekta::OrdersApi* | [**order_cancel_refund**](docs/OrdersApi.md#order_cancel_refund) | **DELETE** /orders/{id}/refunds/{refund_id} | Cancel Refund +*Conekta::OrdersApi* | [**order_refund**](docs/OrdersApi.md#order_refund) | **POST** /orders/{id}/refunds | Refund Order +*Conekta::OrdersApi* | [**orders_create_capture**](docs/OrdersApi.md#orders_create_capture) | **POST** /orders/{id}/capture | Capture Order +*Conekta::OrdersApi* | [**update_order**](docs/OrdersApi.md#update_order) | **PUT** /orders/{id} | Update Order +*Conekta::PaymentLinkApi* | [**cancel_checkout**](docs/PaymentLinkApi.md#cancel_checkout) | **PUT** /checkouts/{id}/cancel | Cancel Payment Link +*Conekta::PaymentLinkApi* | [**create_checkout**](docs/PaymentLinkApi.md#create_checkout) | **POST** /checkouts | Create Unique Payment Link +*Conekta::PaymentLinkApi* | [**email_checkout**](docs/PaymentLinkApi.md#email_checkout) | **POST** /checkouts/{id}/email | Send an email +*Conekta::PaymentLinkApi* | [**get_checkout**](docs/PaymentLinkApi.md#get_checkout) | **GET** /checkouts/{id} | Get a payment link by ID +*Conekta::PaymentLinkApi* | [**get_checkouts**](docs/PaymentLinkApi.md#get_checkouts) | **GET** /checkouts | Get a list of payment links +*Conekta::PaymentLinkApi* | [**sms_checkout**](docs/PaymentLinkApi.md#sms_checkout) | **POST** /checkouts/{id}/sms | Send an sms +*Conekta::PaymentMethodsApi* | [**create_customer_payment_methods**](docs/PaymentMethodsApi.md#create_customer_payment_methods) | **POST** /customers/{id}/payment_sources | Create Payment Method +*Conekta::PaymentMethodsApi* | [**delete_customer_payment_methods**](docs/PaymentMethodsApi.md#delete_customer_payment_methods) | **DELETE** /customers/{id}/payment_sources/{payment_method_id} | Delete Payment Method +*Conekta::PaymentMethodsApi* | [**get_customer_payment_methods**](docs/PaymentMethodsApi.md#get_customer_payment_methods) | **GET** /customers/{id}/payment_sources | Get Payment Methods +*Conekta::PaymentMethodsApi* | [**update_customer_payment_methods**](docs/PaymentMethodsApi.md#update_customer_payment_methods) | **PUT** /customers/{id}/payment_sources/{payment_method_id} | Update Payment Method +*Conekta::PlansApi* | [**create_plan**](docs/PlansApi.md#create_plan) | **POST** /plans | Create Plan +*Conekta::PlansApi* | [**delete_plan**](docs/PlansApi.md#delete_plan) | **DELETE** /plans/{id} | Delete Plan +*Conekta::PlansApi* | [**get_plan**](docs/PlansApi.md#get_plan) | **GET** /plans/{id} | Get Plan +*Conekta::PlansApi* | [**get_plans**](docs/PlansApi.md#get_plans) | **GET** /plans | Get A List of Plans +*Conekta::PlansApi* | [**update_plan**](docs/PlansApi.md#update_plan) | **PUT** /plans/{id} | Update Plan +*Conekta::ProductsApi* | [**orders_create_product**](docs/ProductsApi.md#orders_create_product) | **POST** /orders/{id}/line_items | Create Product +*Conekta::ProductsApi* | [**orders_delete_product**](docs/ProductsApi.md#orders_delete_product) | **DELETE** /orders/{id}/line_items/{line_item_id} | Delete Product +*Conekta::ProductsApi* | [**orders_update_product**](docs/ProductsApi.md#orders_update_product) | **PUT** /orders/{id}/line_items/{line_item_id} | Update Product +*Conekta::ShippingContactsApi* | [**create_customer_shipping_contacts**](docs/ShippingContactsApi.md#create_customer_shipping_contacts) | **POST** /customers/{id}/shipping_contacts | Create a shipping contacts +*Conekta::ShippingContactsApi* | [**delete_customer_shipping_contacts**](docs/ShippingContactsApi.md#delete_customer_shipping_contacts) | **DELETE** /customers/{id}/shipping_contacts/{shipping_contacts_id} | Delete shipping contacts +*Conekta::ShippingContactsApi* | [**update_customer_shipping_contacts**](docs/ShippingContactsApi.md#update_customer_shipping_contacts) | **PUT** /customers/{id}/shipping_contacts/{shipping_contacts_id} | Update shipping contacts +*Conekta::ShippingsApi* | [**orders_create_shipping**](docs/ShippingsApi.md#orders_create_shipping) | **POST** /orders/{id}/shipping_lines | Create Shipping +*Conekta::ShippingsApi* | [**orders_delete_shipping**](docs/ShippingsApi.md#orders_delete_shipping) | **DELETE** /orders/{id}/shipping_lines/{shipping_id} | Delete Shipping +*Conekta::ShippingsApi* | [**orders_update_shipping**](docs/ShippingsApi.md#orders_update_shipping) | **PUT** /orders/{id}/shipping_lines/{shipping_id} | Update Shipping +*Conekta::SubscriptionsApi* | [**cancel_subscription**](docs/SubscriptionsApi.md#cancel_subscription) | **POST** /customers/{id}/subscription/cancel | Cancel Subscription +*Conekta::SubscriptionsApi* | [**create_subscription**](docs/SubscriptionsApi.md#create_subscription) | **POST** /customers/{id}/subscription | Create Subscription +*Conekta::SubscriptionsApi* | [**get_all_events_from_subscription**](docs/SubscriptionsApi.md#get_all_events_from_subscription) | **GET** /customers/{id}/subscription/events | Get Events By Subscription +*Conekta::SubscriptionsApi* | [**get_subscription**](docs/SubscriptionsApi.md#get_subscription) | **GET** /customers/{id}/subscription | Get Subscription +*Conekta::SubscriptionsApi* | [**pause_subscription**](docs/SubscriptionsApi.md#pause_subscription) | **POST** /customers/{id}/subscription/pause | Pause Subscription +*Conekta::SubscriptionsApi* | [**resume_subscription**](docs/SubscriptionsApi.md#resume_subscription) | **POST** /customers/{id}/subscription/resume | Resume Subscription +*Conekta::SubscriptionsApi* | [**update_subscription**](docs/SubscriptionsApi.md#update_subscription) | **PUT** /customers/{id}/subscription | Update Subscription +*Conekta::TaxesApi* | [**orders_create_taxes**](docs/TaxesApi.md#orders_create_taxes) | **POST** /orders/{id}/tax_lines | Create Tax +*Conekta::TaxesApi* | [**orders_delete_taxes**](docs/TaxesApi.md#orders_delete_taxes) | **DELETE** /orders/{id}/tax_lines/{tax_id} | Delete Tax +*Conekta::TaxesApi* | [**orders_update_taxes**](docs/TaxesApi.md#orders_update_taxes) | **PUT** /orders/{id}/tax_lines/{tax_id} | Update Tax +*Conekta::TokensApi* | [**create_token**](docs/TokensApi.md#create_token) | **POST** /tokens | Create Token +*Conekta::TransactionsApi* | [**get_transaction**](docs/TransactionsApi.md#get_transaction) | **GET** /transactions/{id} | Get transaction +*Conekta::TransactionsApi* | [**get_transactions**](docs/TransactionsApi.md#get_transactions) | **GET** /transactions | Get List transactions +*Conekta::TransfersApi* | [**get_transfer**](docs/TransfersApi.md#get_transfer) | **GET** /transfers/{id} | Get Transfer +*Conekta::TransfersApi* | [**get_transfers**](docs/TransfersApi.md#get_transfers) | **GET** /transfers | Get a list of transfers +*Conekta::WebhookKeysApi* | [**create_webhook_key**](docs/WebhookKeysApi.md#create_webhook_key) | **POST** /webhook_keys | Create Webhook Key +*Conekta::WebhookKeysApi* | [**delete_webhook_key**](docs/WebhookKeysApi.md#delete_webhook_key) | **DELETE** /webhook_keys/{id} | Delete Webhook key +*Conekta::WebhookKeysApi* | [**get_webhook_key**](docs/WebhookKeysApi.md#get_webhook_key) | **GET** /webhook_keys/{id} | Get Webhook Key +*Conekta::WebhookKeysApi* | [**get_webhook_keys**](docs/WebhookKeysApi.md#get_webhook_keys) | **GET** /webhook_keys | Get List of Webhook Keys +*Conekta::WebhookKeysApi* | [**update_webhook_key**](docs/WebhookKeysApi.md#update_webhook_key) | **PUT** /webhook_keys/{id} | Update Webhook Key +*Conekta::WebhooksApi* | [**create_webhook**](docs/WebhooksApi.md#create_webhook) | **POST** /webhooks | Create Webhook +*Conekta::WebhooksApi* | [**delete_webhook**](docs/WebhooksApi.md#delete_webhook) | **DELETE** /webhooks/{id} | Delete Webhook +*Conekta::WebhooksApi* | [**get_webhook**](docs/WebhooksApi.md#get_webhook) | **GET** /webhooks/{id} | Get Webhook +*Conekta::WebhooksApi* | [**get_webhooks**](docs/WebhooksApi.md#get_webhooks) | **GET** /webhooks | Get List of Webhooks +*Conekta::WebhooksApi* | [**test_webhook**](docs/WebhooksApi.md#test_webhook) | **POST** /webhooks/{id}/test | Test Webhook +*Conekta::WebhooksApi* | [**update_webhook**](docs/WebhooksApi.md#update_webhook) | **PUT** /webhooks/{id} | Update Webhook - Make sure that, if you add new features to our library, be sure that corresponding **unit tests** are added. - If you go to your repository on GitHub, you’ll see a Compare & pull request button. Click on that button. +## Documentation for Models -*** + - [Conekta::ApiKeyCreateResponse](docs/ApiKeyCreateResponse.md) + - [Conekta::ApiKeyCreateResponseAllOf](docs/ApiKeyCreateResponseAllOf.md) + - [Conekta::ApiKeyRequest](docs/ApiKeyRequest.md) + - [Conekta::ApiKeyResponse](docs/ApiKeyResponse.md) + - [Conekta::ApiKeyResponseOnDelete](docs/ApiKeyResponseOnDelete.md) + - [Conekta::ApiKeyUpdateRequest](docs/ApiKeyUpdateRequest.md) + - [Conekta::BalanceCommonField](docs/BalanceCommonField.md) + - [Conekta::BalanceResponse](docs/BalanceResponse.md) + - [Conekta::BlacklistRuleResponse](docs/BlacklistRuleResponse.md) + - [Conekta::ChargeDataPaymentMethodBankTransferResponse](docs/ChargeDataPaymentMethodBankTransferResponse.md) + - [Conekta::ChargeDataPaymentMethodCardResponse](docs/ChargeDataPaymentMethodCardResponse.md) + - [Conekta::ChargeDataPaymentMethodCashResponse](docs/ChargeDataPaymentMethodCashResponse.md) + - [Conekta::ChargeOrderResponse](docs/ChargeOrderResponse.md) + - [Conekta::ChargeOrderResponsePaymentMethod](docs/ChargeOrderResponsePaymentMethod.md) + - [Conekta::ChargeRequest](docs/ChargeRequest.md) + - [Conekta::ChargeRequestPaymentMethod](docs/ChargeRequestPaymentMethod.md) + - [Conekta::ChargeResponse](docs/ChargeResponse.md) + - [Conekta::ChargeResponseChannel](docs/ChargeResponseChannel.md) + - [Conekta::ChargeResponsePaymentMethod](docs/ChargeResponsePaymentMethod.md) + - [Conekta::ChargeResponseRefunds](docs/ChargeResponseRefunds.md) + - [Conekta::ChargeResponseRefundsAllOf](docs/ChargeResponseRefundsAllOf.md) + - [Conekta::ChargeResponseRefundsData](docs/ChargeResponseRefundsData.md) + - [Conekta::ChargesDataResponse](docs/ChargesDataResponse.md) + - [Conekta::Checkout](docs/Checkout.md) + - [Conekta::CheckoutOrderTemplate](docs/CheckoutOrderTemplate.md) + - [Conekta::CheckoutOrderTemplateCustomerInfo](docs/CheckoutOrderTemplateCustomerInfo.md) + - [Conekta::CheckoutRequest](docs/CheckoutRequest.md) + - [Conekta::CheckoutResponse](docs/CheckoutResponse.md) + - [Conekta::CheckoutsResponse](docs/CheckoutsResponse.md) + - [Conekta::CheckoutsResponseAllOf](docs/CheckoutsResponseAllOf.md) + - [Conekta::CompanyFiscalInfoAddressResponse](docs/CompanyFiscalInfoAddressResponse.md) + - [Conekta::CompanyFiscalInfoResponse](docs/CompanyFiscalInfoResponse.md) + - [Conekta::CompanyPayoutDestinationResponse](docs/CompanyPayoutDestinationResponse.md) + - [Conekta::CompanyResponse](docs/CompanyResponse.md) + - [Conekta::CreateCustomerFiscalEntitiesResponse](docs/CreateCustomerFiscalEntitiesResponse.md) + - [Conekta::CreateCustomerFiscalEntitiesResponseAllOf](docs/CreateCustomerFiscalEntitiesResponseAllOf.md) + - [Conekta::CreateCustomerPaymentMethodsRequest](docs/CreateCustomerPaymentMethodsRequest.md) + - [Conekta::CreateCustomerPaymentMethodsResponse](docs/CreateCustomerPaymentMethodsResponse.md) + - [Conekta::CreateRiskRulesData](docs/CreateRiskRulesData.md) + - [Conekta::Customer](docs/Customer.md) + - [Conekta::CustomerAddress](docs/CustomerAddress.md) + - [Conekta::CustomerAntifraudInfo](docs/CustomerAntifraudInfo.md) + - [Conekta::CustomerAntifraudInfoResponse](docs/CustomerAntifraudInfoResponse.md) + - [Conekta::CustomerFiscalEntitiesDataResponse](docs/CustomerFiscalEntitiesDataResponse.md) + - [Conekta::CustomerFiscalEntitiesRequest](docs/CustomerFiscalEntitiesRequest.md) + - [Conekta::CustomerFiscalEntitiesRequestAddress](docs/CustomerFiscalEntitiesRequestAddress.md) + - [Conekta::CustomerFiscalEntitiesResponse](docs/CustomerFiscalEntitiesResponse.md) + - [Conekta::CustomerFiscalEntitiesResponseAllOf](docs/CustomerFiscalEntitiesResponseAllOf.md) + - [Conekta::CustomerInfo](docs/CustomerInfo.md) + - [Conekta::CustomerInfoJustCustomerId](docs/CustomerInfoJustCustomerId.md) + - [Conekta::CustomerInfoJustCustomerIdResponse](docs/CustomerInfoJustCustomerIdResponse.md) + - [Conekta::CustomerInfoResponse](docs/CustomerInfoResponse.md) + - [Conekta::CustomerPaymentMethodRequest](docs/CustomerPaymentMethodRequest.md) + - [Conekta::CustomerPaymentMethods](docs/CustomerPaymentMethods.md) + - [Conekta::CustomerPaymentMethodsData](docs/CustomerPaymentMethodsData.md) + - [Conekta::CustomerPaymentMethodsRequest](docs/CustomerPaymentMethodsRequest.md) + - [Conekta::CustomerPaymentMethodsResponse](docs/CustomerPaymentMethodsResponse.md) + - [Conekta::CustomerResponse](docs/CustomerResponse.md) + - [Conekta::CustomerResponseShippingContacts](docs/CustomerResponseShippingContacts.md) + - [Conekta::CustomerResponseShippingContactsAllOf](docs/CustomerResponseShippingContactsAllOf.md) + - [Conekta::CustomerShippingContacts](docs/CustomerShippingContacts.md) + - [Conekta::CustomerShippingContactsAddress](docs/CustomerShippingContactsAddress.md) + - [Conekta::CustomerShippingContactsDataResponse](docs/CustomerShippingContactsDataResponse.md) + - [Conekta::CustomerShippingContactsDataResponseAllOf](docs/CustomerShippingContactsDataResponseAllOf.md) + - [Conekta::CustomerShippingContactsResponse](docs/CustomerShippingContactsResponse.md) + - [Conekta::CustomerShippingContactsResponseAddress](docs/CustomerShippingContactsResponseAddress.md) + - [Conekta::CustomerUpdateFiscalEntitiesRequest](docs/CustomerUpdateFiscalEntitiesRequest.md) + - [Conekta::CustomerUpdateShippingContacts](docs/CustomerUpdateShippingContacts.md) + - [Conekta::CustomersResponse](docs/CustomersResponse.md) + - [Conekta::CustomersResponseAllOf](docs/CustomersResponseAllOf.md) + - [Conekta::DeleteApiKeysResponse](docs/DeleteApiKeysResponse.md) + - [Conekta::DeleteApiKeysResponseAllOf](docs/DeleteApiKeysResponseAllOf.md) + - [Conekta::DeletedBlacklistRuleResponse](docs/DeletedBlacklistRuleResponse.md) + - [Conekta::DeletedWhitelistRuleResponse](docs/DeletedWhitelistRuleResponse.md) + - [Conekta::Details](docs/Details.md) + - [Conekta::DetailsError](docs/DetailsError.md) + - [Conekta::DiscountLinesDataResponse](docs/DiscountLinesDataResponse.md) + - [Conekta::DiscountLinesResponse](docs/DiscountLinesResponse.md) + - [Conekta::DiscountLinesResponseAllOf](docs/DiscountLinesResponseAllOf.md) + - [Conekta::EmailCheckoutRequest](docs/EmailCheckoutRequest.md) + - [Conekta::Error](docs/Error.md) + - [Conekta::ErrorAllOf](docs/ErrorAllOf.md) + - [Conekta::EventResponse](docs/EventResponse.md) + - [Conekta::EventsResendResponse](docs/EventsResendResponse.md) + - [Conekta::GetApiKeysResponse](docs/GetApiKeysResponse.md) + - [Conekta::GetApiKeysResponseAllOf](docs/GetApiKeysResponseAllOf.md) + - [Conekta::GetChargesResponse](docs/GetChargesResponse.md) + - [Conekta::GetChargesResponseAllOf](docs/GetChargesResponseAllOf.md) + - [Conekta::GetCompaniesResponse](docs/GetCompaniesResponse.md) + - [Conekta::GetCompaniesResponseAllOf](docs/GetCompaniesResponseAllOf.md) + - [Conekta::GetCustomerPaymentMethodDataResponse](docs/GetCustomerPaymentMethodDataResponse.md) + - [Conekta::GetEventsResponse](docs/GetEventsResponse.md) + - [Conekta::GetEventsResponseAllOf](docs/GetEventsResponseAllOf.md) + - [Conekta::GetOrderDiscountLinesResponse](docs/GetOrderDiscountLinesResponse.md) + - [Conekta::GetOrderDiscountLinesResponseAllOf](docs/GetOrderDiscountLinesResponseAllOf.md) + - [Conekta::GetOrdersResponse](docs/GetOrdersResponse.md) + - [Conekta::GetPaymentMethodResponse](docs/GetPaymentMethodResponse.md) + - [Conekta::GetPaymentMethodResponseAllOf](docs/GetPaymentMethodResponseAllOf.md) + - [Conekta::GetPlansResponse](docs/GetPlansResponse.md) + - [Conekta::GetPlansResponseAllOf](docs/GetPlansResponseAllOf.md) + - [Conekta::GetTransactionsResponse](docs/GetTransactionsResponse.md) + - [Conekta::GetTransactionsResponseAllOf](docs/GetTransactionsResponseAllOf.md) + - [Conekta::GetTransfersResponse](docs/GetTransfersResponse.md) + - [Conekta::GetTransfersResponseAllOf](docs/GetTransfersResponseAllOf.md) + - [Conekta::GetWebhookKeysResponse](docs/GetWebhookKeysResponse.md) + - [Conekta::GetWebhookKeysResponseAllOf](docs/GetWebhookKeysResponseAllOf.md) + - [Conekta::GetWebhooksResponse](docs/GetWebhooksResponse.md) + - [Conekta::GetWebhooksResponseAllOf](docs/GetWebhooksResponseAllOf.md) + - [Conekta::LogResponse](docs/LogResponse.md) + - [Conekta::LogsResponse](docs/LogsResponse.md) + - [Conekta::LogsResponseData](docs/LogsResponseData.md) + - [Conekta::OrderCaptureRequest](docs/OrderCaptureRequest.md) + - [Conekta::OrderDiscountLinesRequest](docs/OrderDiscountLinesRequest.md) + - [Conekta::OrderRefundRequest](docs/OrderRefundRequest.md) + - [Conekta::OrderRequest](docs/OrderRequest.md) + - [Conekta::OrderRequestCustomerInfo](docs/OrderRequestCustomerInfo.md) + - [Conekta::OrderResponse](docs/OrderResponse.md) + - [Conekta::OrderResponseCharges](docs/OrderResponseCharges.md) + - [Conekta::OrderResponseChargesAllOf](docs/OrderResponseChargesAllOf.md) + - [Conekta::OrderResponseCheckout](docs/OrderResponseCheckout.md) + - [Conekta::OrderResponseCustomerInfo](docs/OrderResponseCustomerInfo.md) + - [Conekta::OrderResponseCustomerInfoAllOf](docs/OrderResponseCustomerInfoAllOf.md) + - [Conekta::OrderResponseDiscountLines](docs/OrderResponseDiscountLines.md) + - [Conekta::OrderResponseDiscountLinesAllOf](docs/OrderResponseDiscountLinesAllOf.md) + - [Conekta::OrderResponseFiscalEntity](docs/OrderResponseFiscalEntity.md) + - [Conekta::OrderResponseFiscalEntityAddress](docs/OrderResponseFiscalEntityAddress.md) + - [Conekta::OrderResponseFiscalEntityAddressAllOf](docs/OrderResponseFiscalEntityAddressAllOf.md) + - [Conekta::OrderResponseProducts](docs/OrderResponseProducts.md) + - [Conekta::OrderResponseProductsAllOf](docs/OrderResponseProductsAllOf.md) + - [Conekta::OrderResponseShippingContact](docs/OrderResponseShippingContact.md) + - [Conekta::OrderResponseShippingContactAllOf](docs/OrderResponseShippingContactAllOf.md) + - [Conekta::OrderTaxRequest](docs/OrderTaxRequest.md) + - [Conekta::OrderUpdateRequest](docs/OrderUpdateRequest.md) + - [Conekta::OrderUpdateRequestCustomerInfo](docs/OrderUpdateRequestCustomerInfo.md) + - [Conekta::OrdersResponse](docs/OrdersResponse.md) + - [Conekta::Page](docs/Page.md) + - [Conekta::Pagination](docs/Pagination.md) + - [Conekta::PaymentMethod](docs/PaymentMethod.md) + - [Conekta::PaymentMethodBankTransfer](docs/PaymentMethodBankTransfer.md) + - [Conekta::PaymentMethodCard](docs/PaymentMethodCard.md) + - [Conekta::PaymentMethodCardRequest](docs/PaymentMethodCardRequest.md) + - [Conekta::PaymentMethodCardRequestAllOf](docs/PaymentMethodCardRequestAllOf.md) + - [Conekta::PaymentMethodCardResponse](docs/PaymentMethodCardResponse.md) + - [Conekta::PaymentMethodCardResponseAllOf](docs/PaymentMethodCardResponseAllOf.md) + - [Conekta::PaymentMethodCash](docs/PaymentMethodCash.md) + - [Conekta::PaymentMethodCashRequest](docs/PaymentMethodCashRequest.md) + - [Conekta::PaymentMethodCashRequestAllOf](docs/PaymentMethodCashRequestAllOf.md) + - [Conekta::PaymentMethodCashResponse](docs/PaymentMethodCashResponse.md) + - [Conekta::PaymentMethodCashResponseAllOf](docs/PaymentMethodCashResponseAllOf.md) + - [Conekta::PaymentMethodResponse](docs/PaymentMethodResponse.md) + - [Conekta::PaymentMethodSpeiRecurrent](docs/PaymentMethodSpeiRecurrent.md) + - [Conekta::PaymentMethodSpeiRecurrentAllOf](docs/PaymentMethodSpeiRecurrentAllOf.md) + - [Conekta::PaymentMethodSpeiRequest](docs/PaymentMethodSpeiRequest.md) + - [Conekta::PlanRequest](docs/PlanRequest.md) + - [Conekta::PlanResponse](docs/PlanResponse.md) + - [Conekta::PlanUpdateRequest](docs/PlanUpdateRequest.md) + - [Conekta::Product](docs/Product.md) + - [Conekta::ProductDataResponse](docs/ProductDataResponse.md) + - [Conekta::ProductDataResponseAllOf](docs/ProductDataResponseAllOf.md) + - [Conekta::ProductOrderResponse](docs/ProductOrderResponse.md) + - [Conekta::ProductOrderResponseAllOf](docs/ProductOrderResponseAllOf.md) + - [Conekta::RiskRules](docs/RiskRules.md) + - [Conekta::RiskRulesData](docs/RiskRulesData.md) + - [Conekta::RiskRulesList](docs/RiskRulesList.md) + - [Conekta::ShippingOrderResponse](docs/ShippingOrderResponse.md) + - [Conekta::ShippingRequest](docs/ShippingRequest.md) + - [Conekta::SmsCheckoutRequest](docs/SmsCheckoutRequest.md) + - [Conekta::SubscriptionEventsResponse](docs/SubscriptionEventsResponse.md) + - [Conekta::SubscriptionRequest](docs/SubscriptionRequest.md) + - [Conekta::SubscriptionResponse](docs/SubscriptionResponse.md) + - [Conekta::SubscriptionUpdateRequest](docs/SubscriptionUpdateRequest.md) + - [Conekta::Token](docs/Token.md) + - [Conekta::TokenCard](docs/TokenCard.md) + - [Conekta::TokenCheckout](docs/TokenCheckout.md) + - [Conekta::TokenResponse](docs/TokenResponse.md) + - [Conekta::TokenResponseCheckout](docs/TokenResponseCheckout.md) + - [Conekta::TransactionResponse](docs/TransactionResponse.md) + - [Conekta::TransferDestinationResponse](docs/TransferDestinationResponse.md) + - [Conekta::TransferMethodResponse](docs/TransferMethodResponse.md) + - [Conekta::TransferResponse](docs/TransferResponse.md) + - [Conekta::TransfersResponse](docs/TransfersResponse.md) + - [Conekta::UpdateCustomer](docs/UpdateCustomer.md) + - [Conekta::UpdateCustomerAntifraudInfo](docs/UpdateCustomerAntifraudInfo.md) + - [Conekta::UpdateCustomerFiscalEntitiesResponse](docs/UpdateCustomerFiscalEntitiesResponse.md) + - [Conekta::UpdateCustomerFiscalEntitiesResponseAllOf](docs/UpdateCustomerFiscalEntitiesResponseAllOf.md) + - [Conekta::UpdateCustomerPaymentMethodsResponse](docs/UpdateCustomerPaymentMethodsResponse.md) + - [Conekta::UpdateOrderDiscountLinesRequest](docs/UpdateOrderDiscountLinesRequest.md) + - [Conekta::UpdateOrderTaxRequest](docs/UpdateOrderTaxRequest.md) + - [Conekta::UpdateOrderTaxResponse](docs/UpdateOrderTaxResponse.md) + - [Conekta::UpdateOrderTaxResponseAllOf](docs/UpdateOrderTaxResponseAllOf.md) + - [Conekta::UpdatePaymentMethods](docs/UpdatePaymentMethods.md) + - [Conekta::UpdateProduct](docs/UpdateProduct.md) + - [Conekta::WebhookKeyCreateResponse](docs/WebhookKeyCreateResponse.md) + - [Conekta::WebhookKeyDeleteResponse](docs/WebhookKeyDeleteResponse.md) + - [Conekta::WebhookKeyRequest](docs/WebhookKeyRequest.md) + - [Conekta::WebhookKeyResponse](docs/WebhookKeyResponse.md) + - [Conekta::WebhookKeyUpdateRequest](docs/WebhookKeyUpdateRequest.md) + - [Conekta::WebhookLog](docs/WebhookLog.md) + - [Conekta::WebhookRequest](docs/WebhookRequest.md) + - [Conekta::WebhookResponse](docs/WebhookResponse.md) + - [Conekta::WebhookUpdateRequest](docs/WebhookUpdateRequest.md) + - [Conekta::WhitelistlistRuleResponse](docs/WhitelistlistRuleResponse.md) -## We are always hiring! -If you are a comfortable working with a range of backend languages (Java, Python, Ruby, PHP, etc) and frameworks, you have solid foundation in data structures, algorithms and software design with strong analytical and debugging skills, check our open positions: https://www.conekta.com/careers +## Documentation for Authorization -### License -
+Authentication schemes defined for the API: +### bearerAuth -Developed in :mexico: Mexico by [Conekta](https://www.conekta.com). Available with [MIT License](LICENSE). +- **Type**: Bearer authentication -
diff --git a/Rakefile b/Rakefile index 2995527..c72ca30 100644 --- a/Rakefile +++ b/Rakefile @@ -1 +1,10 @@ require "bundler/gem_tasks" + +begin + require 'rspec/core/rake_task' + + RSpec::Core::RakeTask.new(:spec) + task default: :spec +rescue LoadError + # no rspec available +end diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..09b254e --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +6.0.0 diff --git a/conekta.gemspec b/conekta.gemspec index a7430cb..eccd259 100644 --- a/conekta.gemspec +++ b/conekta.gemspec @@ -1,30 +1,39 @@ -# coding: utf-8 -lib = File.expand_path('../lib', __FILE__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'conekta/version' - -Gem::Specification.new do |spec| - spec.name = "conekta" - spec.version = Conekta::VERSION - spec.authors = ["Conekta"] - spec.email = ["soporte@conekta.com"] - spec.description = %q{Ruby library for https://api.conekta.io} - spec.summary = %q{This library provides https://api.conekta.io operations} - spec.homepage = "https://www.conekta.com" - spec.license = "MIT" - - spec.files = `git ls-files`.split($/) - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - spec.require_paths = ["lib"] - - spec.add_dependency "bundler", ">= 1.3" - spec.add_dependency "rake" - spec.add_dependency "faraday" - spec.add_dependency "json" - spec.add_dependency "sys-uname" - spec.add_dependency "i18n" - - spec.add_development_dependency "rspec", ">= 3.0" - spec.add_development_dependency "pry" +# -*- encoding: utf-8 -*- + +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +$:.push File.expand_path("../lib", __FILE__) +require "conekta/version" + +Gem::Specification.new do |s| + s.name = "conekta" + s.version = Conekta::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ["Conekta"] + s.email = ["core@conekta.com"] + s.homepage = "https://www.conekta.com" + s.summary = "%q{This library provides https://api.conekta.io operations}" + s.description = "%q{Ruby library for https://api.conekta.io}" + s.license = "MIT" + s.required_ruby_version = ">= 2.6" + + s.add_runtime_dependency 'faraday', '>= 1.0.1', '< 3.0' + s.add_runtime_dependency 'faraday-multipart' + + s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' + + s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? } + s.test_files = `find spec/*`.split("\n") + s.executables = [] + s.require_paths = ["lib"] end diff --git a/conekta.png b/conekta.png new file mode 100644 index 0000000..9c52ff9 Binary files /dev/null and b/conekta.png differ diff --git a/docs/AntifraudApi.md b/docs/AntifraudApi.md new file mode 100644 index 0000000..e7ca401 --- /dev/null +++ b/docs/AntifraudApi.md @@ -0,0 +1,443 @@ +# Conekta::AntifraudApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_rule_blacklist**](AntifraudApi.md#create_rule_blacklist) | **POST** /antifraud/blacklists | Create blacklisted rule | +| [**create_rule_whitelist**](AntifraudApi.md#create_rule_whitelist) | **POST** /antifraud/whitelists | Create whitelisted rule | +| [**delete_rule_blacklist**](AntifraudApi.md#delete_rule_blacklist) | **DELETE** /antifraud/blacklists/{id} | Delete blacklisted rule | +| [**delete_rule_whitelist**](AntifraudApi.md#delete_rule_whitelist) | **DELETE** /antifraud/whitelists/{id} | Delete whitelisted rule | +| [**get_rule_blacklist**](AntifraudApi.md#get_rule_blacklist) | **GET** /antifraud/blacklists | Get list of blacklisted rules | +| [**get_rule_whitelist**](AntifraudApi.md#get_rule_whitelist) | **GET** /antifraud/whitelists | Get a list of whitelisted rules | + + +## create_rule_blacklist + +> create_rule_blacklist(create_risk_rules_data, opts) + +Create blacklisted rule + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::AntifraudApi.new +create_risk_rules_data = Conekta::CreateRiskRulesData.new({description: 'this client email was verified at 20/09/22 by internal process', field: 'email | phone | card_token', value: 'email@example.com | 818081808180 | src_2qUCNd5AyQqfPMBuV'}) # CreateRiskRulesData | requested field for blacklist rule +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Create blacklisted rule + result = api_instance.create_rule_blacklist(create_risk_rules_data, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->create_rule_blacklist: #{e}" +end +``` + +#### Using the create_rule_blacklist_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_rule_blacklist_with_http_info(create_risk_rules_data, opts) + +```ruby +begin + # Create blacklisted rule + data, status_code, headers = api_instance.create_rule_blacklist_with_http_info(create_risk_rules_data, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->create_rule_blacklist_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **create_risk_rules_data** | [**CreateRiskRulesData**](CreateRiskRulesData.md) | requested field for blacklist rule | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**BlacklistRuleResponse**](BlacklistRuleResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## create_rule_whitelist + +> create_rule_whitelist(opts) + +Create whitelisted rule + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::AntifraudApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + create_risk_rules_data: Conekta::CreateRiskRulesData.new({description: 'this client email was verified at 20/09/22 by internal process', field: 'email | phone | card_token', value: 'email@example.com | 818081808180 | src_2qUCNd5AyQqfPMBuV'}) # CreateRiskRulesData | +} + +begin + # Create whitelisted rule + result = api_instance.create_rule_whitelist(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->create_rule_whitelist: #{e}" +end +``` + +#### Using the create_rule_whitelist_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_rule_whitelist_with_http_info(opts) + +```ruby +begin + # Create whitelisted rule + data, status_code, headers = api_instance.create_rule_whitelist_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->create_rule_whitelist_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **create_risk_rules_data** | [**CreateRiskRulesData**](CreateRiskRulesData.md) | | [optional] | + +### Return type + +[**WhitelistlistRuleResponse**](WhitelistlistRuleResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## delete_rule_blacklist + +> delete_rule_blacklist(id, opts) + +Delete blacklisted rule + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::AntifraudApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Delete blacklisted rule + result = api_instance.delete_rule_blacklist(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->delete_rule_blacklist: #{e}" +end +``` + +#### Using the delete_rule_blacklist_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_rule_blacklist_with_http_info(id, opts) + +```ruby +begin + # Delete blacklisted rule + data, status_code, headers = api_instance.delete_rule_blacklist_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->delete_rule_blacklist_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**DeletedBlacklistRuleResponse**](DeletedBlacklistRuleResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## delete_rule_whitelist + +> delete_rule_whitelist(id, opts) + +Delete whitelisted rule + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::AntifraudApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Delete whitelisted rule + result = api_instance.delete_rule_whitelist(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->delete_rule_whitelist: #{e}" +end +``` + +#### Using the delete_rule_whitelist_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_rule_whitelist_with_http_info(id, opts) + +```ruby +begin + # Delete whitelisted rule + data, status_code, headers = api_instance.delete_rule_whitelist_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->delete_rule_whitelist_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**DeletedWhitelistRuleResponse**](DeletedWhitelistRuleResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_rule_blacklist + +> get_rule_blacklist(opts) + +Get list of blacklisted rules + +Return all rules + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::AntifraudApi.new +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Get list of blacklisted rules + result = api_instance.get_rule_blacklist(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->get_rule_blacklist: #{e}" +end +``` + +#### Using the get_rule_blacklist_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_rule_blacklist_with_http_info(opts) + +```ruby +begin + # Get list of blacklisted rules + data, status_code, headers = api_instance.get_rule_blacklist_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->get_rule_blacklist_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**RiskRulesList**](RiskRulesList.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_rule_whitelist + +> get_rule_whitelist(opts) + +Get a list of whitelisted rules + +Return all rules + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::AntifraudApi.new +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Get a list of whitelisted rules + result = api_instance.get_rule_whitelist(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->get_rule_whitelist: #{e}" +end +``` + +#### Using the get_rule_whitelist_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_rule_whitelist_with_http_info(opts) + +```ruby +begin + # Get a list of whitelisted rules + data, status_code, headers = api_instance.get_rule_whitelist_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling AntifraudApi->get_rule_whitelist_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**RiskRulesList**](RiskRulesList.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/ApiKeyCreateResponse.md b/docs/ApiKeyCreateResponse.md new file mode 100644 index 0000000..7ae1245 --- /dev/null +++ b/docs/ApiKeyCreateResponse.md @@ -0,0 +1,40 @@ +# Conekta::ApiKeyCreateResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **authentication_token** | **String** | It is occupied as a user when authenticated with basic authentication, with a blank password. This value will only appear once, in the request to create a new key. Copy and save it in a safe place. | [optional] | +| **active** | **Boolean** | Indicates if the api key is active | [optional] | +| **created_at** | **Integer** | Unix timestamp in seconds of when the api key was created | [optional] | +| **updated_at** | **Integer** | Unix timestamp in seconds of when the api key was last updated | [optional] | +| **deactivated_at** | **Integer** | Unix timestamp in seconds of when the api key was deleted | [optional] | +| **description** | **String** | A name or brief explanation of what this api key is used for | [optional] | +| **id** | **String** | Unique identifier of the api key | [optional] | +| **livemode** | **Boolean** | Indicates if the api key is in production | [optional] | +| **deleted** | **Boolean** | Indicates if the api key was deleted | [optional] | +| **object** | **String** | Object name, value is 'api_key' | [optional] | +| **prefix** | **String** | The first few characters of the authentication_token | [optional] | +| **role** | **String** | Indicates if the api key is private or public | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ApiKeyCreateResponse.new( + authentication_token: key_rpHzxufNgjFCdprEEFZRTKi, + active: true, + created_at: 1684167881, + updated_at: 1684167923, + deactivated_at: null, + description: online store, + id: 64625cc9f3e02c00163f5e4d, + livemode: false, + deleted: false, + object: api_key, + prefix: key_rp, + role: private +) +``` + diff --git a/docs/ApiKeyCreateResponseAllOf.md b/docs/ApiKeyCreateResponseAllOf.md new file mode 100644 index 0000000..1c84d8b --- /dev/null +++ b/docs/ApiKeyCreateResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::ApiKeyCreateResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **authentication_token** | **String** | It is occupied as a user when authenticated with basic authentication, with a blank password. This value will only appear once, in the request to create a new key. Copy and save it in a safe place. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ApiKeyCreateResponseAllOf.new( + authentication_token: key_rpHzxufNgjFCdprEEFZRTKi +) +``` + diff --git a/docs/ApiKeyRequest.md b/docs/ApiKeyRequest.md new file mode 100644 index 0000000..0a8b8b9 --- /dev/null +++ b/docs/ApiKeyRequest.md @@ -0,0 +1,20 @@ +# Conekta::ApiKeyRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **description** | **String** | A name or brief explanation of what this api key is used for | [optional] | +| **role** | **String** | | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ApiKeyRequest.new( + description: online store, + role: private +) +``` + diff --git a/docs/ApiKeyResponse.md b/docs/ApiKeyResponse.md new file mode 100644 index 0000000..3d9b2b9 --- /dev/null +++ b/docs/ApiKeyResponse.md @@ -0,0 +1,38 @@ +# Conekta::ApiKeyResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **active** | **Boolean** | Indicates if the api key is active | [optional] | +| **created_at** | **Integer** | Unix timestamp in seconds of when the api key was created | [optional] | +| **updated_at** | **Integer** | Unix timestamp in seconds of when the api key was last updated | [optional] | +| **deactivated_at** | **Integer** | Unix timestamp in seconds of when the api key was deleted | [optional] | +| **description** | **String** | A name or brief explanation of what this api key is used for | [optional] | +| **id** | **String** | Unique identifier of the api key | [optional] | +| **livemode** | **Boolean** | Indicates if the api key is in production | [optional] | +| **deleted** | **Boolean** | Indicates if the api key was deleted | [optional] | +| **object** | **String** | Object name, value is 'api_key' | [optional] | +| **prefix** | **String** | The first few characters of the authentication_token | [optional] | +| **role** | **String** | Indicates if the api key is private or public | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ApiKeyResponse.new( + active: true, + created_at: 1684167881, + updated_at: 1684167923, + deactivated_at: null, + description: online store, + id: 64625cc9f3e02c00163f5e4d, + livemode: false, + deleted: false, + object: api_key, + prefix: key_rp, + role: private +) +``` + diff --git a/docs/ApiKeyResponseOnDelete.md b/docs/ApiKeyResponseOnDelete.md new file mode 100644 index 0000000..a164fee --- /dev/null +++ b/docs/ApiKeyResponseOnDelete.md @@ -0,0 +1,34 @@ +# Conekta::ApiKeyResponseOnDelete + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **active** | **Boolean** | Indicates if the api key is active | [optional] | +| **created_at** | **Integer** | Unix timestamp in seconds of when the api key was created | [optional] | +| **description** | **String** | A name or brief explanation of what this api key is used for | [optional] | +| **livemode** | **Boolean** | Indicates if the api key is in production | [optional] | +| **prefix** | **String** | The first few characters of the authentication_token | [optional] | +| **id** | **String** | Unique identifier of the api key | [optional] | +| **object** | **String** | Object name, value is 'api_key' | [optional] | +| **deleted** | **Boolean** | Indicates if the api key was deleted | [optional] | +| **role** | **String** | Indicates if the api key is private or public | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ApiKeyResponseOnDelete.new( + active: true, + created_at: 1684167881, + description: online store, + livemode: false, + prefix: key_rp, + id: 64625cc9f3e02c00163f5e4d, + object: api_key, + deleted: false, + role: private +) +``` + diff --git a/docs/ApiKeyUpdateRequest.md b/docs/ApiKeyUpdateRequest.md new file mode 100644 index 0000000..c4e1f94 --- /dev/null +++ b/docs/ApiKeyUpdateRequest.md @@ -0,0 +1,20 @@ +# Conekta::ApiKeyUpdateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **active** | **Boolean** | Indicates if the webhook key is active | [optional] | +| **description** | **String** | A name or brief explanation of what this api key is used for | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ApiKeyUpdateRequest.new( + active: true, + description: online store +) +``` + diff --git a/docs/ApiKeysApi.md b/docs/ApiKeysApi.md new file mode 100644 index 0000000..d1db1be --- /dev/null +++ b/docs/ApiKeysApi.md @@ -0,0 +1,391 @@ +# Conekta::ApiKeysApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_api_key**](ApiKeysApi.md#create_api_key) | **POST** /api_keys | Create Api Key | +| [**delete_api_key**](ApiKeysApi.md#delete_api_key) | **DELETE** /api_keys/{id} | Delete Api Key | +| [**get_api_key**](ApiKeysApi.md#get_api_key) | **GET** /api_keys/{id} | Get Api Key | +| [**get_api_keys**](ApiKeysApi.md#get_api_keys) | **GET** /api_keys | Get list of Api Keys | +| [**update_api_key**](ApiKeysApi.md#update_api_key) | **PUT** /api_keys/{id} | Update Api Key | + + +## create_api_key + +> create_api_key(api_key_request, opts) + +Create Api Key + +Create a api key + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ApiKeysApi.new +api_key_request = Conekta::ApiKeyRequest.new({role: 'private'}) # ApiKeyRequest | requested field for a api keys +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Api Key + result = api_instance.create_api_key(api_key_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->create_api_key: #{e}" +end +``` + +#### Using the create_api_key_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_api_key_with_http_info(api_key_request, opts) + +```ruby +begin + # Create Api Key + data, status_code, headers = api_instance.create_api_key_with_http_info(api_key_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->create_api_key_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **api_key_request** | [**ApiKeyRequest**](ApiKeyRequest.md) | requested field for a api keys | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ApiKeyCreateResponse**](ApiKeyCreateResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## delete_api_key + +> delete_api_key(id, opts) + +Delete Api Key + +Deletes a api key that corresponds to a api key ID + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ApiKeysApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Delete Api Key + result = api_instance.delete_api_key(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->delete_api_key: #{e}" +end +``` + +#### Using the delete_api_key_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_api_key_with_http_info(id, opts) + +```ruby +begin + # Delete Api Key + data, status_code, headers = api_instance.delete_api_key_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->delete_api_key_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**DeleteApiKeysResponse**](DeleteApiKeysResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_api_key + +> get_api_key(id, opts) + +Get Api Key + +Gets a api key that corresponds to a api key ID + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ApiKeysApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Api Key + result = api_instance.get_api_key(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->get_api_key: #{e}" +end +``` + +#### Using the get_api_key_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_api_key_with_http_info(id, opts) + +```ruby +begin + # Get Api Key + data, status_code, headers = api_instance.get_api_key_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->get_api_key_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ApiKeyResponse**](ApiKeyResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_api_keys + +> get_api_keys(opts) + +Get list of Api Keys + +Consume the list of api keys you have + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ApiKeysApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + _next: '_next_example', # String | next page + previous: 'previous_example', # String | previous page + search: 'search_example' # String | General search, e.g. by id, description, prefix +} + +begin + # Get list of Api Keys + result = api_instance.get_api_keys(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->get_api_keys: #{e}" +end +``` + +#### Using the get_api_keys_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_api_keys_with_http_info(opts) + +```ruby +begin + # Get list of Api Keys + data, status_code, headers = api_instance.get_api_keys_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->get_api_keys_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | +| **search** | **String** | General search, e.g. by id, description, prefix | [optional] | + +### Return type + +[**GetApiKeysResponse**](GetApiKeysResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_api_key + +> update_api_key(id, opts) + +Update Api Key + +Update an existing api key + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ApiKeysApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + api_key_update_request: Conekta::ApiKeyUpdateRequest.new # ApiKeyUpdateRequest | +} + +begin + # Update Api Key + result = api_instance.update_api_key(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->update_api_key: #{e}" +end +``` + +#### Using the update_api_key_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_api_key_with_http_info(id, opts) + +```ruby +begin + # Update Api Key + data, status_code, headers = api_instance.update_api_key_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ApiKeysApi->update_api_key_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **api_key_update_request** | [**ApiKeyUpdateRequest**](ApiKeyUpdateRequest.md) | | [optional] | + +### Return type + +[**ApiKeyResponse**](ApiKeyResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/BalanceCommonField.md b/docs/BalanceCommonField.md new file mode 100644 index 0000000..95f7f59 --- /dev/null +++ b/docs/BalanceCommonField.md @@ -0,0 +1,20 @@ +# Conekta::BalanceCommonField + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The balance's amount | [optional] | +| **currency** | **String** | The balance's currency | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::BalanceCommonField.new( + amount: 100, + currency: MXN +) +``` + diff --git a/docs/BalanceResponse.md b/docs/BalanceResponse.md new file mode 100644 index 0000000..736ab6d --- /dev/null +++ b/docs/BalanceResponse.md @@ -0,0 +1,36 @@ +# Conekta::BalanceResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **available** | [**Array<BalanceCommonField>**](BalanceCommonField.md) | The balance's available | [optional] | +| **cashout_retention_amount** | [**Array<BalanceCommonField>**](BalanceCommonField.md) | The balance's cashout retention amount | [optional] | +| **conekta_retention** | [**Array<BalanceCommonField>**](BalanceCommonField.md) | The balance's conekta retention | [optional] | +| **gateway** | [**Array<BalanceCommonField>**](BalanceCommonField.md) | The balance's gateway | [optional] | +| **pending** | [**Array<BalanceCommonField>**](BalanceCommonField.md) | The balance's pending | [optional] | +| **retained** | [**Array<BalanceCommonField>**](BalanceCommonField.md) | The balance's retained | [optional] | +| **retention_amount** | [**Array<BalanceCommonField>**](BalanceCommonField.md) | The balance's retention amount | [optional] | +| **target_collateral_amount** | **Object** | The balance's target collateral amount | [optional] | +| **target_retention_amount** | [**Array<BalanceCommonField>**](BalanceCommonField.md) | The balance's target retention amount | [optional] | +| **temporarily_retained** | [**Array<BalanceCommonField>**](BalanceCommonField.md) | The balance's temporarily retained | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::BalanceResponse.new( + available: null, + cashout_retention_amount: null, + conekta_retention: null, + gateway: null, + pending: null, + retained: null, + retention_amount: null, + target_collateral_amount: null, + target_retention_amount: null, + temporarily_retained: null +) +``` + diff --git a/docs/BalancesApi.md b/docs/BalancesApi.md new file mode 100644 index 0000000..5855447 --- /dev/null +++ b/docs/BalancesApi.md @@ -0,0 +1,79 @@ +# Conekta::BalancesApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_balance**](BalancesApi.md#get_balance) | **GET** /balances | Get a company's balance | + + +## get_balance + +> get_balance(opts) + +Get a company's balance + +Get a company's balance + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::BalancesApi.new +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Get a company's balance + result = api_instance.get_balance(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling BalancesApi->get_balance: #{e}" +end +``` + +#### Using the get_balance_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_balance_with_http_info(opts) + +```ruby +begin + # Get a company's balance + data, status_code, headers = api_instance.get_balance_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling BalancesApi->get_balance_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**BalanceResponse**](BalanceResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/BlacklistRuleResponse.md b/docs/BlacklistRuleResponse.md new file mode 100644 index 0000000..8b9c77b --- /dev/null +++ b/docs/BlacklistRuleResponse.md @@ -0,0 +1,24 @@ +# Conekta::BlacklistRuleResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Blacklist rule id | [optional] | +| **field** | **String** | field used for blacklists rule | [optional] | +| **value** | **String** | value used for blacklists rule | [optional] | +| **description** | **String** | use an description for blacklisted rule | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::BlacklistRuleResponse.new( + id: 2fw8EWJusiRrxdPzT, + field: email, + value: email@example.com, + description: secure customer example@example.com +) +``` + diff --git a/docs/ChargeDataPaymentMethodBankTransferResponse.md b/docs/ChargeDataPaymentMethodBankTransferResponse.md new file mode 100644 index 0000000..0ccd359 --- /dev/null +++ b/docs/ChargeDataPaymentMethodBankTransferResponse.md @@ -0,0 +1,48 @@ +# Conekta::ChargeDataPaymentMethodBankTransferResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **bank** | **String** | | [optional] | +| **clabe** | **String** | | [optional] | +| **description** | **String** | | [optional] | +| **executed_at** | **Integer** | | [optional] | +| **expires_at** | **Integer** | | [optional] | +| **issuing_account_bank** | **String** | | [optional] | +| **issuing_account_number** | **String** | | [optional] | +| **issuing_account_holder_name** | **String** | | [optional] | +| **issuing_account_tax_id** | **String** | | [optional] | +| **payment_attempts** | **Array<Object>** | | [optional] | +| **receiving_account_holder_name** | **String** | | [optional] | +| **receiving_account_number** | **String** | | [optional] | +| **receiving_account_bank** | **String** | | [optional] | +| **receiving_account_tax_id** | **String** | | [optional] | +| **reference_number** | **String** | | [optional] | +| **tracking_code** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeDataPaymentMethodBankTransferResponse.new( + bank: STP, + clabe: 646180111805034237, + description: null, + executed_at: null, + expires_at: 1683053729, + issuing_account_bank: null, + issuing_account_number: null, + issuing_account_holder_name: null, + issuing_account_tax_id: null, + payment_attempts: null, + receiving_account_holder_name: null, + receiving_account_number: 646180111805034237, + receiving_account_bank: STP, + receiving_account_tax_id: null, + reference_number: null, + tracking_code: null +) +``` + diff --git a/docs/ChargeDataPaymentMethodCardResponse.md b/docs/ChargeDataPaymentMethodCardResponse.md new file mode 100644 index 0000000..76f6b40 --- /dev/null +++ b/docs/ChargeDataPaymentMethodCardResponse.md @@ -0,0 +1,38 @@ +# Conekta::ChargeDataPaymentMethodCardResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_type** | **String** | | [optional] | +| **auth_code** | **String** | | [optional] | +| **brand** | **String** | | [optional] | +| **contract_id** | **String** | Id sent for recurrent charges. | [optional] | +| **country** | **String** | | [optional] | +| **exp_month** | **String** | | [optional] | +| **exp_year** | **String** | | [optional] | +| **fraud_indicators** | **Array<Object>** | | [optional] | +| **issuer** | **String** | | [optional] | +| **last4** | **String** | | [optional] | +| **name** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeDataPaymentMethodCardResponse.new( + account_type: Credit, + auth_code: 867372, + brand: visa, + contract_id: S781317595, + country: MX, + exp_month: 02, + exp_year: 30, + fraud_indicators: null, + issuer: BANAMEX, + last4: 4242, + name: Fulanito Perez +) +``` + diff --git a/docs/ChargeDataPaymentMethodCashResponse.md b/docs/ChargeDataPaymentMethodCashResponse.md new file mode 100644 index 0000000..0c485c8 --- /dev/null +++ b/docs/ChargeDataPaymentMethodCashResponse.md @@ -0,0 +1,32 @@ +# Conekta::ChargeDataPaymentMethodCashResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **auth_code** | **Integer** | | [optional] | +| **cashier_id** | **String** | | [optional] | +| **reference** | **String** | | [optional] | +| **barcode_url** | **String** | | [optional] | +| **expires_at** | **Integer** | | [optional] | +| **service_name** | **String** | | [optional] | +| **store** | **String** | | [optional] | +| **store_name** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeDataPaymentMethodCashResponse.new( + auth_code: 542563, + cashier_id: OINM01010, + reference: 93000262276908, + barcode_url: https://pt-common-s3-stg.s3.amazonaws.com/644ebf80f2243197aad6cd8810375b905b613dbe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MP4SLLCWV%2F20230203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230203T215750Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH4aCXVzLWVhc3QtMSJGMEQCICd79cu7DYu%2F4%2B3HnVVswydgU9yHcE9kmQIIk2TLoZJrAiBVZ0HxVSeboK5lhdQSqADjwQF62XX35jhC%2F2riB0M8uCqQBAj2%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDc5OTgwMTA4MTY4OCIMXWZds9ZI5hzUdbeGKuQDFreMyeWnWWPqDuGZ2%2BHk6usCr%2Fl096%2FNJh9xtf8htLu56K%2FhWUTx%2BjiqFWM2O%2FF5zTS%2BIV6TqkLDZ%2BQ5Jo1miQrRmR57YDz6uP2Yd1mNZ1ouq5ipnNjUuu5UWCCBAmqyZQsrVmeMQpSV2IB%2BTERCCcW2SukFEYU%2F20%2Fzy5orsoZ8DxOW460IymR3cWBk5u3Xh2cV6Y1RdPEwDEThhqYEF5w%2ByKbLENloMsI%2FUm6sG5PPrO3yQOAP9aK2muLJs9lXQRU%2FL%2FSsmS4FKSUFOqlN6YU%2Bi2Y%2FyGIKAJT2VDkngvz5Sl%2Fadj0j%2BPKftVRV5FcEhySB6Rl%2BSkPN7kVQMJp6pS8hMJ6JCyEA%2BA3eWYdIfKgQhWVXAR4oCBfJ62DH8FU3a7WfSjjpTwfVkiReWen3GGCYfUWETTVKp46MKnJ9PG0CD3KzxKV8VfmEGc5krK%2FI%2F%2BDV2wtSa%2F9qf1%2BK1YYJIK9qZGb25ljUiGhTB4T%2BMUOSQFjetiWUoOJc5Q3Jz%2FXJbiTAMTST39MhdbCgiMgfrc8OGKN5DOVbex33Z7dn0xf%2FOCkSqurhLaG08efKQBdhLNS0RlE9hbg9yZ2ywwtQIF39fI6A7eeH0T11a5HMlvm51u4rAffPHRuEJfwJoIuj%2F2s3QzDg7%2FWeBjqmAbnPOlGfysjrDdvHyG7HVnaX02kdG%2BI3Q4PFOO4Mjaa3ocpjcfPT70%2BZ5a%2FSv5vP0jDLGrLToeM9%2BAUlNepptICRu23a1tLGW4ri0twPA%2FZ4JDTtUUUgdblyG8bKpcUTNp4oOsdmLLBz3FVyr4c2xQbDZSu2zYOtoOxB18W0AC6kIbsMWVU55Bf0mBhPeBWxGrtM4Kw1SgHHlt%2F8vetQi2OwtUcg08c%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=d06dfa41550003359f2aabc8006063a80dfd806a13a54d244024946a76aa9abc, + expires_at: 0, + service_name: OxxoPay, + store: 10MON50EDI, + store_name: OXXO +) +``` + diff --git a/docs/ChargeOrderResponse.md b/docs/ChargeOrderResponse.md new file mode 100644 index 0000000..74a4c6c --- /dev/null +++ b/docs/ChargeOrderResponse.md @@ -0,0 +1,56 @@ +# Conekta::ChargeOrderResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | | [optional] | +| **channel** | [**ChargeResponseChannel**](ChargeResponseChannel.md) | | [optional] | +| **created_at** | **Integer** | | [optional] | +| **currency** | **String** | | [optional] | +| **customer_id** | **String** | | [optional] | +| **description** | **String** | | [optional] | +| **device_fingerprint** | **String** | | [optional] | +| **failure_code** | **String** | | [optional] | +| **failure_message** | **String** | | [optional] | +| **fee** | **Integer** | | [optional] | +| **id** | **String** | | [optional] | +| **livemode** | **Boolean** | | [optional] | +| **monthly_installments** | **Integer** | | [optional] | +| **object** | **String** | | [optional] | +| **order_id** | **String** | | [optional] | +| **paid_at** | **Integer** | | [optional] | +| **payment_method** | [**ChargeOrderResponsePaymentMethod**](ChargeOrderResponsePaymentMethod.md) | | [optional] | +| **reference_id** | **String** | Reference ID of the charge | [optional] | +| **refunds** | **Array<Object>** | | [optional] | +| **status** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeOrderResponse.new( + amount: 4321, + channel: null, + created_at: 1676386026, + currency: MXN, + customer_id: null, + description: Payment from order, + device_fingerprint: 6FR3chaU4Y1nGAW5NAGd1rcjAKa142Ba, + failure_code: suspected_fraud, + failure_message: Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso., + fee: 1160, + id: 63efa757cf65380001aec040, + livemode: true, + monthly_installments: null, + object: null, + order_id: ord_2tN73UdUSNrYRPD9r, + paid_at: 1676390742, + payment_method: null, + reference_id: ref_2tN73UdUSNrYRPD9r, + refunds: null, + status: pending_payment +) +``` + diff --git a/docs/ChargeOrderResponsePaymentMethod.md b/docs/ChargeOrderResponsePaymentMethod.md new file mode 100644 index 0000000..8ce10ef --- /dev/null +++ b/docs/ChargeOrderResponsePaymentMethod.md @@ -0,0 +1,82 @@ +# Conekta::ChargeOrderResponsePaymentMethod + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::ChargeOrderResponsePaymentMethod.openapi_one_of +# => +# [ +# :'PaymentMethodBankTransfer', +# :'PaymentMethodCard', +# :'PaymentMethodCash' +# ] +``` + +### `openapi_discriminator_name` + +Returns the discriminator's property name. + +#### Example + +```ruby +require 'conekta' + +Conekta::ChargeOrderResponsePaymentMethod.openapi_discriminator_name +# => :'object' +``` + +### `openapi_discriminator_name` + +Returns the discriminator's mapping. + +#### Example + +```ruby +require 'conekta' + +Conekta::ChargeOrderResponsePaymentMethod.openapi_discriminator_mapping +# => +# { +# :'bank_transfer_payment' => :'PaymentMethodBankTransfer', +# :'card_payment' => :'PaymentMethodCard', +# :'cash_payment' => :'PaymentMethodCash' +# } +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::ChargeOrderResponsePaymentMethod.build(data) +# => # + +Conekta::ChargeOrderResponsePaymentMethod.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `PaymentMethodBankTransfer` +- `PaymentMethodCard` +- `PaymentMethodCash` +- `nil` (if no type matches) + diff --git a/docs/ChargeRequest.md b/docs/ChargeRequest.md new file mode 100644 index 0000000..27ab7b5 --- /dev/null +++ b/docs/ChargeRequest.md @@ -0,0 +1,24 @@ +# Conekta::ChargeRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | | [optional] | +| **monthly_installments** | **Integer** | How many months without interest to apply, it can be 3, 6, 9, 12 or 18 | [optional] | +| **payment_method** | [**ChargeRequestPaymentMethod**](ChargeRequestPaymentMethod.md) | | | +| **reference_id** | **String** | Custom reference to add to the charge | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeRequest.new( + amount: 40000, + monthly_installments: null, + payment_method: null, + reference_id: null +) +``` + diff --git a/docs/ChargeRequestPaymentMethod.md b/docs/ChargeRequestPaymentMethod.md new file mode 100644 index 0000000..d0f5e74 --- /dev/null +++ b/docs/ChargeRequestPaymentMethod.md @@ -0,0 +1,26 @@ +# Conekta::ChargeRequestPaymentMethod + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **expires_at** | **Integer** | Method expiration date as unix timestamp | [optional] | +| **type** | **String** | | | +| **token_id** | **String** | | [optional] | +| **payment_source_id** | **String** | | [optional] | +| **contract_id** | **String** | Optional id sent to indicate the bank contract for recurrent card charges. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeRequestPaymentMethod.new( + expires_at: 1677196303, + type: card, + token_id: tok_2897348234, + payment_source_id: src_2tLkkyfMPh6v7pFry, + contract_id: S781317595 +) +``` + diff --git a/docs/ChargeResponse.md b/docs/ChargeResponse.md new file mode 100644 index 0000000..a7b2120 --- /dev/null +++ b/docs/ChargeResponse.md @@ -0,0 +1,54 @@ +# Conekta::ChargeResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | | [optional] | +| **channel** | [**ChargeResponseChannel**](ChargeResponseChannel.md) | | [optional] | +| **created_at** | **Integer** | | [optional] | +| **currency** | **String** | | [optional] | +| **customer_id** | **String** | | [optional] | +| **description** | **String** | | [optional] | +| **device_fingerprint** | **String** | | [optional] | +| **failure_code** | **String** | | [optional] | +| **failure_message** | **String** | | [optional] | +| **fee** | **Integer** | | [optional] | +| **id** | **String** | | [optional] | +| **livemode** | **Boolean** | | [optional] | +| **object** | **String** | | [optional] | +| **order_id** | **String** | | [optional] | +| **paid_at** | **Integer** | | [optional] | +| **payment_method** | [**ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional] | +| **reference_id** | **String** | Reference ID of the charge | [optional] | +| **refunds** | [**ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional] | +| **status** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeResponse.new( + amount: 4321, + channel: null, + created_at: 1676386026, + currency: MXN, + customer_id: null, + description: Payment from order, + device_fingerprint: 6FR3chaU4Y1nGAW5NAGd1rcjAKa142Ba, + failure_code: suspected_fraud, + failure_message: Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso., + fee: 1160, + id: 63efa757cf65380001aec040, + livemode: null, + object: null, + order_id: ord_2tN73UdUSNrYRPD9r, + paid_at: 1676390742, + payment_method: null, + reference_id: ref_2tN73UdUSNrYRPD9r, + refunds: null, + status: pending_payment +) +``` + diff --git a/docs/ChargeResponseChannel.md b/docs/ChargeResponseChannel.md new file mode 100644 index 0000000..3c23337 --- /dev/null +++ b/docs/ChargeResponseChannel.md @@ -0,0 +1,24 @@ +# Conekta::ChargeResponseChannel + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **segment** | **String** | | [optional] | +| **checkout_request_id** | **String** | | [optional] | +| **checkout_request_type** | **String** | | [optional] | +| **id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeResponseChannel.new( + segment: Checkout, + checkout_request_id: 6fca054a-8519-4c43-971e-cea35cc519bb, + checkout_request_type: HostedPayment, + id: channel_2tNDzhA4Akmzj11AU +) +``` + diff --git a/docs/ChargeResponsePaymentMethod.md b/docs/ChargeResponsePaymentMethod.md new file mode 100644 index 0000000..47bf1f9 --- /dev/null +++ b/docs/ChargeResponsePaymentMethod.md @@ -0,0 +1,82 @@ +# Conekta::ChargeResponsePaymentMethod + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::ChargeResponsePaymentMethod.openapi_one_of +# => +# [ +# :'PaymentMethodBankTransfer', +# :'PaymentMethodCard', +# :'PaymentMethodCash' +# ] +``` + +### `openapi_discriminator_name` + +Returns the discriminator's property name. + +#### Example + +```ruby +require 'conekta' + +Conekta::ChargeResponsePaymentMethod.openapi_discriminator_name +# => :'object' +``` + +### `openapi_discriminator_name` + +Returns the discriminator's mapping. + +#### Example + +```ruby +require 'conekta' + +Conekta::ChargeResponsePaymentMethod.openapi_discriminator_mapping +# => +# { +# :'bank_transfer_payment' => :'PaymentMethodBankTransfer', +# :'card_payment' => :'PaymentMethodCard', +# :'cash_payment' => :'PaymentMethodCash' +# } +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::ChargeResponsePaymentMethod.build(data) +# => # + +Conekta::ChargeResponsePaymentMethod.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `PaymentMethodBankTransfer` +- `PaymentMethodCard` +- `PaymentMethodCash` +- `nil` (if no type matches) + diff --git a/docs/ChargeResponseRefunds.md b/docs/ChargeResponseRefunds.md new file mode 100644 index 0000000..7cd28f3 --- /dev/null +++ b/docs/ChargeResponseRefunds.md @@ -0,0 +1,26 @@ +# Conekta::ChargeResponseRefunds + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<ChargeResponseRefundsData>**](ChargeResponseRefundsData.md) | refunds | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeResponseRefunds.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/ChargeResponseRefundsAllOf.md b/docs/ChargeResponseRefundsAllOf.md new file mode 100644 index 0000000..01b7dc4 --- /dev/null +++ b/docs/ChargeResponseRefundsAllOf.md @@ -0,0 +1,18 @@ +# Conekta::ChargeResponseRefundsAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<ChargeResponseRefundsData>**](ChargeResponseRefundsData.md) | refunds | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeResponseRefundsAllOf.new( + data: null +) +``` + diff --git a/docs/ChargeResponseRefundsData.md b/docs/ChargeResponseRefundsData.md new file mode 100644 index 0000000..e70042f --- /dev/null +++ b/docs/ChargeResponseRefundsData.md @@ -0,0 +1,30 @@ +# Conekta::ChargeResponseRefundsData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | | | +| **auth_code** | **String** | | [optional] | +| **created_at** | **Integer** | | | +| **expires_at** | **Integer** | refund expiration date | [optional] | +| **id** | **String** | | | +| **object** | **String** | | | +| **status** | **String** | refund status | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargeResponseRefundsData.new( + amount: -15000, + auth_code: 867372, + created_at: 1678226878, + expires_at: 1678226878, + id: 6407b5bee1329a000175ba11, + object: refund, + status: pending +) +``` + diff --git a/docs/ChargesApi.md b/docs/ChargesApi.md new file mode 100644 index 0000000..86e57de --- /dev/null +++ b/docs/ChargesApi.md @@ -0,0 +1,165 @@ +# Conekta::ChargesApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_charges**](ChargesApi.md#get_charges) | **GET** /charges | Get A List of Charges | +| [**orders_create_charge**](ChargesApi.md#orders_create_charge) | **POST** /orders/{id}/charges | Create charge | + + +## get_charges + +> get_charges(opts) + +Get A List of Charges + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ChargesApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get A List of Charges + result = api_instance.get_charges(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ChargesApi->get_charges: #{e}" +end +``` + +#### Using the get_charges_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_charges_with_http_info(opts) + +```ruby +begin + # Get A List of Charges + data, status_code, headers = api_instance.get_charges_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ChargesApi->get_charges_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetChargesResponse**](GetChargesResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_create_charge + +> orders_create_charge(id, charge_request, opts) + +Create charge + +Create charge for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ChargesApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +charge_request = Conekta::ChargeRequest.new({payment_method: Conekta::ChargeRequestPaymentMethod.new({type: 'card'})}) # ChargeRequest | requested field for a charge +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create charge + result = api_instance.orders_create_charge(id, charge_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ChargesApi->orders_create_charge: #{e}" +end +``` + +#### Using the orders_create_charge_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_create_charge_with_http_info(id, charge_request, opts) + +```ruby +begin + # Create charge + data, status_code, headers = api_instance.orders_create_charge_with_http_info(id, charge_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ChargesApi->orders_create_charge_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **charge_request** | [**ChargeRequest**](ChargeRequest.md) | requested field for a charge | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ChargeOrderResponse**](ChargeOrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/ChargesDataResponse.md b/docs/ChargesDataResponse.md new file mode 100644 index 0000000..ceef2df --- /dev/null +++ b/docs/ChargesDataResponse.md @@ -0,0 +1,54 @@ +# Conekta::ChargesDataResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | | [optional] | +| **channel** | [**ChargeResponseChannel**](ChargeResponseChannel.md) | | [optional] | +| **created_at** | **Integer** | | [optional] | +| **currency** | **String** | | [optional] | +| **customer_id** | **String** | | [optional] | +| **description** | **String** | | [optional] | +| **device_fingerprint** | **String** | | [optional] | +| **failure_code** | **String** | | [optional] | +| **failure_message** | **String** | | [optional] | +| **fee** | **Integer** | | [optional] | +| **id** | **String** | | [optional] | +| **livemode** | **Boolean** | | [optional] | +| **object** | **String** | | [optional] | +| **order_id** | **String** | | [optional] | +| **paid_at** | **Integer** | | [optional] | +| **payment_method** | [**ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional] | +| **reference_id** | **String** | Reference ID of the charge | [optional] | +| **refunds** | [**ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional] | +| **status** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargesDataResponse.new( + amount: 4321, + channel: null, + created_at: 1676386026, + currency: MXN, + customer_id: null, + description: Payment from order, + device_fingerprint: 6FR3chaU4Y1nGAW5NAGd1rcjAKa142Ba, + failure_code: suspected_fraud, + failure_message: Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso., + fee: 1160, + id: 63efa757cf65380001aec040, + livemode: null, + object: null, + order_id: ord_2tN73UdUSNrYRPD9r, + paid_at: 1676390742, + payment_method: null, + reference_id: ref_2tN73UdUSNrYRPD9r, + refunds: null, + status: pending_payment +) +``` + diff --git a/docs/Checkout.md b/docs/Checkout.md new file mode 100644 index 0000000..1de0ec0 --- /dev/null +++ b/docs/Checkout.md @@ -0,0 +1,38 @@ +# Conekta::Checkout + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **allowed_payment_methods** | **Array<String>** | Those are the payment methods that will be available for the link | | +| **expires_at** | **Integer** | It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 2 to 365 days (the valid range will be taken from the next day of the creation date at 00:01 hrs) | | +| **monthly_installments_enabled** | **Boolean** | This flag allows you to specify if months without interest will be active. | [optional] | +| **monthly_installments_options** | **Array<Integer>** | This field allows you to specify the number of months without interest. | [optional] | +| **name** | **String** | Reason for charge | | +| **needs_shipping_contact** | **Boolean** | This flag allows you to fill in the shipping information at checkout. | [optional] | +| **on_demand_enabled** | **Boolean** | This flag allows you to specify if the link will be on demand. | [optional] | +| **order_template** | [**CheckoutOrderTemplate**](CheckoutOrderTemplate.md) | | | +| **payments_limit_count** | **Integer** | It is the number of payments that can be made through the link. | [optional] | +| **recurrent** | **Boolean** | false: single use. true: multiple payments | | +| **type** | **String** | It is the type of link that will be created. It must be a valid type. | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::Checkout.new( + allowed_payment_methods: [cash, card, bank_transfer], + expires_at: 1680397724, + monthly_installments_enabled: true, + monthly_installments_options: [3, 6, 12], + name: Payment Link Name 1594138857, + needs_shipping_contact: false, + on_demand_enabled: true, + order_template: null, + payments_limit_count: 5, + recurrent: false, + type: PaymentLink +) +``` + diff --git a/docs/CheckoutOrderTemplate.md b/docs/CheckoutOrderTemplate.md new file mode 100644 index 0000000..f4100ac --- /dev/null +++ b/docs/CheckoutOrderTemplate.md @@ -0,0 +1,24 @@ +# Conekta::CheckoutOrderTemplate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **currency** | **String** | It is the currency in which the order will be created. It must be a valid ISO 4217 currency code. | | +| **customer_info** | [**CheckoutOrderTemplateCustomerInfo**](CheckoutOrderTemplateCustomerInfo.md) | | [optional] | +| **line_items** | [**Array<Product>**](Product.md) | They are the products to buy. Each contains the \"unit price\" and \"quantity\" parameters that are used to calculate the total amount of the order. | | +| **metadata** | **Hash<String, Object>** | It is a set of key-value pairs that you can attach to the order. It can be used to store additional information about the order in a structured format. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CheckoutOrderTemplate.new( + currency: MXN, + customer_info: null, + line_items: null, + metadata: {key=value} +) +``` + diff --git a/docs/CheckoutOrderTemplateCustomerInfo.md b/docs/CheckoutOrderTemplateCustomerInfo.md new file mode 100644 index 0000000..954b2a5 --- /dev/null +++ b/docs/CheckoutOrderTemplateCustomerInfo.md @@ -0,0 +1,49 @@ +# Conekta::CheckoutOrderTemplateCustomerInfo + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::CheckoutOrderTemplateCustomerInfo.openapi_one_of +# => +# [ +# :'CustomerInfo', +# :'CustomerInfoJustCustomerId' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::CheckoutOrderTemplateCustomerInfo.build(data) +# => # + +Conekta::CheckoutOrderTemplateCustomerInfo.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `CustomerInfo` +- `CustomerInfoJustCustomerId` +- `nil` (if no type matches) + diff --git a/docs/CheckoutRequest.md b/docs/CheckoutRequest.md new file mode 100644 index 0000000..414bc60 --- /dev/null +++ b/docs/CheckoutRequest.md @@ -0,0 +1,34 @@ +# Conekta::CheckoutRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **allowed_payment_methods** | **Array<String>** | Are the payment methods available for this link | | +| **expires_at** | **Integer** | Unix timestamp of checkout expiration | [optional] | +| **failure_url** | **String** | Redirection url back to the site in case of failed payment, applies only to HostedPayment. | [optional] | +| **monthly_installments_enabled** | **Boolean** | | [optional] | +| **monthly_installments_options** | **Array<Integer>** | | [optional] | +| **name** | **String** | Reason for payment | [optional] | +| **on_demand_enabled** | **Boolean** | | [optional] | +| **success_url** | **String** | Redirection url back to the site in case of successful payment, applies only to HostedPayment | [optional] | +| **type** | **String** | This field represents the type of checkout | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CheckoutRequest.new( + allowed_payment_methods: [cash, card, bank_transfer], + expires_at: null, + failure_url: null, + monthly_installments_enabled: false, + monthly_installments_options: [3, 6, 12], + name: null, + on_demand_enabled: true, + success_url: null, + type: Integration +) +``` + diff --git a/docs/CheckoutResponse.md b/docs/CheckoutResponse.md new file mode 100644 index 0000000..b5bdacd --- /dev/null +++ b/docs/CheckoutResponse.md @@ -0,0 +1,66 @@ +# Conekta::CheckoutResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **allowed_payment_methods** | **Array<String>** | | [optional] | +| **can_not_expire** | **Boolean** | | [optional] | +| **emails_sent** | **Integer** | | [optional] | +| **exclude_card_networks** | **Array<Object>** | | [optional] | +| **expires_at** | **Integer** | | [optional] | +| **failure_url** | **String** | | [optional] | +| **force_3ds_flow** | **Boolean** | | [optional] | +| **id** | **String** | | | +| **livemode** | **Boolean** | | | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **monthly_installments_enabled** | **Boolean** | | [optional] | +| **monthly_installments_options** | **Array<Integer>** | | [optional] | +| **name** | **String** | Reason for charge | | +| **needs_shipping_contact** | **Boolean** | | [optional] | +| **object** | **String** | | | +| **paid_payments_count** | **Integer** | | [optional] | +| **payments_limit_count** | **Integer** | | [optional] | +| **recurrent** | **Boolean** | | [optional] | +| **slug** | **String** | | [optional] | +| **sms_sent** | **Integer** | | [optional] | +| **starts_at** | **Integer** | | [optional] | +| **status** | **String** | | [optional] | +| **success_url** | **String** | | [optional] | +| **type** | **String** | | [optional] | +| **url** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CheckoutResponse.new( + allowed_payment_methods: [cash, card, bank_transfer], + can_not_expire: false, + emails_sent: 0, + exclude_card_networks: null, + expires_at: 1680397724, + failure_url: https://pay.conekta.com/failure, + force_3ds_flow: false, + id: b0bf16c4-18b9-445e-ba24-01604f329dbf, + livemode: true, + metadata: {key=value}, + monthly_installments_enabled: false, + monthly_installments_options: [3, 6, 12], + name: Payment Link Name 1594138857, + needs_shipping_contact: false, + object: checkout, + paid_payments_count: 0, + payments_limit_count: 5, + recurrent: false, + slug: b0bf16c418b9445eba2401604f329dbf, + sms_sent: 0, + starts_at: 1677650400, + status: Issued, + success_url: https://pay.conekta.com/success, + type: PaymentLink, + url: https://pay.conekta.com/link/b0bf16c418b9445eba2401604f329dbf +) +``` + diff --git a/docs/CheckoutsResponse.md b/docs/CheckoutsResponse.md new file mode 100644 index 0000000..8d0db48 --- /dev/null +++ b/docs/CheckoutsResponse.md @@ -0,0 +1,26 @@ +# Conekta::CheckoutsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<CheckoutResponse>**](CheckoutResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CheckoutsResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/CheckoutsResponseAllOf.md b/docs/CheckoutsResponseAllOf.md new file mode 100644 index 0000000..95de76c --- /dev/null +++ b/docs/CheckoutsResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::CheckoutsResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<CheckoutResponse>**](CheckoutResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CheckoutsResponseAllOf.new( + data: null +) +``` + diff --git a/docs/CompaniesApi.md b/docs/CompaniesApi.md new file mode 100644 index 0000000..52c5eb2 --- /dev/null +++ b/docs/CompaniesApi.md @@ -0,0 +1,159 @@ +# Conekta::CompaniesApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_companies**](CompaniesApi.md#get_companies) | **GET** /companies | Get List of Companies | +| [**get_company**](CompaniesApi.md#get_company) | **GET** /companies/{id} | Get Company | + + +## get_companies + +> get_companies(opts) + +Get List of Companies + +Consume the list of child companies. This is used for holding companies with several child entities. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::CompaniesApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get List of Companies + result = api_instance.get_companies(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling CompaniesApi->get_companies: #{e}" +end +``` + +#### Using the get_companies_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_companies_with_http_info(opts) + +```ruby +begin + # Get List of Companies + data, status_code, headers = api_instance.get_companies_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling CompaniesApi->get_companies_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetCompaniesResponse**](GetCompaniesResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_company + +> get_company(id, opts) + +Get Company + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::CompaniesApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Get Company + result = api_instance.get_company(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling CompaniesApi->get_company: #{e}" +end +``` + +#### Using the get_company_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_company_with_http_info(id, opts) + +```ruby +begin + # Get Company + data, status_code, headers = api_instance.get_company_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling CompaniesApi->get_company_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**CompanyResponse**](CompanyResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/CompanyFiscalInfoAddressResponse.md b/docs/CompanyFiscalInfoAddressResponse.md new file mode 100644 index 0000000..b2cb628 --- /dev/null +++ b/docs/CompanyFiscalInfoAddressResponse.md @@ -0,0 +1,34 @@ +# Conekta::CompanyFiscalInfoAddressResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The resource's type | [optional] | +| **street1** | **String** | Street Address | [optional] | +| **street2** | **String** | Colonia | [optional] | +| **city** | **String** | City | [optional] | +| **state** | **String** | State | [optional] | +| **country** | **String** | Country | [optional] | +| **postal_code** | **String** | Postal code | [optional] | +| **external_number** | **String** | Street number | [optional] | +| **internal_number** | **String** | Unit / apartment number | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CompanyFiscalInfoAddressResponse.new( + object: null, + street1: Calle 13, + street2: Navarte, + city: Cuauhtémoc, + state: Ciudad de México, + country: MX, + postal_code: 3072, + external_number: 123, + internal_number: 123 +) +``` + diff --git a/docs/CompanyFiscalInfoResponse.md b/docs/CompanyFiscalInfoResponse.md new file mode 100644 index 0000000..a292f3a --- /dev/null +++ b/docs/CompanyFiscalInfoResponse.md @@ -0,0 +1,30 @@ +# Conekta::CompanyFiscalInfoResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The resource's type | [optional] | +| **tax_id** | **String** | Tax ID of the company | [optional] | +| **legal_entity_name** | **String** | Legal name of the company | [optional] | +| **business_type** | **String** | Business type of the company | [optional] | +| **phone** | **String** | Phone number of the company | [optional] | +| **physical_person_business_type** | **String** | Business type if 'persona_fisica' | [optional] | +| **address** | [**CompanyFiscalInfoAddressResponse**](CompanyFiscalInfoAddressResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CompanyFiscalInfoResponse.new( + object: null, + tax_id: XAXX010101000, + legal_entity_name: Child Company A, + business_type: persona_moral, + phone: 5555555555, + physical_person_business_type: null, + address: null +) +``` + diff --git a/docs/CompanyPayoutDestinationResponse.md b/docs/CompanyPayoutDestinationResponse.md new file mode 100644 index 0000000..7da0fa4 --- /dev/null +++ b/docs/CompanyPayoutDestinationResponse.md @@ -0,0 +1,28 @@ +# Conekta::CompanyPayoutDestinationResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | The resource's type | [optional] | +| **currency** | **String** | currency of the receiving account | [optional] | +| **account_holder_name** | **String** | Name of the account holder | [optional] | +| **bank** | **String** | Name of the bank | [optional] | +| **type** | **String** | Type of the payout destination | [optional] | +| **account_number** | **String** | Account number of the receiving account | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CompanyPayoutDestinationResponse.new( + object: null, + currency: MXN, + account_holder_name: Child Company A, + bank: BBVA, + type: null, + account_number: 123456789012345678 +) +``` + diff --git a/docs/CompanyResponse.md b/docs/CompanyResponse.md new file mode 100644 index 0000000..256ba1e --- /dev/null +++ b/docs/CompanyResponse.md @@ -0,0 +1,32 @@ +# Conekta::CompanyResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The child company's unique identifier | [optional] | +| **created_at** | **Integer** | The resource's creation date (unix timestamp) | [optional] | +| **name** | **String** | The child company's name | [optional] | +| **object** | **String** | The resource's type | [optional] | +| **parent_company_id** | **String** | Id of the parent company | [optional] | +| **use_parent_fiscal_data** | **Boolean** | Whether the parent company's fiscal data is to be used for liquidation and tax purposes | [optional] | +| **payout_destination** | [**CompanyPayoutDestinationResponse**](CompanyPayoutDestinationResponse.md) | | [optional] | +| **fiscal_info** | [**CompanyFiscalInfoResponse**](CompanyFiscalInfoResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CompanyResponse.new( + id: 6441bb27659a060465da7335, + created_at: 1680397724, + name: Child Company A, + object: null, + parent_company_id: 6441bb3c62db5812e7920c31, + use_parent_fiscal_data: false, + payout_destination: null, + fiscal_info: null +) +``` + diff --git a/docs/CreateCustomerFiscalEntitiesResponse.md b/docs/CreateCustomerFiscalEntitiesResponse.md new file mode 100644 index 0000000..fc54d7d --- /dev/null +++ b/docs/CreateCustomerFiscalEntitiesResponse.md @@ -0,0 +1,38 @@ +# Conekta::CreateCustomerFiscalEntitiesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **address** | [**CustomerFiscalEntitiesRequestAddress**](CustomerFiscalEntitiesRequestAddress.md) | | | +| **tax_id** | **String** | | [optional] | +| **email** | **String** | | [optional] | +| **phone** | **String** | | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **company_name** | **String** | | [optional] | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CreateCustomerFiscalEntitiesResponse.new( + address: null, + tax_id: null, + email: null, + phone: null, + metadata: null, + company_name: conekta, + id: ship_cont_2tKZsTYcsryyu7Ah8, + object: shipping_contact, + created_at: 1675715413, + parent_id: cus_2tKcHxhTz7xU5SymF, + default: null +) +``` + diff --git a/docs/CreateCustomerFiscalEntitiesResponseAllOf.md b/docs/CreateCustomerFiscalEntitiesResponseAllOf.md new file mode 100644 index 0000000..39662f9 --- /dev/null +++ b/docs/CreateCustomerFiscalEntitiesResponseAllOf.md @@ -0,0 +1,26 @@ +# Conekta::CreateCustomerFiscalEntitiesResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CreateCustomerFiscalEntitiesResponseAllOf.new( + id: ship_cont_2tKZsTYcsryyu7Ah8, + object: shipping_contact, + created_at: 1675715413, + parent_id: cus_2tKcHxhTz7xU5SymF, + default: null +) +``` + diff --git a/docs/CreateCustomerPaymentMethodsRequest.md b/docs/CreateCustomerPaymentMethodsRequest.md new file mode 100644 index 0000000..e75984f --- /dev/null +++ b/docs/CreateCustomerPaymentMethodsRequest.md @@ -0,0 +1,51 @@ +# Conekta::CreateCustomerPaymentMethodsRequest + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::CreateCustomerPaymentMethodsRequest.openapi_one_of +# => +# [ +# :'PaymentMethodCardRequest', +# :'PaymentMethodCashRequest', +# :'PaymentMethodSpeiRequest' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::CreateCustomerPaymentMethodsRequest.build(data) +# => # + +Conekta::CreateCustomerPaymentMethodsRequest.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `PaymentMethodCardRequest` +- `PaymentMethodCashRequest` +- `PaymentMethodSpeiRequest` +- `nil` (if no type matches) + diff --git a/docs/CreateCustomerPaymentMethodsResponse.md b/docs/CreateCustomerPaymentMethodsResponse.md new file mode 100644 index 0000000..ee80a9f --- /dev/null +++ b/docs/CreateCustomerPaymentMethodsResponse.md @@ -0,0 +1,83 @@ +# Conekta::CreateCustomerPaymentMethodsResponse + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::CreateCustomerPaymentMethodsResponse.openapi_one_of +# => +# [ +# :'PaymentMethodCardResponse', +# :'PaymentMethodCashResponse', +# :'PaymentMethodSpeiRecurrent' +# ] +``` + +### `openapi_discriminator_name` + +Returns the discriminator's property name. + +#### Example + +```ruby +require 'conekta' + +Conekta::CreateCustomerPaymentMethodsResponse.openapi_discriminator_name +# => :'type' +``` + +### `openapi_discriminator_name` + +Returns the discriminator's mapping. + +#### Example + +```ruby +require 'conekta' + +Conekta::CreateCustomerPaymentMethodsResponse.openapi_discriminator_mapping +# => +# { +# :'card' => :'PaymentMethodCardResponse', +# :'cash' => :'PaymentMethodCashResponse', +# :'oxxo_recurrent' => :'PaymentMethodCashResponse', +# :'spei_recurrent' => :'PaymentMethodSpeiRecurrent' +# } +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::CreateCustomerPaymentMethodsResponse.build(data) +# => # + +Conekta::CreateCustomerPaymentMethodsResponse.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `PaymentMethodCardResponse` +- `PaymentMethodCashResponse` +- `PaymentMethodSpeiRecurrent` +- `nil` (if no type matches) + diff --git a/docs/CreateRiskRulesData.md b/docs/CreateRiskRulesData.md new file mode 100644 index 0000000..9070d20 --- /dev/null +++ b/docs/CreateRiskRulesData.md @@ -0,0 +1,22 @@ +# Conekta::CreateRiskRulesData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **description** | **String** | Description of the rule | | +| **field** | **String** | Field to be used for the rule | | +| **value** | **String** | Value to be used for the rule | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CreateRiskRulesData.new( + description: this client email was verified at 20/09/22 by internal process, + field: email | phone | card_token, + value: email@example.com | 818081808180 | src_2qUCNd5AyQqfPMBuV +) +``` + diff --git a/docs/Customer.md b/docs/Customer.md new file mode 100644 index 0000000..34da418 --- /dev/null +++ b/docs/Customer.md @@ -0,0 +1,44 @@ +# Conekta::Customer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **antifraud_info** | [**CustomerAntifraudInfo**](CustomerAntifraudInfo.md) | | [optional] | +| **corporate** | **Boolean** | It is a value that allows identifying if the email is corporate or not. | [optional][default to false] | +| **custom_reference** | **String** | It is an undefined value. | [optional] | +| **email** | **String** | An email address is a series of customizable characters followed by a universal Internet symbol, the at symbol (@), the name of a host server, and a web domain ending (.mx, .com, .org, . net, etc). | | +| **default_payment_source_id** | **String** | It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id) | [optional] | +| **default_shipping_contact_id** | **String** | It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact) | [optional] | +| **fiscal_entities** | [**Array<CustomerFiscalEntitiesRequest>**](CustomerFiscalEntitiesRequest.md) | | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **name** | **String** | Client's name | | +| **payment_sources** | [**Array<CustomerPaymentMethodsRequest>**](CustomerPaymentMethodsRequest.md) | Contains details of the payment methods that the customer has active or has used in Conekta | [optional] | +| **phone** | **String** | Is the customer's phone number | | +| **plan_id** | **String** | Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription | [optional] | +| **shipping_contacts** | [**Array<CustomerShippingContacts>**](CustomerShippingContacts.md) | Contains the detail of the shipping addresses that the client has active or has used in Conekta | [optional] | +| **subscription** | [**SubscriptionRequest**](SubscriptionRequest.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::Customer.new( + antifraud_info: null, + corporate: false, + custom_reference: null, + email: miguel@gmail.com, + default_payment_source_id: src_1a2b3c4d5e6f7g8h, + default_shipping_contact_id: ship_cont_1a2b3c4d5e6f7g8h, + fiscal_entities: null, + metadata: null, + name: miguel, + payment_sources: null, + phone: +5215555555555, + plan_id: plan_987234823, + shipping_contacts: null, + subscription: null +) +``` + diff --git a/docs/CustomerAddress.md b/docs/CustomerAddress.md new file mode 100644 index 0000000..0974d13 --- /dev/null +++ b/docs/CustomerAddress.md @@ -0,0 +1,32 @@ +# Conekta::CustomerAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **street1** | **String** | | | +| **street2** | **String** | | [optional] | +| **postal_code** | **String** | | | +| **city** | **String** | | | +| **state** | **String** | | [optional] | +| **country** | **String** | this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) | [optional] | +| **residential** | **Boolean** | | [optional] | +| **external_number** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerAddress.new( + street1: avenida siempre viva, + street2: fake street, + postal_code: 06100, + city: Ciudad de Mexico, + state: Ciudad de Mexico, + country: MX, + residential: true, + external_number: null +) +``` + diff --git a/docs/CustomerAntifraudInfo.md b/docs/CustomerAntifraudInfo.md new file mode 100644 index 0000000..792350d --- /dev/null +++ b/docs/CustomerAntifraudInfo.md @@ -0,0 +1,20 @@ +# Conekta::CustomerAntifraudInfo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_created_at** | **Integer** | | [optional] | +| **first_paid_at** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerAntifraudInfo.new( + account_created_at: 1484040996, + first_paid_at: 1485151007 +) +``` + diff --git a/docs/CustomerAntifraudInfoResponse.md b/docs/CustomerAntifraudInfoResponse.md new file mode 100644 index 0000000..0e740d1 --- /dev/null +++ b/docs/CustomerAntifraudInfoResponse.md @@ -0,0 +1,20 @@ +# Conekta::CustomerAntifraudInfoResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **first_paid_at** | **Integer** | | [optional] | +| **account_created_at** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerAntifraudInfoResponse.new( + first_paid_at: 1485151007, + account_created_at: 1484040996 +) +``` + diff --git a/docs/CustomerFiscalEntitiesDataResponse.md b/docs/CustomerFiscalEntitiesDataResponse.md new file mode 100644 index 0000000..bd0b44b --- /dev/null +++ b/docs/CustomerFiscalEntitiesDataResponse.md @@ -0,0 +1,38 @@ +# Conekta::CustomerFiscalEntitiesDataResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **address** | [**CustomerFiscalEntitiesRequestAddress**](CustomerFiscalEntitiesRequestAddress.md) | | | +| **tax_id** | **String** | | [optional] | +| **email** | **String** | | [optional] | +| **phone** | **String** | | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **company_name** | **String** | | [optional] | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerFiscalEntitiesDataResponse.new( + address: null, + tax_id: null, + email: null, + phone: null, + metadata: null, + company_name: conekta, + id: ship_cont_2tKZsTYcsryyu7Ah8, + object: shipping_contact, + created_at: 1675715413, + parent_id: cus_2tKcHxhTz7xU5SymF, + default: null +) +``` + diff --git a/docs/CustomerFiscalEntitiesRequest.md b/docs/CustomerFiscalEntitiesRequest.md new file mode 100644 index 0000000..4c7a55e --- /dev/null +++ b/docs/CustomerFiscalEntitiesRequest.md @@ -0,0 +1,28 @@ +# Conekta::CustomerFiscalEntitiesRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **address** | [**CustomerFiscalEntitiesRequestAddress**](CustomerFiscalEntitiesRequestAddress.md) | | | +| **tax_id** | **String** | | [optional] | +| **email** | **String** | | [optional] | +| **phone** | **String** | | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **company_name** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerFiscalEntitiesRequest.new( + address: null, + tax_id: null, + email: null, + phone: null, + metadata: null, + company_name: conekta +) +``` + diff --git a/docs/CustomerFiscalEntitiesRequestAddress.md b/docs/CustomerFiscalEntitiesRequestAddress.md new file mode 100644 index 0000000..ef3d88a --- /dev/null +++ b/docs/CustomerFiscalEntitiesRequestAddress.md @@ -0,0 +1,32 @@ +# Conekta::CustomerFiscalEntitiesRequestAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **street1** | **String** | | | +| **street2** | **String** | | [optional] | +| **postal_code** | **String** | | | +| **city** | **String** | | | +| **state** | **String** | | [optional] | +| **country** | **String** | this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) | [optional] | +| **residential** | **Boolean** | | [optional] | +| **external_number** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerFiscalEntitiesRequestAddress.new( + street1: avenida siempre viva, + street2: fake street, + postal_code: 06100, + city: Ciudad de Mexico, + state: Ciudad de Mexico, + country: MX, + residential: true, + external_number: null +) +``` + diff --git a/docs/CustomerFiscalEntitiesResponse.md b/docs/CustomerFiscalEntitiesResponse.md new file mode 100644 index 0000000..39a9fff --- /dev/null +++ b/docs/CustomerFiscalEntitiesResponse.md @@ -0,0 +1,22 @@ +# Conekta::CustomerFiscalEntitiesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **data** | [**Array<CustomerFiscalEntitiesDataResponse>**](CustomerFiscalEntitiesDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerFiscalEntitiesResponse.new( + has_more: false, + object: list, + data: null +) +``` + diff --git a/docs/CustomerFiscalEntitiesResponseAllOf.md b/docs/CustomerFiscalEntitiesResponseAllOf.md new file mode 100644 index 0000000..449ab42 --- /dev/null +++ b/docs/CustomerFiscalEntitiesResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::CustomerFiscalEntitiesResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<CustomerFiscalEntitiesDataResponse>**](CustomerFiscalEntitiesDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerFiscalEntitiesResponseAllOf.new( + data: null +) +``` + diff --git a/docs/CustomerInfo.md b/docs/CustomerInfo.md new file mode 100644 index 0000000..2d4675e --- /dev/null +++ b/docs/CustomerInfo.md @@ -0,0 +1,26 @@ +# Conekta::CustomerInfo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | | +| **email** | **String** | | | +| **phone** | **String** | | | +| **corporate** | **Boolean** | | [optional] | +| **object** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerInfo.new( + name: DevTest, + email: test@conekta.com, + phone: 5522997233, + corporate: null, + object: customer_info +) +``` + diff --git a/docs/CustomerInfoJustCustomerId.md b/docs/CustomerInfoJustCustomerId.md new file mode 100644 index 0000000..9d46a05 --- /dev/null +++ b/docs/CustomerInfoJustCustomerId.md @@ -0,0 +1,18 @@ +# Conekta::CustomerInfoJustCustomerId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerInfoJustCustomerId.new( + customer_id: cus_23874283647 +) +``` + diff --git a/docs/CustomerInfoJustCustomerIdResponse.md b/docs/CustomerInfoJustCustomerIdResponse.md new file mode 100644 index 0000000..dcf6be5 --- /dev/null +++ b/docs/CustomerInfoJustCustomerIdResponse.md @@ -0,0 +1,18 @@ +# Conekta::CustomerInfoJustCustomerIdResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerInfoJustCustomerIdResponse.new( + customer_id: cus_23874283647 +) +``` + diff --git a/docs/CustomerInfoResponse.md b/docs/CustomerInfoResponse.md new file mode 100644 index 0000000..cbaa4bd --- /dev/null +++ b/docs/CustomerInfoResponse.md @@ -0,0 +1,26 @@ +# Conekta::CustomerInfoResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | [optional] | +| **email** | **String** | | [optional] | +| **phone** | **String** | | [optional] | +| **corporate** | **Boolean** | | [optional][default to false] | +| **object** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerInfoResponse.new( + name: DevTest, + email: test@conekta.com, + phone: 5522997233, + corporate: null, + object: customer_info +) +``` + diff --git a/docs/CustomerPaymentMethodRequest.md b/docs/CustomerPaymentMethodRequest.md new file mode 100644 index 0000000..1c98780 --- /dev/null +++ b/docs/CustomerPaymentMethodRequest.md @@ -0,0 +1,18 @@ +# Conekta::CustomerPaymentMethodRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of payment method | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerPaymentMethodRequest.new( + type: card | cash | spei +) +``` + diff --git a/docs/CustomerPaymentMethods.md b/docs/CustomerPaymentMethods.md new file mode 100644 index 0000000..5ab95be --- /dev/null +++ b/docs/CustomerPaymentMethods.md @@ -0,0 +1,18 @@ +# Conekta::CustomerPaymentMethods + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<CustomerPaymentMethodsData>**](CustomerPaymentMethodsData.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerPaymentMethods.new( + data: null +) +``` + diff --git a/docs/CustomerPaymentMethodsData.md b/docs/CustomerPaymentMethodsData.md new file mode 100644 index 0000000..b745bff --- /dev/null +++ b/docs/CustomerPaymentMethodsData.md @@ -0,0 +1,83 @@ +# Conekta::CustomerPaymentMethodsData + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::CustomerPaymentMethodsData.openapi_one_of +# => +# [ +# :'PaymentMethodCardResponse', +# :'PaymentMethodCashResponse', +# :'PaymentMethodSpeiRecurrent' +# ] +``` + +### `openapi_discriminator_name` + +Returns the discriminator's property name. + +#### Example + +```ruby +require 'conekta' + +Conekta::CustomerPaymentMethodsData.openapi_discriminator_name +# => :'type' +``` + +### `openapi_discriminator_name` + +Returns the discriminator's mapping. + +#### Example + +```ruby +require 'conekta' + +Conekta::CustomerPaymentMethodsData.openapi_discriminator_mapping +# => +# { +# :'card' => :'PaymentMethodCardResponse', +# :'cash' => :'PaymentMethodCashResponse', +# :'oxxo_recurrent' => :'PaymentMethodCashResponse', +# :'spei_recurrent' => :'PaymentMethodSpeiRecurrent' +# } +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::CustomerPaymentMethodsData.build(data) +# => # + +Conekta::CustomerPaymentMethodsData.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `PaymentMethodCardResponse` +- `PaymentMethodCashResponse` +- `PaymentMethodSpeiRecurrent` +- `nil` (if no type matches) + diff --git a/docs/CustomerPaymentMethodsRequest.md b/docs/CustomerPaymentMethodsRequest.md new file mode 100644 index 0000000..0f9a50a --- /dev/null +++ b/docs/CustomerPaymentMethodsRequest.md @@ -0,0 +1,51 @@ +# Conekta::CustomerPaymentMethodsRequest + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::CustomerPaymentMethodsRequest.openapi_one_of +# => +# [ +# :'PaymentMethodCardRequest', +# :'PaymentMethodCashRequest', +# :'PaymentMethodSpeiRequest' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::CustomerPaymentMethodsRequest.build(data) +# => # + +Conekta::CustomerPaymentMethodsRequest.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `PaymentMethodCardRequest` +- `PaymentMethodCashRequest` +- `PaymentMethodSpeiRequest` +- `nil` (if no type matches) + diff --git a/docs/CustomerPaymentMethodsResponse.md b/docs/CustomerPaymentMethodsResponse.md new file mode 100644 index 0000000..b86c11f --- /dev/null +++ b/docs/CustomerPaymentMethodsResponse.md @@ -0,0 +1,26 @@ +# Conekta::CustomerPaymentMethodsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<CustomerPaymentMethodsData>**](CustomerPaymentMethodsData.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerPaymentMethodsResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/CustomerResponse.md b/docs/CustomerResponse.md new file mode 100644 index 0000000..7ba67f1 --- /dev/null +++ b/docs/CustomerResponse.md @@ -0,0 +1,50 @@ +# Conekta::CustomerResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **antifraud_info** | [**CustomerAntifraudInfoResponse**](CustomerAntifraudInfoResponse.md) | | [optional] | +| **corporate** | **Boolean** | | [optional] | +| **created_at** | **Integer** | | | +| **custom_reference** | **String** | | [optional] | +| **default_fiscal_entity_id** | **String** | | [optional] | +| **default_shipping_contact_id** | **String** | | [optional] | +| **default_payment_source_id** | **String** | | [optional] | +| **email** | **String** | | [optional] | +| **fiscal_entities** | [**CustomerFiscalEntitiesResponse**](CustomerFiscalEntitiesResponse.md) | | [optional] | +| **id** | **String** | | | +| **livemode** | **Boolean** | | | +| **name** | **String** | | [optional] | +| **object** | **String** | | | +| **payment_sources** | [**CustomerPaymentMethodsResponse**](CustomerPaymentMethodsResponse.md) | | [optional] | +| **phone** | **String** | | [optional] | +| **shipping_contacts** | [**CustomerResponseShippingContacts**](CustomerResponseShippingContacts.md) | | [optional] | +| **subscription** | [**SubscriptionResponse**](SubscriptionResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerResponse.new( + antifraud_info: null, + corporate: null, + created_at: 1485151007, + custom_reference: null, + default_fiscal_entity_id: fis_ent_2tKqqAfqPi21oCmEJ, + default_shipping_contact_id: ship_cont_2tKZsTYcsryyu7Ah8, + default_payment_source_id: src_2tHJfJ79KyUwpxTio, + email: Felipe@gmail.com, + fiscal_entities: null, + id: cus_2tHJfJ79KyUwpxTik, + livemode: true, + name: Felipe, + object: customer, + payment_sources: null, + phone: +5215555555555, + shipping_contacts: null, + subscription: null +) +``` + diff --git a/docs/CustomerResponseShippingContacts.md b/docs/CustomerResponseShippingContacts.md new file mode 100644 index 0000000..ba1e4ba --- /dev/null +++ b/docs/CustomerResponseShippingContacts.md @@ -0,0 +1,22 @@ +# Conekta::CustomerResponseShippingContacts + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **data** | [**Array<CustomerShippingContactsDataResponse>**](CustomerShippingContactsDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerResponseShippingContacts.new( + has_more: false, + object: list, + data: null +) +``` + diff --git a/docs/CustomerResponseShippingContactsAllOf.md b/docs/CustomerResponseShippingContactsAllOf.md new file mode 100644 index 0000000..2d5c4ae --- /dev/null +++ b/docs/CustomerResponseShippingContactsAllOf.md @@ -0,0 +1,18 @@ +# Conekta::CustomerResponseShippingContactsAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<CustomerShippingContactsDataResponse>**](CustomerShippingContactsDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerResponseShippingContactsAllOf.new( + data: null +) +``` + diff --git a/docs/CustomerShippingContacts.md b/docs/CustomerShippingContacts.md new file mode 100644 index 0000000..483eaef --- /dev/null +++ b/docs/CustomerShippingContacts.md @@ -0,0 +1,30 @@ +# Conekta::CustomerShippingContacts + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phone** | **String** | Phone contact | [optional] | +| **receiver** | **String** | Name of the person who will receive the order | [optional] | +| **between_streets** | **String** | The street names between which the order will be delivered. | [optional] | +| **address** | [**CustomerShippingContactsAddress**](CustomerShippingContactsAddress.md) | | | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | +| **deleted** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerShippingContacts.new( + phone: +525511223344, + receiver: Marvin Fuller, + between_streets: Ackerman Crescent, + address: null, + parent_id: null, + default: null, + deleted: null +) +``` + diff --git a/docs/CustomerShippingContactsAddress.md b/docs/CustomerShippingContactsAddress.md new file mode 100644 index 0000000..b13dd56 --- /dev/null +++ b/docs/CustomerShippingContactsAddress.md @@ -0,0 +1,30 @@ +# Conekta::CustomerShippingContactsAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **street1** | **String** | | [optional] | +| **street2** | **String** | | [optional] | +| **postal_code** | **String** | | [optional] | +| **city** | **String** | | [optional] | +| **state** | **String** | | [optional] | +| **country** | **String** | this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) | [optional] | +| **residential** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerShippingContactsAddress.new( + street1: avenida siempre viva, + street2: fake street, + postal_code: 06100, + city: Ciudad de Mexico, + state: Ciudad de Mexico, + country: MX, + residential: true +) +``` + diff --git a/docs/CustomerShippingContactsDataResponse.md b/docs/CustomerShippingContactsDataResponse.md new file mode 100644 index 0000000..72147dd --- /dev/null +++ b/docs/CustomerShippingContactsDataResponse.md @@ -0,0 +1,36 @@ +# Conekta::CustomerShippingContactsDataResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phone** | **String** | Phone contact | [optional] | +| **receiver** | **String** | Name of the person who will receive the order | [optional] | +| **between_streets** | **String** | The street names between which the order will be delivered. | [optional] | +| **address** | [**CustomerShippingContactsAddress**](CustomerShippingContactsAddress.md) | | | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | +| **deleted** | **Boolean** | | [optional] | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerShippingContactsDataResponse.new( + phone: +525511223344, + receiver: Marvin Fuller, + between_streets: Ackerman Crescent, + address: null, + parent_id: null, + default: null, + deleted: null, + id: ship_cont_2tKZsTYcsryyu7Ah8, + object: shipping_contact, + created_at: 1675715413 +) +``` + diff --git a/docs/CustomerShippingContactsDataResponseAllOf.md b/docs/CustomerShippingContactsDataResponseAllOf.md new file mode 100644 index 0000000..3702424 --- /dev/null +++ b/docs/CustomerShippingContactsDataResponseAllOf.md @@ -0,0 +1,22 @@ +# Conekta::CustomerShippingContactsDataResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerShippingContactsDataResponseAllOf.new( + id: ship_cont_2tKZsTYcsryyu7Ah8, + object: shipping_contact, + created_at: 1675715413 +) +``` + diff --git a/docs/CustomerShippingContactsResponse.md b/docs/CustomerShippingContactsResponse.md new file mode 100644 index 0000000..da0c395 --- /dev/null +++ b/docs/CustomerShippingContactsResponse.md @@ -0,0 +1,36 @@ +# Conekta::CustomerShippingContactsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phone** | **String** | | [optional] | +| **receiver** | **String** | | [optional] | +| **between_streets** | **String** | | [optional] | +| **address** | [**CustomerShippingContactsResponseAddress**](CustomerShippingContactsResponseAddress.md) | | [optional] | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | +| **id** | **String** | | [optional] | +| **created_at** | **Integer** | | [optional] | +| **object** | **String** | | [optional] | +| **deleted** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerShippingContactsResponse.new( + phone: +525511223344, + receiver: Marvin Fuller, + between_streets: Ackerman Crescent, + address: null, + parent_id: null, + default: false, + id: adr_1234567890, + created_at: 1675715413, + object: shipping_contact, + deleted: false +) +``` + diff --git a/docs/CustomerShippingContactsResponseAddress.md b/docs/CustomerShippingContactsResponseAddress.md new file mode 100644 index 0000000..6ebfd67 --- /dev/null +++ b/docs/CustomerShippingContactsResponseAddress.md @@ -0,0 +1,32 @@ +# Conekta::CustomerShippingContactsResponseAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | | [optional] | +| **street1** | **String** | | [optional] | +| **street2** | **String** | | [optional] | +| **postal_code** | **String** | | [optional] | +| **city** | **String** | | [optional] | +| **state** | **String** | | [optional] | +| **country** | **String** | | [optional] | +| **residential** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerShippingContactsResponseAddress.new( + object: shipping_address, + street1: avenida siempre viva, + street2: fake street, + postal_code: 06100, + city: Ciudad de Mexico, + state: Ciudad de Mexico, + country: MX, + residential: true +) +``` + diff --git a/docs/CustomerUpdateFiscalEntitiesRequest.md b/docs/CustomerUpdateFiscalEntitiesRequest.md new file mode 100644 index 0000000..0cd3296 --- /dev/null +++ b/docs/CustomerUpdateFiscalEntitiesRequest.md @@ -0,0 +1,28 @@ +# Conekta::CustomerUpdateFiscalEntitiesRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **address** | [**CustomerFiscalEntitiesRequestAddress**](CustomerFiscalEntitiesRequestAddress.md) | | [optional] | +| **tax_id** | **String** | | [optional] | +| **email** | **String** | | [optional] | +| **phone** | **String** | | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **company_name** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerUpdateFiscalEntitiesRequest.new( + address: null, + tax_id: null, + email: null, + phone: null, + metadata: null, + company_name: conekta +) +``` + diff --git a/docs/CustomerUpdateShippingContacts.md b/docs/CustomerUpdateShippingContacts.md new file mode 100644 index 0000000..77f65f2 --- /dev/null +++ b/docs/CustomerUpdateShippingContacts.md @@ -0,0 +1,30 @@ +# Conekta::CustomerUpdateShippingContacts + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phone** | **String** | Phone contact | [optional] | +| **receiver** | **String** | Name of the person who will receive the order | [optional] | +| **between_streets** | **String** | The street names between which the order will be delivered. | [optional] | +| **address** | [**CustomerShippingContactsAddress**](CustomerShippingContactsAddress.md) | | [optional] | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | +| **deleted** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomerUpdateShippingContacts.new( + phone: +525511223344, + receiver: Marvin Fuller, + between_streets: Ackerman Crescent, + address: null, + parent_id: null, + default: null, + deleted: null +) +``` + diff --git a/docs/CustomersApi.md b/docs/CustomersApi.md new file mode 100644 index 0000000..c5afcb7 --- /dev/null +++ b/docs/CustomersApi.md @@ -0,0 +1,553 @@ +# Conekta::CustomersApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_customer**](CustomersApi.md#create_customer) | **POST** /customers | Create customer | +| [**create_customer_fiscal_entities**](CustomersApi.md#create_customer_fiscal_entities) | **POST** /customers/{id}/fiscal_entities | Create Fiscal Entity | +| [**delete_customer_by_id**](CustomersApi.md#delete_customer_by_id) | **DELETE** /customers/{id} | Delete Customer | +| [**get_customer_by_id**](CustomersApi.md#get_customer_by_id) | **GET** /customers/{id} | Get Customer | +| [**get_customers**](CustomersApi.md#get_customers) | **GET** /customers | Get a list of customers | +| [**update_customer**](CustomersApi.md#update_customer) | **PUT** /customers/{id} | Update customer | +| [**update_customer_fiscal_entities**](CustomersApi.md#update_customer_fiscal_entities) | **PUT** /customers/{id}/fiscal_entities/{fiscal_entities_id} | Update Fiscal Entity | + + +## create_customer + +> create_customer(customer, opts) + +Create customer + +The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer) + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::CustomersApi.new +customer = Conekta::Customer.new({email: 'miguel@gmail.com', name: 'miguel', phone: '+5215555555555'}) # Customer | requested field for customer +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create customer + result = api_instance.create_customer(customer, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->create_customer: #{e}" +end +``` + +#### Using the create_customer_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_customer_with_http_info(customer, opts) + +```ruby +begin + # Create customer + data, status_code, headers = api_instance.create_customer_with_http_info(customer, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->create_customer_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer** | [**Customer**](Customer.md) | requested field for customer | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CustomerResponse**](CustomerResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## create_customer_fiscal_entities + +> create_customer_fiscal_entities(id, customer_fiscal_entities_request, opts) + +Create Fiscal Entity + +Create Fiscal entity resource that corresponds to a customer ID. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::CustomersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +customer_fiscal_entities_request = Conekta::CustomerFiscalEntitiesRequest.new({address: Conekta::CustomerFiscalEntitiesRequestAddress.new({street1: 'avenida siempre viva', postal_code: '06100', city: 'Ciudad de Mexico'})}) # CustomerFiscalEntitiesRequest | requested field for customer fiscal entities +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Fiscal Entity + result = api_instance.create_customer_fiscal_entities(id, customer_fiscal_entities_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->create_customer_fiscal_entities: #{e}" +end +``` + +#### Using the create_customer_fiscal_entities_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_customer_fiscal_entities_with_http_info(id, customer_fiscal_entities_request, opts) + +```ruby +begin + # Create Fiscal Entity + data, status_code, headers = api_instance.create_customer_fiscal_entities_with_http_info(id, customer_fiscal_entities_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->create_customer_fiscal_entities_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **customer_fiscal_entities_request** | [**CustomerFiscalEntitiesRequest**](CustomerFiscalEntitiesRequest.md) | requested field for customer fiscal entities | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CreateCustomerFiscalEntitiesResponse**](CreateCustomerFiscalEntitiesResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## delete_customer_by_id + +> delete_customer_by_id(id, opts) + +Delete Customer + +Deleted a customer resource that corresponds to a customer ID. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::CustomersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Delete Customer + result = api_instance.delete_customer_by_id(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->delete_customer_by_id: #{e}" +end +``` + +#### Using the delete_customer_by_id_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_customer_by_id_with_http_info(id, opts) + +```ruby +begin + # Delete Customer + data, status_code, headers = api_instance.delete_customer_by_id_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->delete_customer_by_id_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CustomerResponse**](CustomerResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_customer_by_id + +> get_customer_by_id(id, opts) + +Get Customer + +Gets a customer resource that corresponds to a customer ID. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::CustomersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Customer + result = api_instance.get_customer_by_id(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->get_customer_by_id: #{e}" +end +``` + +#### Using the get_customer_by_id_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_customer_by_id_with_http_info(id, opts) + +```ruby +begin + # Get Customer + data, status_code, headers = api_instance.get_customer_by_id_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->get_customer_by_id_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CustomerResponse**](CustomerResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_customers + +> get_customers(opts) + +Get a list of customers + +The purpose of business is to create and maintain a client, you will learn what elements you need to obtain a list of clients, which can be paged. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::CustomersApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get a list of customers + result = api_instance.get_customers(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->get_customers: #{e}" +end +``` + +#### Using the get_customers_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_customers_with_http_info(opts) + +```ruby +begin + # Get a list of customers + data, status_code, headers = api_instance.get_customers_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->get_customers_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**CustomersResponse**](CustomersResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_customer + +> update_customer(id, update_customer, opts) + +Update customer + +You can update customer-related data + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::CustomersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +update_customer = Conekta::UpdateCustomer.new # UpdateCustomer | requested field for customer +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update customer + result = api_instance.update_customer(id, update_customer, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->update_customer: #{e}" +end +``` + +#### Using the update_customer_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_customer_with_http_info(id, update_customer, opts) + +```ruby +begin + # Update customer + data, status_code, headers = api_instance.update_customer_with_http_info(id, update_customer, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->update_customer_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **update_customer** | [**UpdateCustomer**](UpdateCustomer.md) | requested field for customer | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CustomerResponse**](CustomerResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_customer_fiscal_entities + +> update_customer_fiscal_entities(id, fiscal_entities_id, customer_update_fiscal_entities_request, opts) + +Update Fiscal Entity + +Update Fiscal Entity resource that corresponds to a customer ID. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::CustomersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +fiscal_entities_id = 'fis_ent_2tQ8HkkfbauaKP9Ho' # String | identifier +customer_update_fiscal_entities_request = Conekta::CustomerUpdateFiscalEntitiesRequest.new # CustomerUpdateFiscalEntitiesRequest | requested field for customer update fiscal entities +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update Fiscal Entity + result = api_instance.update_customer_fiscal_entities(id, fiscal_entities_id, customer_update_fiscal_entities_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->update_customer_fiscal_entities: #{e}" +end +``` + +#### Using the update_customer_fiscal_entities_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_customer_fiscal_entities_with_http_info(id, fiscal_entities_id, customer_update_fiscal_entities_request, opts) + +```ruby +begin + # Update Fiscal Entity + data, status_code, headers = api_instance.update_customer_fiscal_entities_with_http_info(id, fiscal_entities_id, customer_update_fiscal_entities_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling CustomersApi->update_customer_fiscal_entities_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **fiscal_entities_id** | **String** | identifier | | +| **customer_update_fiscal_entities_request** | [**CustomerUpdateFiscalEntitiesRequest**](CustomerUpdateFiscalEntitiesRequest.md) | requested field for customer update fiscal entities | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**UpdateCustomerFiscalEntitiesResponse**](UpdateCustomerFiscalEntitiesResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/CustomersResponse.md b/docs/CustomersResponse.md new file mode 100644 index 0000000..d777fa8 --- /dev/null +++ b/docs/CustomersResponse.md @@ -0,0 +1,26 @@ +# Conekta::CustomersResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<CustomerResponse>**](CustomerResponse.md) | | [optional] | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomersResponse.new( + data: null, + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1 +) +``` + diff --git a/docs/CustomersResponseAllOf.md b/docs/CustomersResponseAllOf.md new file mode 100644 index 0000000..dd13a31 --- /dev/null +++ b/docs/CustomersResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::CustomersResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<CustomerResponse>**](CustomerResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::CustomersResponseAllOf.new( + data: null +) +``` + diff --git a/docs/DeleteApiKeysResponse.md b/docs/DeleteApiKeysResponse.md new file mode 100644 index 0000000..f81062a --- /dev/null +++ b/docs/DeleteApiKeysResponse.md @@ -0,0 +1,34 @@ +# Conekta::DeleteApiKeysResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **active** | **Boolean** | Indicates if the api key is active | [optional] | +| **created_at** | **Integer** | Unix timestamp in seconds of when the api key was created | [optional] | +| **description** | **String** | A name or brief explanation of what this api key is used for | [optional] | +| **livemode** | **Boolean** | Indicates if the api key is in production | [optional] | +| **prefix** | **String** | The first few characters of the authentication_token | [optional] | +| **id** | **String** | Unique identifier of the api key | [optional] | +| **object** | **String** | Object name, value is 'api_key' | [optional] | +| **deleted** | **Boolean** | | [optional] | +| **role** | **String** | Indicates if the api key is private or public | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::DeleteApiKeysResponse.new( + active: true, + created_at: 1684167881, + description: online store, + livemode: false, + prefix: key_rp, + id: 64625cc9f3e02c00163f5e4d, + object: api_key, + deleted: true, + role: private +) +``` + diff --git a/docs/DeleteApiKeysResponseAllOf.md b/docs/DeleteApiKeysResponseAllOf.md new file mode 100644 index 0000000..3193cbf --- /dev/null +++ b/docs/DeleteApiKeysResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::DeleteApiKeysResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **deleted** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::DeleteApiKeysResponseAllOf.new( + deleted: true +) +``` + diff --git a/docs/DeletedBlacklistRuleResponse.md b/docs/DeletedBlacklistRuleResponse.md new file mode 100644 index 0000000..2e0eb78 --- /dev/null +++ b/docs/DeletedBlacklistRuleResponse.md @@ -0,0 +1,24 @@ +# Conekta::DeletedBlacklistRuleResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Blacklist rule id | [optional] | +| **field** | **String** | field used for blacklists rule deleted | [optional] | +| **value** | **String** | value used for blacklists rule deleted | [optional] | +| **description** | **String** | use an description for blacklisted rule | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::DeletedBlacklistRuleResponse.new( + id: 2fw8EWJusiRrxdPzT, + field: email, + value: email@example.com, + description: banned customer example@example.com +) +``` + diff --git a/docs/DeletedWhitelistRuleResponse.md b/docs/DeletedWhitelistRuleResponse.md new file mode 100644 index 0000000..55f82a9 --- /dev/null +++ b/docs/DeletedWhitelistRuleResponse.md @@ -0,0 +1,24 @@ +# Conekta::DeletedWhitelistRuleResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Whitelist rule id | [optional] | +| **field** | **String** | field used for whitelists rule deleted | [optional] | +| **value** | **String** | value used for whitelists rule deleted | [optional] | +| **description** | **String** | use an description for whitelisted rule | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::DeletedWhitelistRuleResponse.new( + id: 2fw8EWJusiRrxdPzT, + field: email, + value: email@example.com, + description: secure customer example@example.com +) +``` + diff --git a/docs/Details.md b/docs/Details.md new file mode 100644 index 0000000..a424bf7 --- /dev/null +++ b/docs/Details.md @@ -0,0 +1,18 @@ +# Conekta::Details + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **details** | [**Array<DetailsError>**](DetailsError.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::Details.new( + details: null +) +``` + diff --git a/docs/DetailsError.md b/docs/DetailsError.md new file mode 100644 index 0000000..40820ca --- /dev/null +++ b/docs/DetailsError.md @@ -0,0 +1,24 @@ +# Conekta::DetailsError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **String** | | [optional] | +| **param** | **String** | | [optional] | +| **message** | **String** | | [optional] | +| **debug_message** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::DetailsError.new( + code: conekta.errors.authentication.missing_key, + param: null, + message: Acceso no autorizado., + debug_message: Please include your access key in your request. +) +``` + diff --git a/docs/DiscountLinesDataResponse.md b/docs/DiscountLinesDataResponse.md new file mode 100644 index 0000000..530027a --- /dev/null +++ b/docs/DiscountLinesDataResponse.md @@ -0,0 +1,28 @@ +# Conekta::DiscountLinesDataResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The amount to be deducted from the total sum of all payments, in cents. | | +| **code** | **String** | Discount code. | | +| **type** | **String** | It can be 'loyalty', 'campaign', 'coupon' o 'sign' | | +| **id** | **String** | The discount line id | | +| **object** | **String** | The object name | | +| **parent_id** | **String** | The order id | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::DiscountLinesDataResponse.new( + amount: 500, + code: 123, + type: loyalty, + id: dis_lin_2tQQ58HPgPw7StE8z, + object: discount_line, + parent_id: ord_2tPAmKCEJqh8RE6nY +) +``` + diff --git a/docs/DiscountLinesResponse.md b/docs/DiscountLinesResponse.md new file mode 100644 index 0000000..ae600de --- /dev/null +++ b/docs/DiscountLinesResponse.md @@ -0,0 +1,28 @@ +# Conekta::DiscountLinesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The amount to be deducted from the total sum of all payments, in cents. | | +| **code** | **String** | Discount code. | | +| **type** | **String** | It can be 'loyalty', 'campaign', 'coupon' o 'sign' | | +| **id** | **String** | The discount line id | | +| **object** | **String** | The object name | | +| **parent_id** | **String** | The order id | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::DiscountLinesResponse.new( + amount: 500, + code: 123, + type: loyalty, + id: dis_lin_2tQQ58HPgPw7StE8z, + object: discount_line, + parent_id: ord_2tPAmKCEJqh8RE6nY +) +``` + diff --git a/docs/DiscountLinesResponseAllOf.md b/docs/DiscountLinesResponseAllOf.md new file mode 100644 index 0000000..e90f7ca --- /dev/null +++ b/docs/DiscountLinesResponseAllOf.md @@ -0,0 +1,22 @@ +# Conekta::DiscountLinesResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The discount line id | | +| **object** | **String** | The object name | | +| **parent_id** | **String** | The order id | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::DiscountLinesResponseAllOf.new( + id: dis_lin_2tQQ58HPgPw7StE8z, + object: discount_line, + parent_id: ord_2tPAmKCEJqh8RE6nY +) +``` + diff --git a/docs/DiscountsApi.md b/docs/DiscountsApi.md new file mode 100644 index 0000000..78ee6b2 --- /dev/null +++ b/docs/DiscountsApi.md @@ -0,0 +1,405 @@ +# Conekta::DiscountsApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**orders_create_discount_line**](DiscountsApi.md#orders_create_discount_line) | **POST** /orders/{id}/discount_lines | Create Discount | +| [**orders_delete_discount_lines**](DiscountsApi.md#orders_delete_discount_lines) | **DELETE** /orders/{id}/discount_lines/{discount_lines_id} | Delete Discount | +| [**orders_get_discount_line**](DiscountsApi.md#orders_get_discount_line) | **GET** /orders/{id}/discount_lines/{discount_lines_id} | Get Discount | +| [**orders_get_discount_lines**](DiscountsApi.md#orders_get_discount_lines) | **GET** /orders/{id}/discount_lines | Get a List of Discount | +| [**orders_update_discount_lines**](DiscountsApi.md#orders_update_discount_lines) | **PUT** /orders/{id}/discount_lines/{discount_lines_id} | Update Discount | + + +## orders_create_discount_line + +> orders_create_discount_line(id, order_discount_lines_request, opts) + +Create Discount + +Create discount lines for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::DiscountsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +order_discount_lines_request = Conekta::OrderDiscountLinesRequest.new({amount: 500, code: '123', type: 'loyalty'}) # OrderDiscountLinesRequest | requested field for a discount lines +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Discount + result = api_instance.orders_create_discount_line(id, order_discount_lines_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_create_discount_line: #{e}" +end +``` + +#### Using the orders_create_discount_line_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_create_discount_line_with_http_info(id, order_discount_lines_request, opts) + +```ruby +begin + # Create Discount + data, status_code, headers = api_instance.orders_create_discount_line_with_http_info(id, order_discount_lines_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_create_discount_line_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **order_discount_lines_request** | [**OrderDiscountLinesRequest**](OrderDiscountLinesRequest.md) | requested field for a discount lines | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**DiscountLinesResponse**](DiscountLinesResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_delete_discount_lines + +> orders_delete_discount_lines(id, discount_lines_id, opts) + +Delete Discount + +Delete an existing discount lines for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::DiscountsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +discount_lines_id = 'dis_lin_2tQ974hSHcsdeSZHG' # String | discount line id identifier +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Delete Discount + result = api_instance.orders_delete_discount_lines(id, discount_lines_id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_delete_discount_lines: #{e}" +end +``` + +#### Using the orders_delete_discount_lines_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_delete_discount_lines_with_http_info(id, discount_lines_id, opts) + +```ruby +begin + # Delete Discount + data, status_code, headers = api_instance.orders_delete_discount_lines_with_http_info(id, discount_lines_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_delete_discount_lines_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **discount_lines_id** | **String** | discount line id identifier | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**DiscountLinesResponse**](DiscountLinesResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_get_discount_line + +> orders_get_discount_line(id, discount_lines_id, opts) + +Get Discount + +Get an existing discount lines for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::DiscountsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +discount_lines_id = 'dis_lin_2tQ974hSHcsdeSZHG' # String | discount line id identifier +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Discount + result = api_instance.orders_get_discount_line(id, discount_lines_id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_get_discount_line: #{e}" +end +``` + +#### Using the orders_get_discount_line_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_get_discount_line_with_http_info(id, discount_lines_id, opts) + +```ruby +begin + # Get Discount + data, status_code, headers = api_instance.orders_get_discount_line_with_http_info(id, discount_lines_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_get_discount_line_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **discount_lines_id** | **String** | discount line id identifier | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**DiscountLinesResponse**](DiscountLinesResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_get_discount_lines + +> orders_get_discount_lines(id, opts) + +Get a List of Discount + +Get discount lines for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::DiscountsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get a List of Discount + result = api_instance.orders_get_discount_lines(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_get_discount_lines: #{e}" +end +``` + +#### Using the orders_get_discount_lines_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_get_discount_lines_with_http_info(id, opts) + +```ruby +begin + # Get a List of Discount + data, status_code, headers = api_instance.orders_get_discount_lines_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_get_discount_lines_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetOrderDiscountLinesResponse**](GetOrderDiscountLinesResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_update_discount_lines + +> orders_update_discount_lines(id, discount_lines_id, update_order_discount_lines_request, opts) + +Update Discount + +Update an existing discount lines for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::DiscountsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +discount_lines_id = 'dis_lin_2tQ974hSHcsdeSZHG' # String | discount line id identifier +update_order_discount_lines_request = Conekta::UpdateOrderDiscountLinesRequest.new # UpdateOrderDiscountLinesRequest | requested field for a discount lines +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update Discount + result = api_instance.orders_update_discount_lines(id, discount_lines_id, update_order_discount_lines_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_update_discount_lines: #{e}" +end +``` + +#### Using the orders_update_discount_lines_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_update_discount_lines_with_http_info(id, discount_lines_id, update_order_discount_lines_request, opts) + +```ruby +begin + # Update Discount + data, status_code, headers = api_instance.orders_update_discount_lines_with_http_info(id, discount_lines_id, update_order_discount_lines_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling DiscountsApi->orders_update_discount_lines_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **discount_lines_id** | **String** | discount line id identifier | | +| **update_order_discount_lines_request** | [**UpdateOrderDiscountLinesRequest**](UpdateOrderDiscountLinesRequest.md) | requested field for a discount lines | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**DiscountLinesResponse**](DiscountLinesResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/EmailCheckoutRequest.md b/docs/EmailCheckoutRequest.md new file mode 100644 index 0000000..ab0c662 --- /dev/null +++ b/docs/EmailCheckoutRequest.md @@ -0,0 +1,18 @@ +# Conekta::EmailCheckoutRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **email** | **String** | | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::EmailCheckoutRequest.new( + email: example@conekta.com +) +``` + diff --git a/docs/Error.md b/docs/Error.md new file mode 100644 index 0000000..b0ba039 --- /dev/null +++ b/docs/Error.md @@ -0,0 +1,24 @@ +# Conekta::Error + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **details** | [**Array<DetailsError>**](DetailsError.md) | | [optional] | +| **log_id** | **String** | log id | [optional] | +| **type** | **String** | | [optional] | +| **object** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::Error.new( + details: null, + log_id: 507f1f77bcf86cd799439011, + type: authentication_error, + object: error +) +``` + diff --git a/docs/ErrorAllOf.md b/docs/ErrorAllOf.md new file mode 100644 index 0000000..05a73e2 --- /dev/null +++ b/docs/ErrorAllOf.md @@ -0,0 +1,22 @@ +# Conekta::ErrorAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **log_id** | **String** | log id | [optional] | +| **type** | **String** | | [optional] | +| **object** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ErrorAllOf.new( + log_id: 507f1f77bcf86cd799439011, + type: authentication_error, + object: error +) +``` + diff --git a/docs/EventResponse.md b/docs/EventResponse.md new file mode 100644 index 0000000..c9ffaf9 --- /dev/null +++ b/docs/EventResponse.md @@ -0,0 +1,32 @@ +# Conekta::EventResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **created_at** | **Integer** | | [optional] | +| **data** | **Hash<String, Object>** | | [optional] | +| **id** | **String** | | [optional] | +| **livemode** | **Boolean** | | [optional] | +| **object** | **String** | | [optional] | +| **type** | **String** | | [optional] | +| **webhook_logs** | [**Array<WebhookLog>**](WebhookLog.md) | | [optional] | +| **webhook_status** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::EventResponse.new( + created_at: 1661445644, + data: {action=ping, livemode=true}, + id: 6307a60c41de27127515a575, + livemode: true, + object: event, + type: webhook_ping, + webhook_logs: null, + webhook_status: successful +) +``` + diff --git a/docs/EventsApi.md b/docs/EventsApi.md new file mode 100644 index 0000000..fbccb2e --- /dev/null +++ b/docs/EventsApi.md @@ -0,0 +1,239 @@ +# Conekta::EventsApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_event**](EventsApi.md#get_event) | **GET** /events/{id} | Get Event | +| [**get_events**](EventsApi.md#get_events) | **GET** /events | Get list of Events | +| [**resend_event**](EventsApi.md#resend_event) | **POST** /events/{event_id}/webhook_logs/{webhook_log_id}/resend | Resend Event | + + +## get_event + +> get_event(id, opts) + +Get Event + +Returns a single event + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::EventsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Event + result = api_instance.get_event(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling EventsApi->get_event: #{e}" +end +``` + +#### Using the get_event_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_event_with_http_info(id, opts) + +```ruby +begin + # Get Event + data, status_code, headers = api_instance.get_event_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling EventsApi->get_event_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**EventResponse**](EventResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_events + +> get_events(opts) + +Get list of Events + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::EventsApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get list of Events + result = api_instance.get_events(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling EventsApi->get_events: #{e}" +end +``` + +#### Using the get_events_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_events_with_http_info(opts) + +```ruby +begin + # Get list of Events + data, status_code, headers = api_instance.get_events_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling EventsApi->get_events_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetEventsResponse**](GetEventsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## resend_event + +> resend_event(event_id, webhook_log_id, opts) + +Resend Event + +Try to send an event + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::EventsApi.new +event_id = '6463d6e35a4c3e001819e760' # String | event identifier +webhook_log_id = 'webhl_2tsv6NzWJHBWCkqGt' # String | webhook log identifier +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Resend Event + result = api_instance.resend_event(event_id, webhook_log_id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling EventsApi->resend_event: #{e}" +end +``` + +#### Using the resend_event_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> resend_event_with_http_info(event_id, webhook_log_id, opts) + +```ruby +begin + # Resend Event + data, status_code, headers = api_instance.resend_event_with_http_info(event_id, webhook_log_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling EventsApi->resend_event_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **event_id** | **String** | event identifier | | +| **webhook_log_id** | **String** | webhook log identifier | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**EventsResendResponse**](EventsResendResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/EventsResendResponse.md b/docs/EventsResendResponse.md new file mode 100644 index 0000000..de35d37 --- /dev/null +++ b/docs/EventsResendResponse.md @@ -0,0 +1,28 @@ +# Conekta::EventsResendResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **failed_attempts** | **Integer** | | [optional] | +| **id** | **String** | | [optional] | +| **last_attempted_at** | **Integer** | | [optional] | +| **last_http_response_status** | **Integer** | | [optional] | +| **response_data** | **Hash<String, Object>** | | [optional] | +| **url** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::EventsResendResponse.new( + failed_attempts: 6, + id: webhl_2svd2sh6GbqzyWBNZ, + last_attempted_at: 1684265970, + last_http_response_status: 405, + response_data: {}, + url: https://username:password@mockoon.stg.conekta.io/payments-api/cash/merchant_approval +) +``` + diff --git a/docs/GetApiKeysResponse.md b/docs/GetApiKeysResponse.md new file mode 100644 index 0000000..9c7279d --- /dev/null +++ b/docs/GetApiKeysResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetApiKeysResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **data** | [**Array<ApiKeyResponse>**](ApiKeyResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetApiKeysResponse.new( + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + has_more: false, + object: list, + data: null +) +``` + diff --git a/docs/GetApiKeysResponseAllOf.md b/docs/GetApiKeysResponseAllOf.md new file mode 100644 index 0000000..20d0a11 --- /dev/null +++ b/docs/GetApiKeysResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetApiKeysResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<ApiKeyResponse>**](ApiKeyResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetApiKeysResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetChargesResponse.md b/docs/GetChargesResponse.md new file mode 100644 index 0000000..85d7a8c --- /dev/null +++ b/docs/GetChargesResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetChargesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<ChargeResponse>**](ChargeResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetChargesResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetChargesResponseAllOf.md b/docs/GetChargesResponseAllOf.md new file mode 100644 index 0000000..3871f0c --- /dev/null +++ b/docs/GetChargesResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetChargesResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<ChargeResponse>**](ChargeResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetChargesResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetCompaniesResponse.md b/docs/GetCompaniesResponse.md new file mode 100644 index 0000000..f60e091 --- /dev/null +++ b/docs/GetCompaniesResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetCompaniesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<CompanyResponse>**](CompanyResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetCompaniesResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetCompaniesResponseAllOf.md b/docs/GetCompaniesResponseAllOf.md new file mode 100644 index 0000000..785c13b --- /dev/null +++ b/docs/GetCompaniesResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetCompaniesResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<CompanyResponse>**](CompanyResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetCompaniesResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetCustomerPaymentMethodDataResponse.md b/docs/GetCustomerPaymentMethodDataResponse.md new file mode 100644 index 0000000..e1e3bad --- /dev/null +++ b/docs/GetCustomerPaymentMethodDataResponse.md @@ -0,0 +1,83 @@ +# Conekta::GetCustomerPaymentMethodDataResponse + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::GetCustomerPaymentMethodDataResponse.openapi_one_of +# => +# [ +# :'PaymentMethodCardResponse', +# :'PaymentMethodCashResponse', +# :'PaymentMethodSpeiRecurrent' +# ] +``` + +### `openapi_discriminator_name` + +Returns the discriminator's property name. + +#### Example + +```ruby +require 'conekta' + +Conekta::GetCustomerPaymentMethodDataResponse.openapi_discriminator_name +# => :'type' +``` + +### `openapi_discriminator_name` + +Returns the discriminator's mapping. + +#### Example + +```ruby +require 'conekta' + +Conekta::GetCustomerPaymentMethodDataResponse.openapi_discriminator_mapping +# => +# { +# :'card' => :'PaymentMethodCardResponse', +# :'cash' => :'PaymentMethodCashResponse', +# :'oxxo_recurrent' => :'PaymentMethodCashResponse', +# :'spei_recurrent' => :'PaymentMethodSpeiRecurrent' +# } +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::GetCustomerPaymentMethodDataResponse.build(data) +# => # + +Conekta::GetCustomerPaymentMethodDataResponse.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `PaymentMethodCardResponse` +- `PaymentMethodCashResponse` +- `PaymentMethodSpeiRecurrent` +- `nil` (if no type matches) + diff --git a/docs/GetEventsResponse.md b/docs/GetEventsResponse.md new file mode 100644 index 0000000..07fc64f --- /dev/null +++ b/docs/GetEventsResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetEventsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<EventResponse>**](EventResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetEventsResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetEventsResponseAllOf.md b/docs/GetEventsResponseAllOf.md new file mode 100644 index 0000000..aedc92a --- /dev/null +++ b/docs/GetEventsResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetEventsResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<EventResponse>**](EventResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetEventsResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetOrderDiscountLinesResponse.md b/docs/GetOrderDiscountLinesResponse.md new file mode 100644 index 0000000..010d301 --- /dev/null +++ b/docs/GetOrderDiscountLinesResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetOrderDiscountLinesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<DiscountLinesResponse>**](DiscountLinesResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetOrderDiscountLinesResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetOrderDiscountLinesResponseAllOf.md b/docs/GetOrderDiscountLinesResponseAllOf.md new file mode 100644 index 0000000..e03b2c0 --- /dev/null +++ b/docs/GetOrderDiscountLinesResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetOrderDiscountLinesResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<DiscountLinesResponse>**](DiscountLinesResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetOrderDiscountLinesResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetOrdersResponse.md b/docs/GetOrdersResponse.md new file mode 100644 index 0000000..8fe0b7d --- /dev/null +++ b/docs/GetOrdersResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetOrdersResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<OrderResponse>**](OrderResponse.md) | | | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetOrdersResponse.new( + data: null, + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1 +) +``` + diff --git a/docs/GetPaymentMethodResponse.md b/docs/GetPaymentMethodResponse.md new file mode 100644 index 0000000..1bd4499 --- /dev/null +++ b/docs/GetPaymentMethodResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetPaymentMethodResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<GetCustomerPaymentMethodDataResponse>**](GetCustomerPaymentMethodDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetPaymentMethodResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetPaymentMethodResponseAllOf.md b/docs/GetPaymentMethodResponseAllOf.md new file mode 100644 index 0000000..4d8041b --- /dev/null +++ b/docs/GetPaymentMethodResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetPaymentMethodResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<GetCustomerPaymentMethodDataResponse>**](GetCustomerPaymentMethodDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetPaymentMethodResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetPlansResponse.md b/docs/GetPlansResponse.md new file mode 100644 index 0000000..377646e --- /dev/null +++ b/docs/GetPlansResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetPlansResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<PlanResponse>**](PlanResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetPlansResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetPlansResponseAllOf.md b/docs/GetPlansResponseAllOf.md new file mode 100644 index 0000000..487da49 --- /dev/null +++ b/docs/GetPlansResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetPlansResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<PlanResponse>**](PlanResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetPlansResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetTransactionsResponse.md b/docs/GetTransactionsResponse.md new file mode 100644 index 0000000..7da1a47 --- /dev/null +++ b/docs/GetTransactionsResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetTransactionsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<TransactionResponse>**](TransactionResponse.md) | Transactions | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetTransactionsResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetTransactionsResponseAllOf.md b/docs/GetTransactionsResponseAllOf.md new file mode 100644 index 0000000..e322ff7 --- /dev/null +++ b/docs/GetTransactionsResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetTransactionsResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<TransactionResponse>**](TransactionResponse.md) | Transactions | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetTransactionsResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetTransfersResponse.md b/docs/GetTransfersResponse.md new file mode 100644 index 0000000..045090a --- /dev/null +++ b/docs/GetTransfersResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetTransfersResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<TransfersResponse>**](TransfersResponse.md) | Transfers | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetTransfersResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetTransfersResponseAllOf.md b/docs/GetTransfersResponseAllOf.md new file mode 100644 index 0000000..81cbf58 --- /dev/null +++ b/docs/GetTransfersResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetTransfersResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<TransfersResponse>**](TransfersResponse.md) | Transfers | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetTransfersResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetWebhookKeysResponse.md b/docs/GetWebhookKeysResponse.md new file mode 100644 index 0000000..ca514c8 --- /dev/null +++ b/docs/GetWebhookKeysResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetWebhookKeysResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<WebhookKeyResponse>**](WebhookKeyResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetWebhookKeysResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetWebhookKeysResponseAllOf.md b/docs/GetWebhookKeysResponseAllOf.md new file mode 100644 index 0000000..43959c9 --- /dev/null +++ b/docs/GetWebhookKeysResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetWebhookKeysResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<WebhookKeyResponse>**](WebhookKeyResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetWebhookKeysResponseAllOf.new( + data: null +) +``` + diff --git a/docs/GetWebhooksResponse.md b/docs/GetWebhooksResponse.md new file mode 100644 index 0000000..9fa6461 --- /dev/null +++ b/docs/GetWebhooksResponse.md @@ -0,0 +1,26 @@ +# Conekta::GetWebhooksResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<WebhookResponse>**](WebhookResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetWebhooksResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/GetWebhooksResponseAllOf.md b/docs/GetWebhooksResponseAllOf.md new file mode 100644 index 0000000..751dfb1 --- /dev/null +++ b/docs/GetWebhooksResponseAllOf.md @@ -0,0 +1,18 @@ +# Conekta::GetWebhooksResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<WebhookResponse>**](WebhookResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::GetWebhooksResponseAllOf.new( + data: null +) +``` + diff --git a/docs/LogResponse.md b/docs/LogResponse.md new file mode 100644 index 0000000..51a89b3 --- /dev/null +++ b/docs/LogResponse.md @@ -0,0 +1,56 @@ +# Conekta::LogResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **created_at** | **Integer** | | | +| **id** | **String** | | | +| **ip_address** | **String** | | [optional] | +| **livemode** | **Boolean** | | | +| **loggable_id** | **String** | | [optional] | +| **loggable_type** | **String** | | [optional] | +| **method** | **String** | | [optional] | +| **oauth_token_id** | **String** | | [optional] | +| **query_string** | **Hash<String, Object>** | | [optional] | +| **related** | **String** | | [optional] | +| **request_body** | **Object** | | [optional] | +| **request_headers** | **Hash<String, String>** | | [optional] | +| **response_body** | **Object** | | [optional] | +| **response_headers** | **Hash<String, String>** | | [optional] | +| **searchable_tags** | **Array<String>** | | [optional] | +| **status** | **String** | | [optional] | +| **updated_at** | **String** | | [optional] | +| **url** | **String** | | [optional] | +| **user_account_id** | **String** | | [optional] | +| **version** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::LogResponse.new( + created_at: 1661445644, + id: 6307a60c41de27127515a575, + ip_address: 54.235.131.48, + livemode: true, + loggable_id: ord_87632467832, + loggable_type: order, + method: POST, + oauth_token_id: null, + query_string: {amount=3000, payable=true}, + related: FilterResource, + request_body: {filters={amount={amount_from=0, amount_to=0}, created_at={date_from=1653627600, date_to=1661489999}, filterName=Payments, search_term=null, sort_by=created_at, sort_direction=desc, status=[], type=[]}, id=78e65162-0f37-4942-847c-9bf7081d54c2, page=0, report_type=charges, testMode=false}, + request_headers: {Accept=application/vnd.conekta-v2.1.0+json, Accept-Encoding=gzip, deflate, br, Accept-Language=es-419, es; q=0.9, en; q=0.8, Activitypermission=orders:read, Apiversion=2.1.0}, + response_body: null, + response_headers: {Access-Control-Allow-Headers=Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, X-Prototype-Version, Authorization, Accept, Date, Version, X-Forwarded-For, Host, Connection, X-Forwarded-Proto, X-Forwarded-Port, X-Amzn-Trace-Id, Accept-Encoding, Accept-Language, Referer, Origin, Activitypermission, Apiversion, Entityid, Livemode, Sec-Ch-Ua, Sec-Ch-Ua-Mobile, Sec-Ch-Ua-Platform, Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site, X-Datadog-Parent-Id, X-Datadog-Sampling-Priority, X-Datadog-Trace-Id, X-Forwarded-Host, X-Forwarded-Server, X-Real-Ip, Access-Control-Allow-Methods=POST, GET, PUT, OPTIONS, Access-Control-Allow-Origin=*, Access-Control-Max-Age=1728000, Conekta-Media-Type=conekta-v2.1.0; format=application/json, Content-Type=application/json; charset=utf-8, Referrer-Policy=strict-origin-when-cross-origin, Strict-Transport-Security=max-age=31536000; includeSubDomains, X-Content-Type-Options=nosniff, X-Download-Options=noopen, X-Frame-Options=SAMEORIGIN, X-Permitted-Cross-Domain-Policies=none, X-XSS-Protection=1; mode=block}, + searchable_tags: [6307a60c41de27127515a575, 6307a60c41de27127515a571], + status: 200, + updated_at: 2022-08-25T16:40:44.887Z, + url: /filter_resource, + user_account_id: 5a0b7001edbb6e1725b0b2c6, + version: 2.1.0 +) +``` + diff --git a/docs/LogsApi.md b/docs/LogsApi.md new file mode 100644 index 0000000..4fc8b3f --- /dev/null +++ b/docs/LogsApi.md @@ -0,0 +1,165 @@ +# Conekta::LogsApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_log_by_id**](LogsApi.md#get_log_by_id) | **GET** /logs/{id} | Get Log | +| [**get_logs**](LogsApi.md#get_logs) | **GET** /logs | Get List Of Logs | + + +## get_log_by_id + +> get_log_by_id(id, opts) + +Get Log + +Get the details of a specific log + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::LogsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Log + result = api_instance.get_log_by_id(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling LogsApi->get_log_by_id: #{e}" +end +``` + +#### Using the get_log_by_id_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_log_by_id_with_http_info(id, opts) + +```ruby +begin + # Get Log + data, status_code, headers = api_instance.get_log_by_id_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling LogsApi->get_log_by_id_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**LogResponse**](LogResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_logs + +> get_logs(opts) + +Get List Of Logs + +Get log details in the form of a list + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::LogsApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get List Of Logs + result = api_instance.get_logs(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling LogsApi->get_logs: #{e}" +end +``` + +#### Using the get_logs_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_logs_with_http_info(opts) + +```ruby +begin + # Get List Of Logs + data, status_code, headers = api_instance.get_logs_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling LogsApi->get_logs_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**LogsResponse**](LogsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/LogsResponse.md b/docs/LogsResponse.md new file mode 100644 index 0000000..19f6ee7 --- /dev/null +++ b/docs/LogsResponse.md @@ -0,0 +1,26 @@ +# Conekta::LogsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | True, if there are more pages. | [optional][readonly] | +| **object** | **String** | The object type | [optional][readonly] | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<LogsResponseData>**](LogsResponseData.md) | set to page results. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::LogsResponse.new( + has_more: null, + object: null, + next_page_url: null, + previous_page_url: null, + data: null +) +``` + diff --git a/docs/LogsResponseData.md b/docs/LogsResponseData.md new file mode 100644 index 0000000..e200f5e --- /dev/null +++ b/docs/LogsResponseData.md @@ -0,0 +1,56 @@ +# Conekta::LogsResponseData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **created_at** | **Integer** | | [optional] | +| **id** | **String** | | [optional] | +| **ip_address** | **String** | | [optional] | +| **livemode** | **Boolean** | | [optional] | +| **loggable_id** | **String** | | [optional] | +| **loggable_type** | **String** | | [optional] | +| **method** | **String** | | [optional] | +| **oauth_token_id** | **String** | | [optional] | +| **query_string** | **Hash<String, Object>** | | [optional] | +| **related** | **String** | | [optional] | +| **request_body** | **Object** | | [optional] | +| **request_headers** | **Hash<String, String>** | | [optional] | +| **response_body** | **Object** | | [optional] | +| **response_headers** | **Hash<String, String>** | | [optional] | +| **searchable_tags** | **Array<String>** | | [optional] | +| **status** | **String** | | [optional] | +| **updated_at** | **String** | | [optional] | +| **url** | **String** | | [optional] | +| **user_account_id** | **String** | | [optional] | +| **version** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::LogsResponseData.new( + created_at: 1661445644, + id: 6307a60c41de27127515a575, + ip_address: 54.235.131.48, + livemode: true, + loggable_id: ord_87632467832, + loggable_type: order, + method: POST, + oauth_token_id: null, + query_string: {amount=3000, payable=true}, + related: FilterResource, + request_body: {filters={amount={amount_from=0, amount_to=0}, created_at={date_from=1653627600, date_to=1661489999}, filterName=Payments, search_term=null, sort_by=created_at, sort_direction=desc, status=[], type=[]}, id=78e65162-0f37-4942-847c-9bf7081d54c2, page=0, report_type=charges, testMode=false}, + request_headers: {Accept=application/vnd.conekta-v2.1.0+json, Accept-Encoding=gzip, deflate, br, Accept-Language=es-419, es; q=0.9, en; q=0.8, Activitypermission=orders:read, Apiversion=2.1.0}, + response_body: null, + response_headers: {Access-Control-Allow-Headers=Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, X-Prototype-Version, Authorization, Accept, Date, Version, X-Forwarded-For, Host, Connection, X-Forwarded-Proto, X-Forwarded-Port, X-Amzn-Trace-Id, Accept-Encoding, Accept-Language, Referer, Origin, Activitypermission, Apiversion, Entityid, Livemode, Sec-Ch-Ua, Sec-Ch-Ua-Mobile, Sec-Ch-Ua-Platform, Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site, X-Datadog-Parent-Id, X-Datadog-Sampling-Priority, X-Datadog-Trace-Id, X-Forwarded-Host, X-Forwarded-Server, X-Real-Ip, Access-Control-Allow-Methods=POST, GET, PUT, OPTIONS, Access-Control-Allow-Origin=*, Access-Control-Max-Age=1728000, Conekta-Media-Type=conekta-v2.1.0; format=application/json, Content-Type=application/json; charset=utf-8, Referrer-Policy=strict-origin-when-cross-origin, Strict-Transport-Security=max-age=31536000; includeSubDomains, X-Content-Type-Options=nosniff, X-Download-Options=noopen, X-Frame-Options=SAMEORIGIN, X-Permitted-Cross-Domain-Policies=none, X-XSS-Protection=1; mode=block}, + searchable_tags: [6307a60c41de27127515a575, 6307a60c41de27127515a571], + status: 200, + updated_at: 2022-08-25T16:40:44.887Z, + url: /filter_resource, + user_account_id: 5a0b7001edbb6e1725b0b2c6, + version: 2.1.0 +) +``` + diff --git a/docs/OrderCaptureRequest.md b/docs/OrderCaptureRequest.md new file mode 100644 index 0000000..6965b4a --- /dev/null +++ b/docs/OrderCaptureRequest.md @@ -0,0 +1,18 @@ +# Conekta::OrderCaptureRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Amount to capture | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderCaptureRequest.new( + amount: 500 +) +``` + diff --git a/docs/OrderDiscountLinesRequest.md b/docs/OrderDiscountLinesRequest.md new file mode 100644 index 0000000..0f5eecc --- /dev/null +++ b/docs/OrderDiscountLinesRequest.md @@ -0,0 +1,22 @@ +# Conekta::OrderDiscountLinesRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The amount to be deducted from the total sum of all payments, in cents. | | +| **code** | **String** | Discount code. | | +| **type** | **String** | It can be 'loyalty', 'campaign', 'coupon' o 'sign' | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderDiscountLinesRequest.new( + amount: 500, + code: 123, + type: loyalty +) +``` + diff --git a/docs/OrderRefundRequest.md b/docs/OrderRefundRequest.md new file mode 100644 index 0000000..6acee14 --- /dev/null +++ b/docs/OrderRefundRequest.md @@ -0,0 +1,22 @@ +# Conekta::OrderRefundRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | | | +| **expires_at** | **Integer** | | [optional] | +| **reason** | **String** | | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderRefundRequest.new( + amount: 500, + expires_at: 1553273553, + reason: suspected_fraud +) +``` + diff --git a/docs/OrderRequest.md b/docs/OrderRequest.md new file mode 100644 index 0000000..a326abe --- /dev/null +++ b/docs/OrderRequest.md @@ -0,0 +1,42 @@ +# Conekta::OrderRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **charges** | [**Array<ChargeRequest>**](ChargeRequest.md) | List of [charges](https://developers.conekta.com/v2.1.0/reference/orderscreatecharge) that are applied to the order | [optional] | +| **checkout** | [**CheckoutRequest**](CheckoutRequest.md) | | [optional] | +| **currency** | **String** | Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) | | +| **customer_info** | [**OrderRequestCustomerInfo**](OrderRequestCustomerInfo.md) | | | +| **discount_lines** | [**Array<OrderDiscountLinesRequest>**](OrderDiscountLinesRequest.md) | List of [discounts](https://developers.conekta.com/v2.1.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount. | [optional] | +| **line_items** | [**Array<Product>**](Product.md) | List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product. | | +| **metadata** | **Hash<String, Object>** | Metadata associated with the order | [optional] | +| **needs_shipping_contact** | **Boolean** | Allows you to fill out the shipping information at checkout | [optional] | +| **pre_authorize** | **Boolean** | Indicates whether the order charges must be preauthorized | [optional][default to false] | +| **processing_mode** | **String** | Indicates the processing mode for the order, either ecommerce, recurrent or validation. | [optional] | +| **shipping_contact** | [**CustomerShippingContacts**](CustomerShippingContacts.md) | | [optional] | +| **shipping_lines** | [**Array<ShippingRequest>**](ShippingRequest.md) | List of [shipping costs](https://developers.conekta.com/v2.1.0/reference/orderscreateshipping). If the online store offers digital products. | [optional] | +| **tax_lines** | [**Array<OrderTaxRequest>**](OrderTaxRequest.md) | List of [taxes](https://developers.conekta.com/v2.1.0/reference/orderscreatetaxes) that are applied to the order. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderRequest.new( + charges: null, + checkout: null, + currency: MXN, + customer_info: null, + discount_lines: null, + line_items: null, + metadata: null, + needs_shipping_contact: false, + pre_authorize: null, + processing_mode: ecommerce, + shipping_contact: null, + shipping_lines: null, + tax_lines: null +) +``` + diff --git a/docs/OrderRequestCustomerInfo.md b/docs/OrderRequestCustomerInfo.md new file mode 100644 index 0000000..65bd499 --- /dev/null +++ b/docs/OrderRequestCustomerInfo.md @@ -0,0 +1,49 @@ +# Conekta::OrderRequestCustomerInfo + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::OrderRequestCustomerInfo.openapi_one_of +# => +# [ +# :'CustomerInfo', +# :'CustomerInfoJustCustomerId' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::OrderRequestCustomerInfo.build(data) +# => # + +Conekta::OrderRequestCustomerInfo.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `CustomerInfo` +- `CustomerInfoJustCustomerId` +- `nil` (if no type matches) + diff --git a/docs/OrderResponse.md b/docs/OrderResponse.md new file mode 100644 index 0000000..13c5064 --- /dev/null +++ b/docs/OrderResponse.md @@ -0,0 +1,56 @@ +# Conekta::OrderResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The total amount to be collected in cents | [optional] | +| **amount_refunded** | **Integer** | The total amount refunded in cents | [optional] | +| **channel** | [**ChargeResponseChannel**](ChargeResponseChannel.md) | | [optional] | +| **charges** | [**OrderResponseCharges**](OrderResponseCharges.md) | | [optional] | +| **checkout** | [**OrderResponseCheckout**](OrderResponseCheckout.md) | | [optional] | +| **created_at** | **Integer** | The time at which the object was created in seconds since the Unix epoch | [optional] | +| **currency** | **String** | The three-letter ISO 4217 currency code. The currency of the order. | [optional] | +| **customer_info** | [**OrderResponseCustomerInfo**](OrderResponseCustomerInfo.md) | | [optional] | +| **discount_lines** | [**OrderResponseDiscountLines**](OrderResponseDiscountLines.md) | | [optional] | +| **fiscal_entity** | [**OrderResponseFiscalEntity**](OrderResponseFiscalEntity.md) | | [optional] | +| **id** | **String** | | [optional] | +| **is_refundable** | **Boolean** | | [optional] | +| **line_items** | [**OrderResponseProducts**](OrderResponseProducts.md) | | [optional] | +| **livemode** | **Boolean** | Whether the object exists in live mode or test mode | [optional] | +| **metadata** | **Hash<String, Object>** | Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. | [optional] | +| **object** | **String** | String representing the object’s type. Objects of the same type share the same value. | [optional] | +| **payment_status** | **String** | The payment status of the order. | [optional] | +| **processing_mode** | **String** | Indicates the processing mode for the order, either ecommerce, recurrent or validation. | [optional] | +| **shipping_contact** | [**OrderResponseShippingContact**](OrderResponseShippingContact.md) | | [optional] | +| **updated_at** | **Integer** | The time at which the object was last updated in seconds since the Unix epoch | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponse.new( + amount: 21605, + amount_refunded: 0, + channel: null, + charges: null, + checkout: null, + created_at: 1676328434, + currency: MXN, + customer_info: null, + discount_lines: null, + fiscal_entity: null, + id: ord_2tMtQQpDvfnNjiuFG, + is_refundable: false, + line_items: null, + livemode: false, + metadata: null, + object: order, + payment_status: paid, + processing_mode: ecommerce, + shipping_contact: null, + updated_at: 1676328434 +) +``` + diff --git a/docs/OrderResponseCharges.md b/docs/OrderResponseCharges.md new file mode 100644 index 0000000..f1b9c96 --- /dev/null +++ b/docs/OrderResponseCharges.md @@ -0,0 +1,22 @@ +# Conekta::OrderResponseCharges + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **data** | [**Array<ChargesDataResponse>**](ChargesDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseCharges.new( + has_more: false, + object: list, + data: null +) +``` + diff --git a/docs/OrderResponseChargesAllOf.md b/docs/OrderResponseChargesAllOf.md new file mode 100644 index 0000000..87bed24 --- /dev/null +++ b/docs/OrderResponseChargesAllOf.md @@ -0,0 +1,18 @@ +# Conekta::OrderResponseChargesAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<ChargesDataResponse>**](ChargesDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseChargesAllOf.new( + data: null +) +``` + diff --git a/docs/OrderResponseCheckout.md b/docs/OrderResponseCheckout.md new file mode 100644 index 0000000..7a39116 --- /dev/null +++ b/docs/OrderResponseCheckout.md @@ -0,0 +1,68 @@ +# Conekta::OrderResponseCheckout + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **allowed_payment_methods** | **Array<String>** | | [optional] | +| **can_not_expire** | **Boolean** | | [optional] | +| **emails_sent** | **Integer** | | [optional] | +| **exclude_card_networks** | **Array<Object>** | | [optional] | +| **expires_at** | **Integer** | | [optional] | +| **failure_url** | **String** | | [optional] | +| **force_3ds_flow** | **Boolean** | | [optional] | +| **id** | **String** | | [optional] | +| **is_redirect_on_failure** | **Boolean** | | [optional] | +| **livemode** | **Boolean** | | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **monthly_installments_enabled** | **Boolean** | | [optional] | +| **monthly_installments_options** | **Array<Integer>** | | [optional] | +| **name** | **String** | | [optional] | +| **needs_shipping_contact** | **Boolean** | | [optional] | +| **object** | **String** | | [optional] | +| **on_demand_enabled** | **Boolean** | | [optional] | +| **paid_payments_count** | **Integer** | | [optional] | +| **recurrent** | **Boolean** | | [optional] | +| **slug** | **String** | | [optional] | +| **sms_sent** | **Integer** | | [optional] | +| **success_url** | **String** | | [optional] | +| **starts_at** | **Integer** | | [optional] | +| **status** | **String** | | [optional] | +| **type** | **String** | | [optional] | +| **url** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseCheckout.new( + allowed_payment_methods: null, + can_not_expire: false, + emails_sent: 0, + exclude_card_networks: null, + expires_at: 1676613599, + failure_url: http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx, + force_3ds_flow: false, + id: 6fca054a-8519-4c43-971e-cea35cc519bb, + is_redirect_on_failure: false, + livemode: false, + metadata: null, + monthly_installments_enabled: false, + monthly_installments_options: null, + name: ord-2tNDzhA4Akmzj11AS, + needs_shipping_contact: false, + object: checkout, + on_demand_enabled: true, + paid_payments_count: 0, + recurrent: false, + slug: 6fca054a85194c43971ecea35cc519bb, + sms_sent: 0, + success_url: http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx, + starts_at: 1676354400, + status: Issued, + type: HostedPayment, + url: https://pay.stg.conekta.io/checkout/6fca054a85194c43971ecea35cc519bb +) +``` + diff --git a/docs/OrderResponseCustomerInfo.md b/docs/OrderResponseCustomerInfo.md new file mode 100644 index 0000000..5516f47 --- /dev/null +++ b/docs/OrderResponseCustomerInfo.md @@ -0,0 +1,28 @@ +# Conekta::OrderResponseCustomerInfo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | | [optional] | +| **name** | **String** | | [optional] | +| **email** | **String** | | [optional] | +| **phone** | **String** | | [optional] | +| **corporate** | **Boolean** | | [optional][default to false] | +| **customer_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseCustomerInfo.new( + object: customer_info, + name: DevTest, + email: test@conekta.com, + phone: 5522997233, + corporate: null, + customer_id: cus_23874283647 +) +``` + diff --git a/docs/OrderResponseCustomerInfoAllOf.md b/docs/OrderResponseCustomerInfoAllOf.md new file mode 100644 index 0000000..d34afe9 --- /dev/null +++ b/docs/OrderResponseCustomerInfoAllOf.md @@ -0,0 +1,18 @@ +# Conekta::OrderResponseCustomerInfoAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseCustomerInfoAllOf.new( + object: customer_info +) +``` + diff --git a/docs/OrderResponseDiscountLines.md b/docs/OrderResponseDiscountLines.md new file mode 100644 index 0000000..7ba2b88 --- /dev/null +++ b/docs/OrderResponseDiscountLines.md @@ -0,0 +1,22 @@ +# Conekta::OrderResponseDiscountLines + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **data** | [**Array<DiscountLinesDataResponse>**](DiscountLinesDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseDiscountLines.new( + has_more: false, + object: list, + data: null +) +``` + diff --git a/docs/OrderResponseDiscountLinesAllOf.md b/docs/OrderResponseDiscountLinesAllOf.md new file mode 100644 index 0000000..5ce01d4 --- /dev/null +++ b/docs/OrderResponseDiscountLinesAllOf.md @@ -0,0 +1,18 @@ +# Conekta::OrderResponseDiscountLinesAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<DiscountLinesDataResponse>**](DiscountLinesDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseDiscountLinesAllOf.new( + data: null +) +``` + diff --git a/docs/OrderResponseFiscalEntity.md b/docs/OrderResponseFiscalEntity.md new file mode 100644 index 0000000..2016d9b --- /dev/null +++ b/docs/OrderResponseFiscalEntity.md @@ -0,0 +1,24 @@ +# Conekta::OrderResponseFiscalEntity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **address** | [**OrderResponseFiscalEntityAddress**](OrderResponseFiscalEntityAddress.md) | | [optional] | +| **tax_id** | **String** | | [optional] | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseFiscalEntity.new( + address: null, + tax_id: 324234234, + id: fis_ent_2tN85VYaSMyDvjB3M, + object: fiscal_entity +) +``` + diff --git a/docs/OrderResponseFiscalEntityAddress.md b/docs/OrderResponseFiscalEntityAddress.md new file mode 100644 index 0000000..396a1d2 --- /dev/null +++ b/docs/OrderResponseFiscalEntityAddress.md @@ -0,0 +1,34 @@ +# Conekta::OrderResponseFiscalEntityAddress + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **street1** | **String** | | | +| **street2** | **String** | | [optional] | +| **postal_code** | **String** | | | +| **city** | **String** | | | +| **state** | **String** | | [optional] | +| **country** | **String** | this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) | [optional] | +| **residential** | **Boolean** | | [optional] | +| **external_number** | **String** | | [optional] | +| **object** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseFiscalEntityAddress.new( + street1: avenida siempre viva, + street2: fake street, + postal_code: 06100, + city: Ciudad de Mexico, + state: Ciudad de Mexico, + country: MX, + residential: true, + external_number: null, + object: fiscal_entity_address +) +``` + diff --git a/docs/OrderResponseFiscalEntityAddressAllOf.md b/docs/OrderResponseFiscalEntityAddressAllOf.md new file mode 100644 index 0000000..c2d8839 --- /dev/null +++ b/docs/OrderResponseFiscalEntityAddressAllOf.md @@ -0,0 +1,18 @@ +# Conekta::OrderResponseFiscalEntityAddressAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **object** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseFiscalEntityAddressAllOf.new( + object: fiscal_entity_address +) +``` + diff --git a/docs/OrderResponseProducts.md b/docs/OrderResponseProducts.md new file mode 100644 index 0000000..208fb95 --- /dev/null +++ b/docs/OrderResponseProducts.md @@ -0,0 +1,26 @@ +# Conekta::OrderResponseProducts + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<ProductDataResponse>**](ProductDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseProducts.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/OrderResponseProductsAllOf.md b/docs/OrderResponseProductsAllOf.md new file mode 100644 index 0000000..a58a1ae --- /dev/null +++ b/docs/OrderResponseProductsAllOf.md @@ -0,0 +1,18 @@ +# Conekta::OrderResponseProductsAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<ProductDataResponse>**](ProductDataResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseProductsAllOf.new( + data: null +) +``` + diff --git a/docs/OrderResponseShippingContact.md b/docs/OrderResponseShippingContact.md new file mode 100644 index 0000000..ef07031 --- /dev/null +++ b/docs/OrderResponseShippingContact.md @@ -0,0 +1,36 @@ +# Conekta::OrderResponseShippingContact + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **created_at** | **Integer** | | [optional] | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **phone** | **String** | | [optional] | +| **receiver** | **String** | | [optional] | +| **between_streets** | **String** | | [optional] | +| **address** | [**CustomerShippingContactsResponseAddress**](CustomerShippingContactsResponseAddress.md) | | [optional] | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | +| **deleted** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseShippingContact.new( + created_at: 1675715413, + id: adr_1234567890, + object: shipping_contact, + phone: +525511223344, + receiver: Marvin Fuller, + between_streets: Ackerman Crescent, + address: null, + parent_id: null, + default: false, + deleted: false +) +``` + diff --git a/docs/OrderResponseShippingContactAllOf.md b/docs/OrderResponseShippingContactAllOf.md new file mode 100644 index 0000000..6e8c1e2 --- /dev/null +++ b/docs/OrderResponseShippingContactAllOf.md @@ -0,0 +1,22 @@ +# Conekta::OrderResponseShippingContactAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **created_at** | **Integer** | | [optional] | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderResponseShippingContactAllOf.new( + created_at: null, + id: null, + object: null +) +``` + diff --git a/docs/OrderTaxRequest.md b/docs/OrderTaxRequest.md new file mode 100644 index 0000000..2fb7c05 --- /dev/null +++ b/docs/OrderTaxRequest.md @@ -0,0 +1,22 @@ +# Conekta::OrderTaxRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The amount to be collected for tax in cents | | +| **description** | **String** | description or tax's name | | +| **metadata** | **Hash<String, Object>** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderTaxRequest.new( + amount: 100, + description: testing, + metadata: {key=value} +) +``` + diff --git a/docs/OrderUpdateRequest.md b/docs/OrderUpdateRequest.md new file mode 100644 index 0000000..49d71e4 --- /dev/null +++ b/docs/OrderUpdateRequest.md @@ -0,0 +1,38 @@ +# Conekta::OrderUpdateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **charges** | [**Array<ChargeRequest>**](ChargeRequest.md) | | [optional] | +| **checkout** | [**CheckoutRequest**](CheckoutRequest.md) | | [optional] | +| **currency** | **String** | Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) | [optional] | +| **customer_info** | [**OrderUpdateRequestCustomerInfo**](OrderUpdateRequestCustomerInfo.md) | | [optional] | +| **discount_lines** | [**Array<OrderDiscountLinesRequest>**](OrderDiscountLinesRequest.md) | List of [discounts](https://developers.conekta.com/v2.1.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount. | [optional] | +| **line_items** | [**Array<Product>**](Product.md) | List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product. | [optional] | +| **metadata** | **Hash<String, String>** | | [optional] | +| **pre_authorize** | **Boolean** | Indicates whether the order charges must be preauthorized | [optional][default to false] | +| **shipping_contact** | [**CustomerShippingContacts**](CustomerShippingContacts.md) | | [optional] | +| **shipping_lines** | [**Array<ShippingRequest>**](ShippingRequest.md) | List of [shipping costs](https://developers.conekta.com/v2.1.0/reference/orderscreateshipping). If the online store offers digital products. | [optional] | +| **tax_lines** | [**Array<OrderTaxRequest>**](OrderTaxRequest.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrderUpdateRequest.new( + charges: null, + checkout: null, + currency: MXN, + customer_info: null, + discount_lines: null, + line_items: null, + metadata: null, + pre_authorize: null, + shipping_contact: null, + shipping_lines: null, + tax_lines: null +) +``` + diff --git a/docs/OrderUpdateRequestCustomerInfo.md b/docs/OrderUpdateRequestCustomerInfo.md new file mode 100644 index 0000000..50cba4d --- /dev/null +++ b/docs/OrderUpdateRequestCustomerInfo.md @@ -0,0 +1,49 @@ +# Conekta::OrderUpdateRequestCustomerInfo + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::OrderUpdateRequestCustomerInfo.openapi_one_of +# => +# [ +# :'CustomerInfo', +# :'CustomerInfoJustCustomerId' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::OrderUpdateRequestCustomerInfo.build(data) +# => # + +Conekta::OrderUpdateRequestCustomerInfo.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `CustomerInfo` +- `CustomerInfoJustCustomerId` +- `nil` (if no type matches) + diff --git a/docs/OrdersApi.md b/docs/OrdersApi.md new file mode 100644 index 0000000..004d0d8 --- /dev/null +++ b/docs/OrdersApi.md @@ -0,0 +1,627 @@ +# Conekta::OrdersApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**cancel_order**](OrdersApi.md#cancel_order) | **POST** /orders/{id}/cancel | Cancel Order | +| [**create_order**](OrdersApi.md#create_order) | **POST** /orders | Create order | +| [**get_order_by_id**](OrdersApi.md#get_order_by_id) | **GET** /orders/{id} | Get Order | +| [**get_orders**](OrdersApi.md#get_orders) | **GET** /orders | Get a list of Orders | +| [**order_cancel_refund**](OrdersApi.md#order_cancel_refund) | **DELETE** /orders/{id}/refunds/{refund_id} | Cancel Refund | +| [**order_refund**](OrdersApi.md#order_refund) | **POST** /orders/{id}/refunds | Refund Order | +| [**orders_create_capture**](OrdersApi.md#orders_create_capture) | **POST** /orders/{id}/capture | Capture Order | +| [**update_order**](OrdersApi.md#update_order) | **PUT** /orders/{id} | Update Order | + + +## cancel_order + +> cancel_order(id, opts) + +Cancel Order + +Cancel an order that has been previously created. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::OrdersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Cancel Order + result = api_instance.cancel_order(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->cancel_order: #{e}" +end +``` + +#### Using the cancel_order_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> cancel_order_with_http_info(id, opts) + +```ruby +begin + # Cancel Order + data, status_code, headers = api_instance.cancel_order_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->cancel_order_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**OrderResponse**](OrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## create_order + +> create_order(order_request, opts) + +Create order + +Create a new order. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::OrdersApi.new +order_request = Conekta::OrderRequest.new({currency: 'MXN', customer_info: Conekta::CustomerInfo.new({name: 'DevTest', email: 'test@conekta.com', phone: '5522997233'}), line_items: [Conekta::Product.new({name: 'Box of Cohiba S1s', quantity: 1, unit_price: 20000})]}) # OrderRequest | requested field for order +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create order + result = api_instance.create_order(order_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->create_order: #{e}" +end +``` + +#### Using the create_order_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_order_with_http_info(order_request, opts) + +```ruby +begin + # Create order + data, status_code, headers = api_instance.create_order_with_http_info(order_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->create_order_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **order_request** | [**OrderRequest**](OrderRequest.md) | requested field for order | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**OrderResponse**](OrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_order_by_id + +> get_order_by_id(id, opts) + +Get Order + +Info for a specific order + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::OrdersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Order + result = api_instance.get_order_by_id(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->get_order_by_id: #{e}" +end +``` + +#### Using the get_order_by_id_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_order_by_id_with_http_info(id, opts) + +```ruby +begin + # Get Order + data, status_code, headers = api_instance.get_order_by_id_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->get_order_by_id_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**OrderResponse**](OrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_orders + +> get_orders(opts) + +Get a list of Orders + +Get order details in the form of a list + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::OrdersApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get a list of Orders + result = api_instance.get_orders(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->get_orders: #{e}" +end +``` + +#### Using the get_orders_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_orders_with_http_info(opts) + +```ruby +begin + # Get a list of Orders + data, status_code, headers = api_instance.get_orders_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->get_orders_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetOrdersResponse**](GetOrdersResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## order_cancel_refund + +> order_cancel_refund(id, refund_id, opts) + +Cancel Refund + +A refunded order describes the items, amount, and reason an order is being refunded. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::OrdersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +refund_id = '6407b5bee1329a000175ba11' # String | refund identifier +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Cancel Refund + result = api_instance.order_cancel_refund(id, refund_id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->order_cancel_refund: #{e}" +end +``` + +#### Using the order_cancel_refund_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> order_cancel_refund_with_http_info(id, refund_id, opts) + +```ruby +begin + # Cancel Refund + data, status_code, headers = api_instance.order_cancel_refund_with_http_info(id, refund_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->order_cancel_refund_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **refund_id** | **String** | refund identifier | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**OrderResponse**](OrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## order_refund + +> order_refund(id, order_refund_request, opts) + +Refund Order + +A refunded order describes the items, amount, and reason an order is being refunded. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::OrdersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +order_refund_request = Conekta::OrderRefundRequest.new({amount: 500, reason: 'suspected_fraud'}) # OrderRefundRequest | requested field for a refund +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Refund Order + result = api_instance.order_refund(id, order_refund_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->order_refund: #{e}" +end +``` + +#### Using the order_refund_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> order_refund_with_http_info(id, order_refund_request, opts) + +```ruby +begin + # Refund Order + data, status_code, headers = api_instance.order_refund_with_http_info(id, order_refund_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->order_refund_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **order_refund_request** | [**OrderRefundRequest**](OrderRefundRequest.md) | requested field for a refund | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**OrderResponse**](OrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_create_capture + +> orders_create_capture(id, opts) + +Capture Order + +Processes an order that has been previously authorized. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::OrdersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + order_capture_request: Conekta::OrderCaptureRequest.new({amount: 500}) # OrderCaptureRequest | requested fields for capture order +} + +begin + # Capture Order + result = api_instance.orders_create_capture(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->orders_create_capture: #{e}" +end +``` + +#### Using the orders_create_capture_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_create_capture_with_http_info(id, opts) + +```ruby +begin + # Capture Order + data, status_code, headers = api_instance.orders_create_capture_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->orders_create_capture_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **order_capture_request** | [**OrderCaptureRequest**](OrderCaptureRequest.md) | requested fields for capture order | [optional] | + +### Return type + +[**OrderResponse**](OrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_order + +> update_order(id, order_update_request, opts) + +Update Order + +Update an existing Order. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::OrdersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +order_update_request = Conekta::OrderUpdateRequest.new # OrderUpdateRequest | requested field for an order +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Update Order + result = api_instance.update_order(id, order_update_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->update_order: #{e}" +end +``` + +#### Using the update_order_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_order_with_http_info(id, order_update_request, opts) + +```ruby +begin + # Update Order + data, status_code, headers = api_instance.update_order_with_http_info(id, order_update_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling OrdersApi->update_order_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **order_update_request** | [**OrderUpdateRequest**](OrderUpdateRequest.md) | requested field for an order | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**OrderResponse**](OrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/OrdersResponse.md b/docs/OrdersResponse.md new file mode 100644 index 0000000..432895b --- /dev/null +++ b/docs/OrdersResponse.md @@ -0,0 +1,18 @@ +# Conekta::OrdersResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<OrderResponse>**](OrderResponse.md) | | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::OrdersResponse.new( + data: null +) +``` + diff --git a/docs/Page.md b/docs/Page.md new file mode 100644 index 0000000..e63485d --- /dev/null +++ b/docs/Page.md @@ -0,0 +1,20 @@ +# Conekta::Page + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::Page.new( + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1 +) +``` + diff --git a/docs/Pagination.md b/docs/Pagination.md new file mode 100644 index 0000000..94b6f87 --- /dev/null +++ b/docs/Pagination.md @@ -0,0 +1,20 @@ +# Conekta::Pagination + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::Pagination.new( + has_more: false, + object: list +) +``` + diff --git a/docs/PaymentLinkApi.md b/docs/PaymentLinkApi.md new file mode 100644 index 0000000..3e0ceeb --- /dev/null +++ b/docs/PaymentLinkApi.md @@ -0,0 +1,463 @@ +# Conekta::PaymentLinkApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**cancel_checkout**](PaymentLinkApi.md#cancel_checkout) | **PUT** /checkouts/{id}/cancel | Cancel Payment Link | +| [**create_checkout**](PaymentLinkApi.md#create_checkout) | **POST** /checkouts | Create Unique Payment Link | +| [**email_checkout**](PaymentLinkApi.md#email_checkout) | **POST** /checkouts/{id}/email | Send an email | +| [**get_checkout**](PaymentLinkApi.md#get_checkout) | **GET** /checkouts/{id} | Get a payment link by ID | +| [**get_checkouts**](PaymentLinkApi.md#get_checkouts) | **GET** /checkouts | Get a list of payment links | +| [**sms_checkout**](PaymentLinkApi.md#sms_checkout) | **POST** /checkouts/{id}/sms | Send an sms | + + +## cancel_checkout + +> cancel_checkout(id, opts) + +Cancel Payment Link + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentLinkApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Cancel Payment Link + result = api_instance.cancel_checkout(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->cancel_checkout: #{e}" +end +``` + +#### Using the cancel_checkout_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> cancel_checkout_with_http_info(id, opts) + +```ruby +begin + # Cancel Payment Link + data, status_code, headers = api_instance.cancel_checkout_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->cancel_checkout_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CheckoutResponse**](CheckoutResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## create_checkout + +> create_checkout(checkout, opts) + +Create Unique Payment Link + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentLinkApi.new +checkout = Conekta::Checkout.new({allowed_payment_methods: [cash, card, bank_transfer], expires_at: 1680397724, name: 'Payment Link Name 1594138857', order_template: Conekta::CheckoutOrderTemplate.new({currency: 'MXN', line_items: [Conekta::Product.new({name: 'Box of Cohiba S1s', quantity: 1, unit_price: 20000})]}), recurrent: false, type: 'PaymentLink'}) # Checkout | requested field for checkout +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Unique Payment Link + result = api_instance.create_checkout(checkout, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->create_checkout: #{e}" +end +``` + +#### Using the create_checkout_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_checkout_with_http_info(checkout, opts) + +```ruby +begin + # Create Unique Payment Link + data, status_code, headers = api_instance.create_checkout_with_http_info(checkout, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->create_checkout_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **checkout** | [**Checkout**](Checkout.md) | requested field for checkout | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CheckoutResponse**](CheckoutResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## email_checkout + +> email_checkout(id, email_checkout_request, opts) + +Send an email + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentLinkApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +email_checkout_request = Conekta::EmailCheckoutRequest.new({email: 'example@conekta.com'}) # EmailCheckoutRequest | requested field for sms checkout +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Send an email + result = api_instance.email_checkout(id, email_checkout_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->email_checkout: #{e}" +end +``` + +#### Using the email_checkout_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> email_checkout_with_http_info(id, email_checkout_request, opts) + +```ruby +begin + # Send an email + data, status_code, headers = api_instance.email_checkout_with_http_info(id, email_checkout_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->email_checkout_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **email_checkout_request** | [**EmailCheckoutRequest**](EmailCheckoutRequest.md) | requested field for sms checkout | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CheckoutResponse**](CheckoutResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_checkout + +> get_checkout(id, opts) + +Get a payment link by ID + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentLinkApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get a payment link by ID + result = api_instance.get_checkout(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->get_checkout: #{e}" +end +``` + +#### Using the get_checkout_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_checkout_with_http_info(id, opts) + +```ruby +begin + # Get a payment link by ID + data, status_code, headers = api_instance.get_checkout_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->get_checkout_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CheckoutResponse**](CheckoutResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_checkouts + +> get_checkouts(opts) + +Get a list of payment links + +Returns a list of links generated by the merchant + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentLinkApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get a list of payment links + result = api_instance.get_checkouts(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->get_checkouts: #{e}" +end +``` + +#### Using the get_checkouts_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_checkouts_with_http_info(opts) + +```ruby +begin + # Get a list of payment links + data, status_code, headers = api_instance.get_checkouts_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->get_checkouts_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**CheckoutsResponse**](CheckoutsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## sms_checkout + +> sms_checkout(id, sms_checkout_request, opts) + +Send an sms + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentLinkApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +sms_checkout_request = Conekta::SmsCheckoutRequest.new({phonenumber: '5566982090'}) # SmsCheckoutRequest | requested field for sms checkout +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Send an sms + result = api_instance.sms_checkout(id, sms_checkout_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->sms_checkout: #{e}" +end +``` + +#### Using the sms_checkout_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> sms_checkout_with_http_info(id, sms_checkout_request, opts) + +```ruby +begin + # Send an sms + data, status_code, headers = api_instance.sms_checkout_with_http_info(id, sms_checkout_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentLinkApi->sms_checkout_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **sms_checkout_request** | [**SmsCheckoutRequest**](SmsCheckoutRequest.md) | requested field for sms checkout | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CheckoutResponse**](CheckoutResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/PaymentMethod.md b/docs/PaymentMethod.md new file mode 100644 index 0000000..7719a43 --- /dev/null +++ b/docs/PaymentMethod.md @@ -0,0 +1,20 @@ +# Conekta::PaymentMethod + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **object** | **String** | | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethod.new( + type: null, + object: payment_source +) +``` + diff --git a/docs/PaymentMethodBankTransfer.md b/docs/PaymentMethodBankTransfer.md new file mode 100644 index 0000000..47b9e0c --- /dev/null +++ b/docs/PaymentMethodBankTransfer.md @@ -0,0 +1,52 @@ +# Conekta::PaymentMethodBankTransfer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **object** | **String** | | | +| **bank** | **String** | | [optional] | +| **clabe** | **String** | | [optional] | +| **description** | **String** | | [optional] | +| **executed_at** | **Integer** | | [optional] | +| **expires_at** | **Integer** | | [optional] | +| **issuing_account_bank** | **String** | | [optional] | +| **issuing_account_number** | **String** | | [optional] | +| **issuing_account_holder_name** | **String** | | [optional] | +| **issuing_account_tax_id** | **String** | | [optional] | +| **payment_attempts** | **Array<Object>** | | [optional] | +| **receiving_account_holder_name** | **String** | | [optional] | +| **receiving_account_number** | **String** | | [optional] | +| **receiving_account_bank** | **String** | | [optional] | +| **receiving_account_tax_id** | **String** | | [optional] | +| **reference_number** | **String** | | [optional] | +| **tracking_code** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodBankTransfer.new( + type: null, + object: payment_source, + bank: STP, + clabe: 646180111805034237, + description: null, + executed_at: null, + expires_at: 1683053729, + issuing_account_bank: null, + issuing_account_number: null, + issuing_account_holder_name: null, + issuing_account_tax_id: null, + payment_attempts: null, + receiving_account_holder_name: null, + receiving_account_number: 646180111805034237, + receiving_account_bank: STP, + receiving_account_tax_id: null, + reference_number: null, + tracking_code: null +) +``` + diff --git a/docs/PaymentMethodCard.md b/docs/PaymentMethodCard.md new file mode 100644 index 0000000..495057d --- /dev/null +++ b/docs/PaymentMethodCard.md @@ -0,0 +1,42 @@ +# Conekta::PaymentMethodCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **object** | **String** | | | +| **account_type** | **String** | | [optional] | +| **auth_code** | **String** | | [optional] | +| **brand** | **String** | | [optional] | +| **contract_id** | **String** | Id sent for recurrent charges. | [optional] | +| **country** | **String** | | [optional] | +| **exp_month** | **String** | | [optional] | +| **exp_year** | **String** | | [optional] | +| **fraud_indicators** | **Array<Object>** | | [optional] | +| **issuer** | **String** | | [optional] | +| **last4** | **String** | | [optional] | +| **name** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCard.new( + type: null, + object: payment_source, + account_type: Credit, + auth_code: 867372, + brand: visa, + contract_id: S781317595, + country: MX, + exp_month: 02, + exp_year: 30, + fraud_indicators: null, + issuer: BANAMEX, + last4: 4242, + name: Fulanito Perez +) +``` + diff --git a/docs/PaymentMethodCardRequest.md b/docs/PaymentMethodCardRequest.md new file mode 100644 index 0000000..e9e6d60 --- /dev/null +++ b/docs/PaymentMethodCardRequest.md @@ -0,0 +1,20 @@ +# Conekta::PaymentMethodCardRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of payment method | | +| **token_id** | **String** | 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. | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCardRequest.new( + type: card | cash | spei, + token_id: tok_32hj4g234as +) +``` + diff --git a/docs/PaymentMethodCardRequestAllOf.md b/docs/PaymentMethodCardRequestAllOf.md new file mode 100644 index 0000000..636bea8 --- /dev/null +++ b/docs/PaymentMethodCardRequestAllOf.md @@ -0,0 +1,18 @@ +# Conekta::PaymentMethodCardRequestAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **token_id** | **String** | 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. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCardRequestAllOf.new( + token_id: tok_32hj4g234as +) +``` + diff --git a/docs/PaymentMethodCardResponse.md b/docs/PaymentMethodCardResponse.md new file mode 100644 index 0000000..0723a3e --- /dev/null +++ b/docs/PaymentMethodCardResponse.md @@ -0,0 +1,46 @@ +# Conekta::PaymentMethodCardResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | +| **parent_id** | **String** | | [optional] | +| **last4** | **String** | | [optional] | +| **bin** | **String** | | [optional] | +| **card_type** | **String** | | [optional] | +| **exp_month** | **String** | | [optional] | +| **exp_year** | **String** | | [optional] | +| **brand** | **String** | | [optional] | +| **name** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | +| **visible_on_checkout** | **Boolean** | | [optional] | +| **payment_source_status** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCardResponse.new( + type: null, + id: src_2s8K1B3PBKDontpi9, + object: payment_source, + created_at: 1675715413, + parent_id: cus_2s8K1B3PBKDontpi8, + last4: 6410, + bin: 40276657, + card_type: debit, + exp_month: 10, + exp_year: 25, + brand: visa, + name: Fulano Perez", + default: null, + visible_on_checkout: null, + payment_source_status: active +) +``` + diff --git a/docs/PaymentMethodCardResponseAllOf.md b/docs/PaymentMethodCardResponseAllOf.md new file mode 100644 index 0000000..ff72a60 --- /dev/null +++ b/docs/PaymentMethodCardResponseAllOf.md @@ -0,0 +1,36 @@ +# Conekta::PaymentMethodCardResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **last4** | **String** | | [optional] | +| **bin** | **String** | | [optional] | +| **card_type** | **String** | | [optional] | +| **exp_month** | **String** | | [optional] | +| **exp_year** | **String** | | [optional] | +| **brand** | **String** | | [optional] | +| **name** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | +| **visible_on_checkout** | **Boolean** | | [optional] | +| **payment_source_status** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCardResponseAllOf.new( + last4: 6410, + bin: 40276657, + card_type: debit, + exp_month: 10, + exp_year: 25, + brand: visa, + name: Fulano Perez", + default: null, + visible_on_checkout: null, + payment_source_status: active +) +``` + diff --git a/docs/PaymentMethodCash.md b/docs/PaymentMethodCash.md new file mode 100644 index 0000000..09bf74b --- /dev/null +++ b/docs/PaymentMethodCash.md @@ -0,0 +1,36 @@ +# Conekta::PaymentMethodCash + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **object** | **String** | | | +| **auth_code** | **Integer** | | [optional] | +| **cashier_id** | **String** | | [optional] | +| **reference** | **String** | | [optional] | +| **barcode_url** | **String** | | [optional] | +| **expires_at** | **Integer** | | [optional] | +| **service_name** | **String** | | [optional] | +| **store** | **String** | | [optional] | +| **store_name** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCash.new( + type: null, + object: payment_source, + auth_code: 542563, + cashier_id: OINM01010, + reference: 93000262276908, + barcode_url: https://pt-common-s3-stg.s3.amazonaws.com/644ebf80f2243197aad6cd8810375b905b613dbe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MP4SLLCWV%2F20230203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230203T215750Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH4aCXVzLWVhc3QtMSJGMEQCICd79cu7DYu%2F4%2B3HnVVswydgU9yHcE9kmQIIk2TLoZJrAiBVZ0HxVSeboK5lhdQSqADjwQF62XX35jhC%2F2riB0M8uCqQBAj2%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDc5OTgwMTA4MTY4OCIMXWZds9ZI5hzUdbeGKuQDFreMyeWnWWPqDuGZ2%2BHk6usCr%2Fl096%2FNJh9xtf8htLu56K%2FhWUTx%2BjiqFWM2O%2FF5zTS%2BIV6TqkLDZ%2BQ5Jo1miQrRmR57YDz6uP2Yd1mNZ1ouq5ipnNjUuu5UWCCBAmqyZQsrVmeMQpSV2IB%2BTERCCcW2SukFEYU%2F20%2Fzy5orsoZ8DxOW460IymR3cWBk5u3Xh2cV6Y1RdPEwDEThhqYEF5w%2ByKbLENloMsI%2FUm6sG5PPrO3yQOAP9aK2muLJs9lXQRU%2FL%2FSsmS4FKSUFOqlN6YU%2Bi2Y%2FyGIKAJT2VDkngvz5Sl%2Fadj0j%2BPKftVRV5FcEhySB6Rl%2BSkPN7kVQMJp6pS8hMJ6JCyEA%2BA3eWYdIfKgQhWVXAR4oCBfJ62DH8FU3a7WfSjjpTwfVkiReWen3GGCYfUWETTVKp46MKnJ9PG0CD3KzxKV8VfmEGc5krK%2FI%2F%2BDV2wtSa%2F9qf1%2BK1YYJIK9qZGb25ljUiGhTB4T%2BMUOSQFjetiWUoOJc5Q3Jz%2FXJbiTAMTST39MhdbCgiMgfrc8OGKN5DOVbex33Z7dn0xf%2FOCkSqurhLaG08efKQBdhLNS0RlE9hbg9yZ2ywwtQIF39fI6A7eeH0T11a5HMlvm51u4rAffPHRuEJfwJoIuj%2F2s3QzDg7%2FWeBjqmAbnPOlGfysjrDdvHyG7HVnaX02kdG%2BI3Q4PFOO4Mjaa3ocpjcfPT70%2BZ5a%2FSv5vP0jDLGrLToeM9%2BAUlNepptICRu23a1tLGW4ri0twPA%2FZ4JDTtUUUgdblyG8bKpcUTNp4oOsdmLLBz3FVyr4c2xQbDZSu2zYOtoOxB18W0AC6kIbsMWVU55Bf0mBhPeBWxGrtM4Kw1SgHHlt%2F8vetQi2OwtUcg08c%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=d06dfa41550003359f2aabc8006063a80dfd806a13a54d244024946a76aa9abc, + expires_at: 0, + service_name: OxxoPay, + store: 10MON50EDI, + store_name: OXXO +) +``` + diff --git a/docs/PaymentMethodCashRequest.md b/docs/PaymentMethodCashRequest.md new file mode 100644 index 0000000..cc648c1 --- /dev/null +++ b/docs/PaymentMethodCashRequest.md @@ -0,0 +1,20 @@ +# Conekta::PaymentMethodCashRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of payment method | | +| **expires_at** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCashRequest.new( + type: card | cash | spei, + expires_at: 1553273553 +) +``` + diff --git a/docs/PaymentMethodCashRequestAllOf.md b/docs/PaymentMethodCashRequestAllOf.md new file mode 100644 index 0000000..07bcc4c --- /dev/null +++ b/docs/PaymentMethodCashRequestAllOf.md @@ -0,0 +1,18 @@ +# Conekta::PaymentMethodCashRequestAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **expires_at** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCashRequestAllOf.new( + expires_at: 1553273553 +) +``` + diff --git a/docs/PaymentMethodCashResponse.md b/docs/PaymentMethodCashResponse.md new file mode 100644 index 0000000..ed41eb5 --- /dev/null +++ b/docs/PaymentMethodCashResponse.md @@ -0,0 +1,36 @@ +# Conekta::PaymentMethodCashResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | +| **parent_id** | **String** | | [optional] | +| **reference** | **String** | | [optional] | +| **barcode** | **String** | | [optional] | +| **barcode_url** | **String** | | [optional] | +| **expires_at** | **Integer** | | [optional] | +| **provider** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCashResponse.new( + type: null, + id: src_2s8K1B3PBKDontpi9, + object: payment_source, + created_at: 1675715413, + parent_id: cus_2s8K1B3PBKDontpi8, + reference: 93000262276908, + barcode: 93000262276908, + barcode_url: https://pt-common-s3-stg.s3.amazonaws.com/644ebf80f2243197aad6cd8810375b905b613dbe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MP4SLLCWV%2F20230203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230203T215750Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH4aCXVzLWVhc3QtMSJGMEQCICd79cu7DYu%2F4%2B3HnVVswydgU9yHcE9kmQIIk2TLoZJrAiBVZ0HxVSeboK5lhdQSqADjwQF62XX35jhC%2F2riB0M8uCqQBAj2%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDc5OTgwMTA4MTY4OCIMXWZds9ZI5hzUdbeGKuQDFreMyeWnWWPqDuGZ2%2BHk6usCr%2Fl096%2FNJh9xtf8htLu56K%2FhWUTx%2BjiqFWM2O%2FF5zTS%2BIV6TqkLDZ%2BQ5Jo1miQrRmR57YDz6uP2Yd1mNZ1ouq5ipnNjUuu5UWCCBAmqyZQsrVmeMQpSV2IB%2BTERCCcW2SukFEYU%2F20%2Fzy5orsoZ8DxOW460IymR3cWBk5u3Xh2cV6Y1RdPEwDEThhqYEF5w%2ByKbLENloMsI%2FUm6sG5PPrO3yQOAP9aK2muLJs9lXQRU%2FL%2FSsmS4FKSUFOqlN6YU%2Bi2Y%2FyGIKAJT2VDkngvz5Sl%2Fadj0j%2BPKftVRV5FcEhySB6Rl%2BSkPN7kVQMJp6pS8hMJ6JCyEA%2BA3eWYdIfKgQhWVXAR4oCBfJ62DH8FU3a7WfSjjpTwfVkiReWen3GGCYfUWETTVKp46MKnJ9PG0CD3KzxKV8VfmEGc5krK%2FI%2F%2BDV2wtSa%2F9qf1%2BK1YYJIK9qZGb25ljUiGhTB4T%2BMUOSQFjetiWUoOJc5Q3Jz%2FXJbiTAMTST39MhdbCgiMgfrc8OGKN5DOVbex33Z7dn0xf%2FOCkSqurhLaG08efKQBdhLNS0RlE9hbg9yZ2ywwtQIF39fI6A7eeH0T11a5HMlvm51u4rAffPHRuEJfwJoIuj%2F2s3QzDg7%2FWeBjqmAbnPOlGfysjrDdvHyG7HVnaX02kdG%2BI3Q4PFOO4Mjaa3ocpjcfPT70%2BZ5a%2FSv5vP0jDLGrLToeM9%2BAUlNepptICRu23a1tLGW4ri0twPA%2FZ4JDTtUUUgdblyG8bKpcUTNp4oOsdmLLBz3FVyr4c2xQbDZSu2zYOtoOxB18W0AC6kIbsMWVU55Bf0mBhPeBWxGrtM4Kw1SgHHlt%2F8vetQi2OwtUcg08c%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=d06dfa41550003359f2aabc8006063a80dfd806a13a54d244024946a76aa9abc, + expires_at: 0, + provider: Oxxo +) +``` + diff --git a/docs/PaymentMethodCashResponseAllOf.md b/docs/PaymentMethodCashResponseAllOf.md new file mode 100644 index 0000000..e9377a1 --- /dev/null +++ b/docs/PaymentMethodCashResponseAllOf.md @@ -0,0 +1,26 @@ +# Conekta::PaymentMethodCashResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reference** | **String** | | [optional] | +| **barcode** | **String** | | [optional] | +| **barcode_url** | **String** | | [optional] | +| **expires_at** | **Integer** | | [optional] | +| **provider** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodCashResponseAllOf.new( + reference: 93000262276908, + barcode: 93000262276908, + barcode_url: https://pt-common-s3-stg.s3.amazonaws.com/644ebf80f2243197aad6cd8810375b905b613dbe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MP4SLLCWV%2F20230203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230203T215750Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH4aCXVzLWVhc3QtMSJGMEQCICd79cu7DYu%2F4%2B3HnVVswydgU9yHcE9kmQIIk2TLoZJrAiBVZ0HxVSeboK5lhdQSqADjwQF62XX35jhC%2F2riB0M8uCqQBAj2%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDc5OTgwMTA4MTY4OCIMXWZds9ZI5hzUdbeGKuQDFreMyeWnWWPqDuGZ2%2BHk6usCr%2Fl096%2FNJh9xtf8htLu56K%2FhWUTx%2BjiqFWM2O%2FF5zTS%2BIV6TqkLDZ%2BQ5Jo1miQrRmR57YDz6uP2Yd1mNZ1ouq5ipnNjUuu5UWCCBAmqyZQsrVmeMQpSV2IB%2BTERCCcW2SukFEYU%2F20%2Fzy5orsoZ8DxOW460IymR3cWBk5u3Xh2cV6Y1RdPEwDEThhqYEF5w%2ByKbLENloMsI%2FUm6sG5PPrO3yQOAP9aK2muLJs9lXQRU%2FL%2FSsmS4FKSUFOqlN6YU%2Bi2Y%2FyGIKAJT2VDkngvz5Sl%2Fadj0j%2BPKftVRV5FcEhySB6Rl%2BSkPN7kVQMJp6pS8hMJ6JCyEA%2BA3eWYdIfKgQhWVXAR4oCBfJ62DH8FU3a7WfSjjpTwfVkiReWen3GGCYfUWETTVKp46MKnJ9PG0CD3KzxKV8VfmEGc5krK%2FI%2F%2BDV2wtSa%2F9qf1%2BK1YYJIK9qZGb25ljUiGhTB4T%2BMUOSQFjetiWUoOJc5Q3Jz%2FXJbiTAMTST39MhdbCgiMgfrc8OGKN5DOVbex33Z7dn0xf%2FOCkSqurhLaG08efKQBdhLNS0RlE9hbg9yZ2ywwtQIF39fI6A7eeH0T11a5HMlvm51u4rAffPHRuEJfwJoIuj%2F2s3QzDg7%2FWeBjqmAbnPOlGfysjrDdvHyG7HVnaX02kdG%2BI3Q4PFOO4Mjaa3ocpjcfPT70%2BZ5a%2FSv5vP0jDLGrLToeM9%2BAUlNepptICRu23a1tLGW4ri0twPA%2FZ4JDTtUUUgdblyG8bKpcUTNp4oOsdmLLBz3FVyr4c2xQbDZSu2zYOtoOxB18W0AC6kIbsMWVU55Bf0mBhPeBWxGrtM4Kw1SgHHlt%2F8vetQi2OwtUcg08c%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=d06dfa41550003359f2aabc8006063a80dfd806a13a54d244024946a76aa9abc, + expires_at: 0, + provider: Oxxo +) +``` + diff --git a/docs/PaymentMethodResponse.md b/docs/PaymentMethodResponse.md new file mode 100644 index 0000000..200bee0 --- /dev/null +++ b/docs/PaymentMethodResponse.md @@ -0,0 +1,26 @@ +# Conekta::PaymentMethodResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | +| **parent_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodResponse.new( + type: null, + id: src_2s8K1B3PBKDontpi9, + object: payment_source, + created_at: 1675715413, + parent_id: cus_2s8K1B3PBKDontpi8 +) +``` + diff --git a/docs/PaymentMethodSpeiRecurrent.md b/docs/PaymentMethodSpeiRecurrent.md new file mode 100644 index 0000000..688d5e8 --- /dev/null +++ b/docs/PaymentMethodSpeiRecurrent.md @@ -0,0 +1,30 @@ +# Conekta::PaymentMethodSpeiRecurrent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | +| **parent_id** | **String** | | [optional] | +| **reference** | **String** | | [optional] | +| **expires_at** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodSpeiRecurrent.new( + type: null, + id: src_2s8K1B3PBKDontpi9, + object: payment_source, + created_at: 1675715413, + parent_id: cus_2s8K1B3PBKDontpi8, + reference: 93000262276908, + expires_at: none +) +``` + diff --git a/docs/PaymentMethodSpeiRecurrentAllOf.md b/docs/PaymentMethodSpeiRecurrentAllOf.md new file mode 100644 index 0000000..677c5c6 --- /dev/null +++ b/docs/PaymentMethodSpeiRecurrentAllOf.md @@ -0,0 +1,20 @@ +# Conekta::PaymentMethodSpeiRecurrentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reference** | **String** | | [optional] | +| **expires_at** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodSpeiRecurrentAllOf.new( + reference: 93000262276908, + expires_at: none +) +``` + diff --git a/docs/PaymentMethodSpeiRequest.md b/docs/PaymentMethodSpeiRequest.md new file mode 100644 index 0000000..e77a745 --- /dev/null +++ b/docs/PaymentMethodSpeiRequest.md @@ -0,0 +1,20 @@ +# Conekta::PaymentMethodSpeiRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of payment method | | +| **expires_at** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PaymentMethodSpeiRequest.new( + type: card | cash | spei, + expires_at: 1553273553 +) +``` + diff --git a/docs/PaymentMethodsApi.md b/docs/PaymentMethodsApi.md new file mode 100644 index 0000000..0041b28 --- /dev/null +++ b/docs/PaymentMethodsApi.md @@ -0,0 +1,327 @@ +# Conekta::PaymentMethodsApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_customer_payment_methods**](PaymentMethodsApi.md#create_customer_payment_methods) | **POST** /customers/{id}/payment_sources | Create Payment Method | +| [**delete_customer_payment_methods**](PaymentMethodsApi.md#delete_customer_payment_methods) | **DELETE** /customers/{id}/payment_sources/{payment_method_id} | Delete Payment Method | +| [**get_customer_payment_methods**](PaymentMethodsApi.md#get_customer_payment_methods) | **GET** /customers/{id}/payment_sources | Get Payment Methods | +| [**update_customer_payment_methods**](PaymentMethodsApi.md#update_customer_payment_methods) | **PUT** /customers/{id}/payment_sources/{payment_method_id} | Update Payment Method | + + +## create_customer_payment_methods + +> create_customer_payment_methods(id, create_customer_payment_methods_request, opts) + +Create Payment Method + +Create a payment method for a customer. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentMethodsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +create_customer_payment_methods_request = Conekta::PaymentMethodCardRequest.new({type: 'card | cash | spei', token_id: 'tok_32hj4g234as'}) # CreateCustomerPaymentMethodsRequest | requested field for customer payment methods +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Payment Method + result = api_instance.create_customer_payment_methods(id, create_customer_payment_methods_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentMethodsApi->create_customer_payment_methods: #{e}" +end +``` + +#### Using the create_customer_payment_methods_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_customer_payment_methods_with_http_info(id, create_customer_payment_methods_request, opts) + +```ruby +begin + # Create Payment Method + data, status_code, headers = api_instance.create_customer_payment_methods_with_http_info(id, create_customer_payment_methods_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentMethodsApi->create_customer_payment_methods_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **create_customer_payment_methods_request** | [**CreateCustomerPaymentMethodsRequest**](CreateCustomerPaymentMethodsRequest.md) | requested field for customer payment methods | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CreateCustomerPaymentMethodsResponse**](CreateCustomerPaymentMethodsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## delete_customer_payment_methods + +> delete_customer_payment_methods(id, payment_method_id, opts) + +Delete Payment Method + +Delete an existing payment method + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentMethodsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +payment_method_id = 'src_2tQ974hSHcsdeSZHG' # String | Identifier of the payment method +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Delete Payment Method + result = api_instance.delete_customer_payment_methods(id, payment_method_id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentMethodsApi->delete_customer_payment_methods: #{e}" +end +``` + +#### Using the delete_customer_payment_methods_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_customer_payment_methods_with_http_info(id, payment_method_id, opts) + +```ruby +begin + # Delete Payment Method + data, status_code, headers = api_instance.delete_customer_payment_methods_with_http_info(id, payment_method_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentMethodsApi->delete_customer_payment_methods_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **payment_method_id** | **String** | Identifier of the payment method | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**UpdateCustomerPaymentMethodsResponse**](UpdateCustomerPaymentMethodsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_customer_payment_methods + +> get_customer_payment_methods(id, opts) + +Get Payment Methods + +Get a list of Payment Methods + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentMethodsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + _next: '_next_example', # String | next page + previous: 'previous_example', # String | previous page + search: 'search_example' # String | General order search, e.g. by mail, reference etc. +} + +begin + # Get Payment Methods + result = api_instance.get_customer_payment_methods(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentMethodsApi->get_customer_payment_methods: #{e}" +end +``` + +#### Using the get_customer_payment_methods_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_customer_payment_methods_with_http_info(id, opts) + +```ruby +begin + # Get Payment Methods + data, status_code, headers = api_instance.get_customer_payment_methods_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentMethodsApi->get_customer_payment_methods_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | + +### Return type + +[**GetPaymentMethodResponse**](GetPaymentMethodResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_customer_payment_methods + +> update_customer_payment_methods(id, payment_method_id, update_payment_methods, opts) + +Update Payment Method + +Gets a payment Method that corresponds to a customer ID. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PaymentMethodsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +payment_method_id = 'src_2tQ974hSHcsdeSZHG' # String | Identifier of the payment method +update_payment_methods = Conekta::UpdatePaymentMethods.new # UpdatePaymentMethods | requested field for customer payment methods +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update Payment Method + result = api_instance.update_customer_payment_methods(id, payment_method_id, update_payment_methods, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PaymentMethodsApi->update_customer_payment_methods: #{e}" +end +``` + +#### Using the update_customer_payment_methods_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_customer_payment_methods_with_http_info(id, payment_method_id, update_payment_methods, opts) + +```ruby +begin + # Update Payment Method + data, status_code, headers = api_instance.update_customer_payment_methods_with_http_info(id, payment_method_id, update_payment_methods, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PaymentMethodsApi->update_customer_payment_methods_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **payment_method_id** | **String** | Identifier of the payment method | | +| **update_payment_methods** | [**UpdatePaymentMethods**](UpdatePaymentMethods.md) | requested field for customer payment methods | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**UpdateCustomerPaymentMethodsResponse**](UpdateCustomerPaymentMethodsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/PlanRequest.md b/docs/PlanRequest.md new file mode 100644 index 0000000..bdf96b1 --- /dev/null +++ b/docs/PlanRequest.md @@ -0,0 +1,32 @@ +# Conekta::PlanRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The amount in cents that will be charged on the interval specified. | | +| **currency** | **String** | ISO 4217 for currencies, for the Mexican peso it is MXN/USD | [optional] | +| **expiry_count** | **Integer** | Number of repetitions of the frequency NUMBER OF CHARGES TO BE MADE, considering the interval and frequency, this evolves over time, but is subject to the expiration count. | [optional] | +| **frequency** | **Integer** | Frequency of the charge, which together with the interval, can be every 3 weeks, every 4 months, every 2 years, every 5 fortnights | | +| **id** | **String** | internal reference id | [optional] | +| **interval** | **String** | The interval of time between each charge. | | +| **name** | **String** | The name of the plan. | | +| **trial_period_days** | **Integer** | The number of days the customer will have a free trial. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PlanRequest.new( + amount: 10000, + currency: MXN, + expiry_count: 12, + frequency: 1, + id: plan_24234, + interval: null, + name: Extra Plan3, + trial_period_days: 0 +) +``` + diff --git a/docs/PlanResponse.md b/docs/PlanResponse.md new file mode 100644 index 0000000..6acb012 --- /dev/null +++ b/docs/PlanResponse.md @@ -0,0 +1,38 @@ +# Conekta::PlanResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | | [optional] | +| **created_at** | **Integer** | | [optional] | +| **currency** | **String** | | [optional] | +| **expiry_count** | **Integer** | | [optional] | +| **frequency** | **Integer** | | [optional] | +| **id** | **String** | | [optional] | +| **interval** | **String** | | [optional] | +| **livemode** | **Boolean** | | [optional] | +| **name** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **trial_period_days** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PlanResponse.new( + amount: 10000, + created_at: 1666900846, + currency: MXN, + expiry_count: 12, + frequency: 1, + id: gold-plan, + interval: month, + livemode: true, + name: Extra Plan3, + object: plan, + trial_period_days: 0 +) +``` + diff --git a/docs/PlanUpdateRequest.md b/docs/PlanUpdateRequest.md new file mode 100644 index 0000000..ea58a29 --- /dev/null +++ b/docs/PlanUpdateRequest.md @@ -0,0 +1,24 @@ +# Conekta::PlanUpdateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The amount in cents that will be charged on the interval specified. | [optional] | +| **currency** | **String** | ISO 4217 for currencies, for the Mexican peso it is MXN/USD | [optional] | +| **expiry_count** | **Integer** | Number of repetitions of the frequency NUMBER OF CHARGES TO BE MADE, considering the interval and frequency, this evolves over time, but is subject to the expiration count. | [optional] | +| **name** | **String** | The name of the plan. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::PlanUpdateRequest.new( + amount: 10000, + currency: MXN, + expiry_count: 12, + name: Extra Plan3 +) +``` + diff --git a/docs/PlansApi.md b/docs/PlansApi.md new file mode 100644 index 0000000..8ec1adc --- /dev/null +++ b/docs/PlansApi.md @@ -0,0 +1,385 @@ +# Conekta::PlansApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_plan**](PlansApi.md#create_plan) | **POST** /plans | Create Plan | +| [**delete_plan**](PlansApi.md#delete_plan) | **DELETE** /plans/{id} | Delete Plan | +| [**get_plan**](PlansApi.md#get_plan) | **GET** /plans/{id} | Get Plan | +| [**get_plans**](PlansApi.md#get_plans) | **GET** /plans | Get A List of Plans | +| [**update_plan**](PlansApi.md#update_plan) | **PUT** /plans/{id} | Update Plan | + + +## create_plan + +> create_plan(plan_request, opts) + +Create Plan + +Create a new plan for an existing order + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PlansApi.new +plan_request = Conekta::PlanRequest.new({amount: 10000, frequency: 1, interval: 'week', name: 'Extra Plan3'}) # PlanRequest | requested field for plan +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Plan + result = api_instance.create_plan(plan_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->create_plan: #{e}" +end +``` + +#### Using the create_plan_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_plan_with_http_info(plan_request, opts) + +```ruby +begin + # Create Plan + data, status_code, headers = api_instance.create_plan_with_http_info(plan_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->create_plan_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **plan_request** | [**PlanRequest**](PlanRequest.md) | requested field for plan | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**PlanResponse**](PlanResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## delete_plan + +> delete_plan(id, opts) + +Delete Plan + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PlansApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Delete Plan + result = api_instance.delete_plan(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->delete_plan: #{e}" +end +``` + +#### Using the delete_plan_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_plan_with_http_info(id, opts) + +```ruby +begin + # Delete Plan + data, status_code, headers = api_instance.delete_plan_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->delete_plan_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**PlanResponse**](PlanResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_plan + +> get_plan(id, opts) + +Get Plan + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PlansApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Plan + result = api_instance.get_plan(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->get_plan: #{e}" +end +``` + +#### Using the get_plan_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_plan_with_http_info(id, opts) + +```ruby +begin + # Get Plan + data, status_code, headers = api_instance.get_plan_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->get_plan_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**PlanResponse**](PlanResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_plans + +> get_plans(opts) + +Get A List of Plans + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PlansApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get A List of Plans + result = api_instance.get_plans(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->get_plans: #{e}" +end +``` + +#### Using the get_plans_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_plans_with_http_info(opts) + +```ruby +begin + # Get A List of Plans + data, status_code, headers = api_instance.get_plans_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->get_plans_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetPlansResponse**](GetPlansResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_plan + +> update_plan(id, plan_update_request, opts) + +Update Plan + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PlansApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +plan_update_request = Conekta::PlanUpdateRequest.new # PlanUpdateRequest | requested field for plan +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update Plan + result = api_instance.update_plan(id, plan_update_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->update_plan: #{e}" +end +``` + +#### Using the update_plan_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_plan_with_http_info(id, plan_update_request, opts) + +```ruby +begin + # Update Plan + data, status_code, headers = api_instance.update_plan_with_http_info(id, plan_update_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PlansApi->update_plan_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **plan_update_request** | [**PlanUpdateRequest**](PlanUpdateRequest.md) | requested field for plan | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**PlanResponse**](PlanResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/Product.md b/docs/Product.md new file mode 100644 index 0000000..a38f0ac --- /dev/null +++ b/docs/Product.md @@ -0,0 +1,34 @@ +# Conekta::Product + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **antifraud_info** | **Hash<String, Object>** | | [optional] | +| **brand** | **String** | The brand of the item. | [optional] | +| **description** | **String** | Short description of the item | [optional] | +| **metadata** | **Hash<String, String>** | It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters. | [optional] | +| **name** | **String** | The name of the item. It will be displayed in the order. | | +| **quantity** | **Integer** | The quantity of the item in the order. | | +| **sku** | **String** | The stock keeping unit for the item. It is used to identify the item in the order. | [optional] | +| **tags** | **Array<String>** | List of tags for the item. It is used to identify the item in the order. | [optional] | +| **unit_price** | **Integer** | The price of the item in cents. | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::Product.new( + antifraud_info: {key=value}, + brand: Cohiba, + description: Imported From Mex., + metadata: {key=value}, + name: Box of Cohiba S1s, + quantity: 1, + sku: XYZ12345, + tags: [food, mexican food], + unit_price: 20000 +) +``` + diff --git a/docs/ProductDataResponse.md b/docs/ProductDataResponse.md new file mode 100644 index 0000000..fc7d690 --- /dev/null +++ b/docs/ProductDataResponse.md @@ -0,0 +1,40 @@ +# Conekta::ProductDataResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **antifraud_info** | **Hash<String, Object>** | | [optional] | +| **brand** | **String** | The brand of the item. | [optional] | +| **description** | **String** | Short description of the item | [optional] | +| **metadata** | **Hash<String, String>** | It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters. | [optional] | +| **name** | **String** | The name of the item. It will be displayed in the order. | | +| **quantity** | **Integer** | The quantity of the item in the order. | | +| **sku** | **String** | The stock keeping unit for the item. It is used to identify the item in the order. | [optional] | +| **tags** | **Array<String>** | List of tags for the item. It is used to identify the item in the order. | [optional] | +| **unit_price** | **Integer** | The price of the item in cents. | | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **parent_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ProductDataResponse.new( + antifraud_info: {key=value}, + brand: Cohiba, + description: Imported From Mex., + metadata: {key=value}, + name: Box of Cohiba S1s, + quantity: 1, + sku: XYZ12345, + tags: [food, mexican food], + unit_price: 20000, + id: null, + object: null, + parent_id: null +) +``` + diff --git a/docs/ProductDataResponseAllOf.md b/docs/ProductDataResponseAllOf.md new file mode 100644 index 0000000..e9f7b3f --- /dev/null +++ b/docs/ProductDataResponseAllOf.md @@ -0,0 +1,22 @@ +# Conekta::ProductDataResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **parent_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ProductDataResponseAllOf.new( + id: null, + object: null, + parent_id: null +) +``` + diff --git a/docs/ProductOrderResponse.md b/docs/ProductOrderResponse.md new file mode 100644 index 0000000..b6a8c26 --- /dev/null +++ b/docs/ProductOrderResponse.md @@ -0,0 +1,40 @@ +# Conekta::ProductOrderResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **antifraud_info** | **Hash<String, Object>** | | [optional] | +| **brand** | **String** | The brand of the item. | [optional] | +| **description** | **String** | Short description of the item | [optional] | +| **metadata** | **Hash<String, String>** | It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters. | [optional] | +| **name** | **String** | The name of the item. It will be displayed in the order. | | +| **quantity** | **Integer** | The quantity of the item in the order. | | +| **sku** | **String** | The stock keeping unit for the item. It is used to identify the item in the order. | [optional] | +| **tags** | **Array<String>** | List of tags for the item. It is used to identify the item in the order. | [optional] | +| **unit_price** | **Integer** | The price of the item in cents. | | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **parent_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ProductOrderResponse.new( + antifraud_info: {key=value}, + brand: Cohiba, + description: Imported From Mex., + metadata: {key=value}, + name: Box of Cohiba S1s, + quantity: 1, + sku: XYZ12345, + tags: [food, mexican food], + unit_price: 20000, + id: null, + object: null, + parent_id: null +) +``` + diff --git a/docs/ProductOrderResponseAllOf.md b/docs/ProductOrderResponseAllOf.md new file mode 100644 index 0000000..1c736d0 --- /dev/null +++ b/docs/ProductOrderResponseAllOf.md @@ -0,0 +1,22 @@ +# Conekta::ProductOrderResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **parent_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ProductOrderResponseAllOf.new( + id: null, + object: null, + parent_id: null +) +``` + diff --git a/docs/ProductsApi.md b/docs/ProductsApi.md new file mode 100644 index 0000000..1fd1069 --- /dev/null +++ b/docs/ProductsApi.md @@ -0,0 +1,243 @@ +# Conekta::ProductsApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**orders_create_product**](ProductsApi.md#orders_create_product) | **POST** /orders/{id}/line_items | Create Product | +| [**orders_delete_product**](ProductsApi.md#orders_delete_product) | **DELETE** /orders/{id}/line_items/{line_item_id} | Delete Product | +| [**orders_update_product**](ProductsApi.md#orders_update_product) | **PUT** /orders/{id}/line_items/{line_item_id} | Update Product | + + +## orders_create_product + +> orders_create_product(id, product, opts) + +Create Product + +Create a new product for an existing order. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ProductsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +product = Conekta::Product.new({name: 'Box of Cohiba S1s', quantity: 1, unit_price: 20000}) # Product | requested field for a product +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Product + result = api_instance.orders_create_product(id, product, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ProductsApi->orders_create_product: #{e}" +end +``` + +#### Using the orders_create_product_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_create_product_with_http_info(id, product, opts) + +```ruby +begin + # Create Product + data, status_code, headers = api_instance.orders_create_product_with_http_info(id, product, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ProductsApi->orders_create_product_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **product** | [**Product**](Product.md) | requested field for a product | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ProductOrderResponse**](ProductOrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_delete_product + +> orders_delete_product(id, line_item_id, opts) + +Delete Product + +Delete product for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ProductsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +line_item_id = 'line_item_2tQ8HkkfbauaKP9Ho' # String | identifier +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Delete Product + result = api_instance.orders_delete_product(id, line_item_id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ProductsApi->orders_delete_product: #{e}" +end +``` + +#### Using the orders_delete_product_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_delete_product_with_http_info(id, line_item_id, opts) + +```ruby +begin + # Delete Product + data, status_code, headers = api_instance.orders_delete_product_with_http_info(id, line_item_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ProductsApi->orders_delete_product_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **line_item_id** | **String** | identifier | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ProductOrderResponse**](ProductOrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_update_product + +> orders_update_product(id, line_item_id, update_product, opts) + +Update Product + +Update an existing product for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ProductsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +line_item_id = 'line_item_2tQ8HkkfbauaKP9Ho' # String | identifier +update_product = Conekta::UpdateProduct.new # UpdateProduct | requested field for products +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update Product + result = api_instance.orders_update_product(id, line_item_id, update_product, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ProductsApi->orders_update_product: #{e}" +end +``` + +#### Using the orders_update_product_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_update_product_with_http_info(id, line_item_id, update_product, opts) + +```ruby +begin + # Update Product + data, status_code, headers = api_instance.orders_update_product_with_http_info(id, line_item_id, update_product, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ProductsApi->orders_update_product_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **line_item_id** | **String** | identifier | | +| **update_product** | [**UpdateProduct**](UpdateProduct.md) | requested field for products | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ProductOrderResponse**](ProductOrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/RiskRules.md b/docs/RiskRules.md new file mode 100644 index 0000000..f30918a --- /dev/null +++ b/docs/RiskRules.md @@ -0,0 +1,18 @@ +# Conekta::RiskRules + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<RiskRulesData>**](RiskRulesData.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::RiskRules.new( + data: null +) +``` + diff --git a/docs/RiskRulesData.md b/docs/RiskRulesData.md new file mode 100644 index 0000000..5bf6363 --- /dev/null +++ b/docs/RiskRulesData.md @@ -0,0 +1,30 @@ +# Conekta::RiskRulesData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | rule id | [optional] | +| **field** | **String** | field to be used for the rule | [optional] | +| **created_at** | **String** | rule creation date | [optional] | +| **value** | **String** | value to be used for the rule | [optional] | +| **is_global** | **Boolean** | if the rule is global | [optional] | +| **is_test** | **Boolean** | if the rule is test | [optional] | +| **description** | **String** | description of the rule | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::RiskRulesData.new( + id: 618c3f2fdb8b8da9be376af9, + field: email, + created_at: 2021-11-10T21:52:47.339Z, + value: email@example.com, + is_global: false, + is_test: false, + description: secure customer example@example.com +) +``` + diff --git a/docs/RiskRulesList.md b/docs/RiskRulesList.md new file mode 100644 index 0000000..61f5d98 --- /dev/null +++ b/docs/RiskRulesList.md @@ -0,0 +1,26 @@ +# Conekta::RiskRulesList + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<RiskRulesData>**](RiskRulesData.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::RiskRulesList.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/ShippingContactsApi.md b/docs/ShippingContactsApi.md new file mode 100644 index 0000000..11a480e --- /dev/null +++ b/docs/ShippingContactsApi.md @@ -0,0 +1,243 @@ +# Conekta::ShippingContactsApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_customer_shipping_contacts**](ShippingContactsApi.md#create_customer_shipping_contacts) | **POST** /customers/{id}/shipping_contacts | Create a shipping contacts | +| [**delete_customer_shipping_contacts**](ShippingContactsApi.md#delete_customer_shipping_contacts) | **DELETE** /customers/{id}/shipping_contacts/{shipping_contacts_id} | Delete shipping contacts | +| [**update_customer_shipping_contacts**](ShippingContactsApi.md#update_customer_shipping_contacts) | **PUT** /customers/{id}/shipping_contacts/{shipping_contacts_id} | Update shipping contacts | + + +## create_customer_shipping_contacts + +> create_customer_shipping_contacts(id, customer_shipping_contacts, opts) + +Create a shipping contacts + +Create a shipping contacts for a customer. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ShippingContactsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +customer_shipping_contacts = Conekta::CustomerShippingContacts.new({address: Conekta::CustomerShippingContactsAddress.new}) # CustomerShippingContacts | requested field for customer shippings contacts +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create a shipping contacts + result = api_instance.create_customer_shipping_contacts(id, customer_shipping_contacts, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ShippingContactsApi->create_customer_shipping_contacts: #{e}" +end +``` + +#### Using the create_customer_shipping_contacts_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_customer_shipping_contacts_with_http_info(id, customer_shipping_contacts, opts) + +```ruby +begin + # Create a shipping contacts + data, status_code, headers = api_instance.create_customer_shipping_contacts_with_http_info(id, customer_shipping_contacts, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ShippingContactsApi->create_customer_shipping_contacts_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **customer_shipping_contacts** | [**CustomerShippingContacts**](CustomerShippingContacts.md) | requested field for customer shippings contacts | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CustomerShippingContactsResponse**](CustomerShippingContactsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## delete_customer_shipping_contacts + +> delete_customer_shipping_contacts(id, shipping_contacts_id, opts) + +Delete shipping contacts + +Delete shipping contact that corresponds to a customer ID. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ShippingContactsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +shipping_contacts_id = '6307a60c41de27127515a575' # String | identifier +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Delete shipping contacts + result = api_instance.delete_customer_shipping_contacts(id, shipping_contacts_id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ShippingContactsApi->delete_customer_shipping_contacts: #{e}" +end +``` + +#### Using the delete_customer_shipping_contacts_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, opts) + +```ruby +begin + # Delete shipping contacts + data, status_code, headers = api_instance.delete_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ShippingContactsApi->delete_customer_shipping_contacts_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **shipping_contacts_id** | **String** | identifier | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CustomerShippingContactsResponse**](CustomerShippingContactsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_customer_shipping_contacts + +> update_customer_shipping_contacts(id, shipping_contacts_id, customer_update_shipping_contacts, opts) + +Update shipping contacts + +Update shipping contact that corresponds to a customer ID. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ShippingContactsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +shipping_contacts_id = '6307a60c41de27127515a575' # String | identifier +customer_update_shipping_contacts = Conekta::CustomerUpdateShippingContacts.new # CustomerUpdateShippingContacts | requested field for customer update shippings contacts +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update shipping contacts + result = api_instance.update_customer_shipping_contacts(id, shipping_contacts_id, customer_update_shipping_contacts, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ShippingContactsApi->update_customer_shipping_contacts: #{e}" +end +``` + +#### Using the update_customer_shipping_contacts_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, customer_update_shipping_contacts, opts) + +```ruby +begin + # Update shipping contacts + data, status_code, headers = api_instance.update_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, customer_update_shipping_contacts, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ShippingContactsApi->update_customer_shipping_contacts_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **shipping_contacts_id** | **String** | identifier | | +| **customer_update_shipping_contacts** | [**CustomerUpdateShippingContacts**](CustomerUpdateShippingContacts.md) | requested field for customer update shippings contacts | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**CustomerShippingContactsResponse**](CustomerShippingContactsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/ShippingOrderResponse.md b/docs/ShippingOrderResponse.md new file mode 100644 index 0000000..e0d21b8 --- /dev/null +++ b/docs/ShippingOrderResponse.md @@ -0,0 +1,32 @@ +# Conekta::ShippingOrderResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Shipping amount in cents | | +| **carrier** | **String** | Carrier name for the shipment | [optional] | +| **tracking_number** | **String** | Tracking number can be used to track the shipment | [optional] | +| **method** | **String** | Method of shipment | [optional] | +| **metadata** | **Hash<String, Object>** | Hash where the user can send additional information for each 'shipping'. | [optional] | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **parent_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ShippingOrderResponse.new( + amount: 100, + carrier: FEDEX, + tracking_number: TRACK123, + method: Same day, + metadata: {key=value}, + id: null, + object: null, + parent_id: null +) +``` + diff --git a/docs/ShippingRequest.md b/docs/ShippingRequest.md new file mode 100644 index 0000000..d06f5f8 --- /dev/null +++ b/docs/ShippingRequest.md @@ -0,0 +1,26 @@ +# Conekta::ShippingRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Shipping amount in cents | | +| **carrier** | **String** | Carrier name for the shipment | [optional] | +| **tracking_number** | **String** | Tracking number can be used to track the shipment | [optional] | +| **method** | **String** | Method of shipment | [optional] | +| **metadata** | **Hash<String, Object>** | Hash where the user can send additional information for each 'shipping'. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ShippingRequest.new( + amount: 100, + carrier: FEDEX, + tracking_number: TRACK123, + method: Same day, + metadata: {key=value} +) +``` + diff --git a/docs/ShippingsApi.md b/docs/ShippingsApi.md new file mode 100644 index 0000000..a96eff6 --- /dev/null +++ b/docs/ShippingsApi.md @@ -0,0 +1,243 @@ +# Conekta::ShippingsApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**orders_create_shipping**](ShippingsApi.md#orders_create_shipping) | **POST** /orders/{id}/shipping_lines | Create Shipping | +| [**orders_delete_shipping**](ShippingsApi.md#orders_delete_shipping) | **DELETE** /orders/{id}/shipping_lines/{shipping_id} | Delete Shipping | +| [**orders_update_shipping**](ShippingsApi.md#orders_update_shipping) | **PUT** /orders/{id}/shipping_lines/{shipping_id} | Update Shipping | + + +## orders_create_shipping + +> orders_create_shipping(id, shipping_request, opts) + +Create Shipping + +Create new shipping for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ShippingsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +shipping_request = Conekta::ShippingRequest.new({amount: 100}) # ShippingRequest | requested field for a shipping +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Shipping + result = api_instance.orders_create_shipping(id, shipping_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ShippingsApi->orders_create_shipping: #{e}" +end +``` + +#### Using the orders_create_shipping_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_create_shipping_with_http_info(id, shipping_request, opts) + +```ruby +begin + # Create Shipping + data, status_code, headers = api_instance.orders_create_shipping_with_http_info(id, shipping_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ShippingsApi->orders_create_shipping_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **shipping_request** | [**ShippingRequest**](ShippingRequest.md) | requested field for a shipping | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ShippingOrderResponse**](ShippingOrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_delete_shipping + +> orders_delete_shipping(id, shipping_id, opts) + +Delete Shipping + +Delete shipping + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ShippingsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +shipping_id = 'ship_lin_2tQ974hSHcsdeSZHG' # String | identifier +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Delete Shipping + result = api_instance.orders_delete_shipping(id, shipping_id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ShippingsApi->orders_delete_shipping: #{e}" +end +``` + +#### Using the orders_delete_shipping_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_delete_shipping_with_http_info(id, shipping_id, opts) + +```ruby +begin + # Delete Shipping + data, status_code, headers = api_instance.orders_delete_shipping_with_http_info(id, shipping_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ShippingsApi->orders_delete_shipping_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **shipping_id** | **String** | identifier | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ShippingOrderResponse**](ShippingOrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_update_shipping + +> orders_update_shipping(id, shipping_id, shipping_request, opts) + +Update Shipping + +Update existing shipping for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ShippingsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +shipping_id = 'ship_lin_2tQ974hSHcsdeSZHG' # String | identifier +shipping_request = Conekta::ShippingRequest.new({amount: 100}) # ShippingRequest | requested field for a shipping +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update Shipping + result = api_instance.orders_update_shipping(id, shipping_id, shipping_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ShippingsApi->orders_update_shipping: #{e}" +end +``` + +#### Using the orders_update_shipping_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_update_shipping_with_http_info(id, shipping_id, shipping_request, opts) + +```ruby +begin + # Update Shipping + data, status_code, headers = api_instance.orders_update_shipping_with_http_info(id, shipping_id, shipping_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ShippingsApi->orders_update_shipping_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **shipping_id** | **String** | identifier | | +| **shipping_request** | [**ShippingRequest**](ShippingRequest.md) | requested field for a shipping | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ShippingOrderResponse**](ShippingOrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/SmsCheckoutRequest.md b/docs/SmsCheckoutRequest.md new file mode 100644 index 0000000..99586c7 --- /dev/null +++ b/docs/SmsCheckoutRequest.md @@ -0,0 +1,18 @@ +# Conekta::SmsCheckoutRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phonenumber** | **String** | | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::SmsCheckoutRequest.new( + phonenumber: 5566982090 +) +``` + diff --git a/docs/SubscriptionEventsResponse.md b/docs/SubscriptionEventsResponse.md new file mode 100644 index 0000000..d306490 --- /dev/null +++ b/docs/SubscriptionEventsResponse.md @@ -0,0 +1,26 @@ +# Conekta::SubscriptionEventsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **next_page_url** | **String** | URL of the next page. | [optional] | +| **previous_page_url** | **String** | Url of the previous page. | [optional] | +| **data** | [**Array<EventResponse>**](EventResponse.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::SubscriptionEventsResponse.new( + has_more: false, + object: list, + next_page_url: https://api.conekta.io/resources?limit=10&next=chrg_1, + previous_page_url: https://api.conekta.io/resources?limit=10&previous=chrg_1, + data: null +) +``` + diff --git a/docs/SubscriptionRequest.md b/docs/SubscriptionRequest.md new file mode 100644 index 0000000..9a29ccd --- /dev/null +++ b/docs/SubscriptionRequest.md @@ -0,0 +1,22 @@ +# Conekta::SubscriptionRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **plan_id** | **String** | | | +| **card_id** | **String** | | [optional] | +| **trial_end** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::SubscriptionRequest.new( + plan_id: f84gdgf5g48r15fd21g8w424fd1, + card_id: src_2qUCNd5AyQqfPMBuV, + trial_end: 1484040996 +) +``` + diff --git a/docs/SubscriptionResponse.md b/docs/SubscriptionResponse.md new file mode 100644 index 0000000..2efed2c --- /dev/null +++ b/docs/SubscriptionResponse.md @@ -0,0 +1,50 @@ +# Conekta::SubscriptionResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **billing_cycle_start** | **Integer** | | [optional] | +| **billing_cycle_end** | **Integer** | | [optional] | +| **canceled_at** | **Integer** | | [optional] | +| **card_id** | **String** | | [optional] | +| **charge_id** | **String** | | [optional] | +| **created_at** | **Integer** | | [optional] | +| **customer_custom_reference** | **String** | | [optional] | +| **customer_id** | **String** | | [optional] | +| **id** | **String** | | [optional] | +| **last_billing_cycle_order_id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **paused_at** | **Integer** | | [optional] | +| **plan_id** | **String** | | [optional] | +| **status** | **String** | | [optional] | +| **subscription_start** | **Integer** | | [optional] | +| **trial_start** | **Integer** | | [optional] | +| **trial_end** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::SubscriptionResponse.new( + billing_cycle_start: 1677626827, + billing_cycle_end: 1677626827, + canceled_at: 1678258162, + card_id: src_2tKcHxhTz7xU5SymL, + charge_id: 2tKcHxhTz7xU5SymL, + created_at: 1677626837, + customer_custom_reference: dotnet_123456, + customer_id: cus_2tKcHxhTz7xU5SymF, + id: gold-plan, + last_billing_cycle_order_id: ord_2tSoMP7bZJbLiq4z8, + object: subscription, + paused_at: 1678258162, + plan_id: plan_2tXx672QLQ68CkmMn, + status: past_due, + subscription_start: 1677626837, + trial_start: 1677626837, + trial_end: 1677626837 +) +``` + diff --git a/docs/SubscriptionUpdateRequest.md b/docs/SubscriptionUpdateRequest.md new file mode 100644 index 0000000..c3da8c0 --- /dev/null +++ b/docs/SubscriptionUpdateRequest.md @@ -0,0 +1,22 @@ +# Conekta::SubscriptionUpdateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **plan_id** | **String** | | [optional] | +| **card_id** | **String** | | [optional] | +| **trial_end** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::SubscriptionUpdateRequest.new( + plan_id: f84gdgf5g48r15fd21g8w424fd1, + card_id: src_2qUCNd5AyQqfPMBuV, + trial_end: 1484040996 +) +``` + diff --git a/docs/SubscriptionsApi.md b/docs/SubscriptionsApi.md new file mode 100644 index 0000000..cd73cf9 --- /dev/null +++ b/docs/SubscriptionsApi.md @@ -0,0 +1,539 @@ +# Conekta::SubscriptionsApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**cancel_subscription**](SubscriptionsApi.md#cancel_subscription) | **POST** /customers/{id}/subscription/cancel | Cancel Subscription | +| [**create_subscription**](SubscriptionsApi.md#create_subscription) | **POST** /customers/{id}/subscription | Create Subscription | +| [**get_all_events_from_subscription**](SubscriptionsApi.md#get_all_events_from_subscription) | **GET** /customers/{id}/subscription/events | Get Events By Subscription | +| [**get_subscription**](SubscriptionsApi.md#get_subscription) | **GET** /customers/{id}/subscription | Get Subscription | +| [**pause_subscription**](SubscriptionsApi.md#pause_subscription) | **POST** /customers/{id}/subscription/pause | Pause Subscription | +| [**resume_subscription**](SubscriptionsApi.md#resume_subscription) | **POST** /customers/{id}/subscription/resume | Resume Subscription | +| [**update_subscription**](SubscriptionsApi.md#update_subscription) | **PUT** /customers/{id}/subscription | Update Subscription | + + +## cancel_subscription + +> cancel_subscription(id, opts) + +Cancel Subscription + +You can cancel the subscription to stop the plans that your customers consume + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::SubscriptionsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Cancel Subscription + result = api_instance.cancel_subscription(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->cancel_subscription: #{e}" +end +``` + +#### Using the cancel_subscription_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> cancel_subscription_with_http_info(id, opts) + +```ruby +begin + # Cancel Subscription + data, status_code, headers = api_instance.cancel_subscription_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->cancel_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**SubscriptionResponse**](SubscriptionResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## create_subscription + +> create_subscription(id, subscription_request, opts) + +Create Subscription + +You can create the subscription to include the plans that your customers consume + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::SubscriptionsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +subscription_request = Conekta::SubscriptionRequest.new({plan_id: 'f84gdgf5g48r15fd21g8w424fd1'}) # SubscriptionRequest | requested field for subscriptions +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Subscription + result = api_instance.create_subscription(id, subscription_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->create_subscription: #{e}" +end +``` + +#### Using the create_subscription_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_subscription_with_http_info(id, subscription_request, opts) + +```ruby +begin + # Create Subscription + data, status_code, headers = api_instance.create_subscription_with_http_info(id, subscription_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->create_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **subscription_request** | [**SubscriptionRequest**](SubscriptionRequest.md) | requested field for subscriptions | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**SubscriptionResponse**](SubscriptionResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_all_events_from_subscription + +> get_all_events_from_subscription(id, opts) + +Get Events By Subscription + +You can get the events of the subscription(s) of a client, with the customer id + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::SubscriptionsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Events By Subscription + result = api_instance.get_all_events_from_subscription(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->get_all_events_from_subscription: #{e}" +end +``` + +#### Using the get_all_events_from_subscription_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_all_events_from_subscription_with_http_info(id, opts) + +```ruby +begin + # Get Events By Subscription + data, status_code, headers = api_instance.get_all_events_from_subscription_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->get_all_events_from_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**SubscriptionEventsResponse**](SubscriptionEventsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_subscription + +> get_subscription(id, opts) + +Get Subscription + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::SubscriptionsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Get Subscription + result = api_instance.get_subscription(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->get_subscription: #{e}" +end +``` + +#### Using the get_subscription_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_subscription_with_http_info(id, opts) + +```ruby +begin + # Get Subscription + data, status_code, headers = api_instance.get_subscription_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->get_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**SubscriptionResponse**](SubscriptionResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## pause_subscription + +> pause_subscription(id, opts) + +Pause Subscription + +You can pause the subscription to stop the plans that your customers consume + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::SubscriptionsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Pause Subscription + result = api_instance.pause_subscription(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->pause_subscription: #{e}" +end +``` + +#### Using the pause_subscription_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> pause_subscription_with_http_info(id, opts) + +```ruby +begin + # Pause Subscription + data, status_code, headers = api_instance.pause_subscription_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->pause_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**SubscriptionResponse**](SubscriptionResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## resume_subscription + +> resume_subscription(id, opts) + +Resume Subscription + +You can resume the subscription to start the plans that your customers consume + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::SubscriptionsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Resume Subscription + result = api_instance.resume_subscription(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->resume_subscription: #{e}" +end +``` + +#### Using the resume_subscription_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> resume_subscription_with_http_info(id, opts) + +```ruby +begin + # Resume Subscription + data, status_code, headers = api_instance.resume_subscription_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->resume_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**SubscriptionResponse**](SubscriptionResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_subscription + +> update_subscription(id, subscription_update_request, opts) + +Update Subscription + +You can modify the subscription to change the plans that your customers consume + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::SubscriptionsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +subscription_update_request = Conekta::SubscriptionUpdateRequest.new # SubscriptionUpdateRequest | requested field for update a subscription +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update Subscription + result = api_instance.update_subscription(id, subscription_update_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->update_subscription: #{e}" +end +``` + +#### Using the update_subscription_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_subscription_with_http_info(id, subscription_update_request, opts) + +```ruby +begin + # Update Subscription + data, status_code, headers = api_instance.update_subscription_with_http_info(id, subscription_update_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling SubscriptionsApi->update_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **subscription_update_request** | [**SubscriptionUpdateRequest**](SubscriptionUpdateRequest.md) | requested field for update a subscription | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**SubscriptionResponse**](SubscriptionResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/TaxesApi.md b/docs/TaxesApi.md new file mode 100644 index 0000000..f515766 --- /dev/null +++ b/docs/TaxesApi.md @@ -0,0 +1,243 @@ +# Conekta::TaxesApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**orders_create_taxes**](TaxesApi.md#orders_create_taxes) | **POST** /orders/{id}/tax_lines | Create Tax | +| [**orders_delete_taxes**](TaxesApi.md#orders_delete_taxes) | **DELETE** /orders/{id}/tax_lines/{tax_id} | Delete Tax | +| [**orders_update_taxes**](TaxesApi.md#orders_update_taxes) | **PUT** /orders/{id}/tax_lines/{tax_id} | Update Tax | + + +## orders_create_taxes + +> orders_create_taxes(id, order_tax_request, opts) + +Create Tax + +Create new taxes for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::TaxesApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +order_tax_request = Conekta::OrderTaxRequest.new({amount: 100, description: 'testing'}) # OrderTaxRequest | requested field for a taxes +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create Tax + result = api_instance.orders_create_taxes(id, order_tax_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling TaxesApi->orders_create_taxes: #{e}" +end +``` + +#### Using the orders_create_taxes_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_create_taxes_with_http_info(id, order_tax_request, opts) + +```ruby +begin + # Create Tax + data, status_code, headers = api_instance.orders_create_taxes_with_http_info(id, order_tax_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling TaxesApi->orders_create_taxes_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **order_tax_request** | [**OrderTaxRequest**](OrderTaxRequest.md) | requested field for a taxes | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**UpdateOrderTaxResponse**](UpdateOrderTaxResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_delete_taxes + +> orders_delete_taxes(id, tax_id, opts) + +Delete Tax + +Delete taxes for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::TaxesApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +tax_id = 'tax_lin_2tQ974hSHcsdeSZHG' # String | identifier +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Delete Tax + result = api_instance.orders_delete_taxes(id, tax_id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling TaxesApi->orders_delete_taxes: #{e}" +end +``` + +#### Using the orders_delete_taxes_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_delete_taxes_with_http_info(id, tax_id, opts) + +```ruby +begin + # Delete Tax + data, status_code, headers = api_instance.orders_delete_taxes_with_http_info(id, tax_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling TaxesApi->orders_delete_taxes_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **tax_id** | **String** | identifier | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**UpdateOrderTaxResponse**](UpdateOrderTaxResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## orders_update_taxes + +> orders_update_taxes(id, tax_id, update_order_tax_request, opts) + +Update Tax + +Update taxes for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::TaxesApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +tax_id = 'tax_lin_2tQ974hSHcsdeSZHG' # String | identifier +update_order_tax_request = Conekta::UpdateOrderTaxRequest.new # UpdateOrderTaxRequest | requested field for taxes +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update Tax + result = api_instance.orders_update_taxes(id, tax_id, update_order_tax_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling TaxesApi->orders_update_taxes: #{e}" +end +``` + +#### Using the orders_update_taxes_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_update_taxes_with_http_info(id, tax_id, update_order_tax_request, opts) + +```ruby +begin + # Update Tax + data, status_code, headers = api_instance.orders_update_taxes_with_http_info(id, tax_id, update_order_tax_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling TaxesApi->orders_update_taxes_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **tax_id** | **String** | identifier | | +| **update_order_tax_request** | [**UpdateOrderTaxRequest**](UpdateOrderTaxRequest.md) | requested field for taxes | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**UpdateOrderTaxResponse**](UpdateOrderTaxResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/Token.md b/docs/Token.md new file mode 100644 index 0000000..80c2ed3 --- /dev/null +++ b/docs/Token.md @@ -0,0 +1,20 @@ +# Conekta::Token + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **card** | [**TokenCard**](TokenCard.md) | | [optional] | +| **checkout** | [**TokenCheckout**](TokenCheckout.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::Token.new( + card: null, + checkout: null +) +``` + diff --git a/docs/TokenCard.md b/docs/TokenCard.md new file mode 100644 index 0000000..a5ddff0 --- /dev/null +++ b/docs/TokenCard.md @@ -0,0 +1,28 @@ +# Conekta::TokenCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **cvc** | **String** | It is a value that allows identifying the security code of the card. | | +| **device_fingerprint** | **String** | It is a value that allows identifying the device fingerprint. | [optional] | +| **exp_month** | **String** | It is a value that allows identifying the expiration month of the card. | | +| **exp_year** | **String** | It is a value that allows identifying the expiration year of the card. | | +| **name** | **String** | It is a value that allows identifying the name of the cardholder. | | +| **number** | **String** | It is a value that allows identifying the number of the card. | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::TokenCard.new( + cvc: 123, + device_fingerprint: zptcxk4p6w1ijwz85snf1l3bqe5g09ie, + exp_month: 12, + exp_year: 26, + name: Miguel, + number: 4242424242424242 +) +``` + diff --git a/docs/TokenCheckout.md b/docs/TokenCheckout.md new file mode 100644 index 0000000..293358f --- /dev/null +++ b/docs/TokenCheckout.md @@ -0,0 +1,18 @@ +# Conekta::TokenCheckout + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **returns_control_on** | **String** | It is a value that allows identifying the returns control on. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::TokenCheckout.new( + returns_control_on: Token +) +``` + diff --git a/docs/TokenResponse.md b/docs/TokenResponse.md new file mode 100644 index 0000000..60cb5ad --- /dev/null +++ b/docs/TokenResponse.md @@ -0,0 +1,26 @@ +# Conekta::TokenResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **checkout** | [**TokenResponseCheckout**](TokenResponseCheckout.md) | | [optional] | +| **id** | **String** | Unique identifier for the token generated by Conekta. | | +| **livemode** | **Boolean** | Indicates whether the token is in live mode or test mode. | | +| **object** | **String** | Indicates the type of object, in this case token | | +| **used** | **Boolean** | Indicates if the token has been used | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::TokenResponse.new( + checkout: null, + id: cus_2tHJfJ79KyUwpxTik, + livemode: true, + object: token, + used: false +) +``` + diff --git a/docs/TokenResponseCheckout.md b/docs/TokenResponseCheckout.md new file mode 100644 index 0000000..2efea44 --- /dev/null +++ b/docs/TokenResponseCheckout.md @@ -0,0 +1,62 @@ +# Conekta::TokenResponseCheckout + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **allowed_payment_methods** | **Array<String>** | | [optional] | +| **can_not_expire** | **Boolean** | Indicates if the checkout can not expire. | [optional] | +| **emails_sent** | **Integer** | | [optional] | +| **exclude_card_networks** | **Array<String>** | | [optional] | +| **expires_at** | **Integer** | Date and time when the checkout expires. | [optional] | +| **failure_url** | **String** | URL to redirect the customer to if the payment process fails. | [optional] | +| **force_3ds_flow** | **Boolean** | Indicates if the checkout forces the 3DS flow. | [optional] | +| **id** | **String** | | [optional] | +| **livemode** | **Boolean** | | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **monthly_installments_enabled** | **Boolean** | Indicates if the checkout allows monthly installments. | [optional] | +| **monthly_installments_options** | **Array<Integer>** | List of monthly installments options. | [optional] | +| **name** | **String** | | [optional] | +| **needs_shipping_contact** | **Boolean** | | [optional] | +| **object** | **String** | Indicates the type of object, in this case checkout. | [optional] | +| **on_demand_enabled** | **Boolean** | Indicates if the checkout allows on demand payments. | [optional] | +| **paid_payments_count** | **Integer** | Number of payments that have been paid. | [optional] | +| **recurrent** | **Boolean** | Indicates if the checkout is recurrent. | [optional] | +| **sms_sent** | **Integer** | | [optional] | +| **starts_at** | **Integer** | Date and time when the checkout starts. | [optional] | +| **status** | **String** | Status of the checkout. | [optional] | +| **success_url** | **String** | URL to redirect the customer to after the payment process is completed. | [optional] | +| **type** | **String** | Type of checkout. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::TokenResponseCheckout.new( + allowed_payment_methods: null, + can_not_expire: false, + emails_sent: 0, + exclude_card_networks: null, + expires_at: 1675715413, + failure_url: https://example.com/failure, + force_3ds_flow: false, + id: 524f9d2f-8c2e-4e64-a33d-6006711a91bd, + livemode: true, + metadata: {key=value}, + monthly_installments_enabled: false, + monthly_installments_options: null, + name: tok-2toNoPZpJgRU4PvgZ, + needs_shipping_contact: false, + object: checkout, + on_demand_enabled: false, + paid_payments_count: 0, + recurrent: false, + sms_sent: 0, + starts_at: 1675715413, + status: Issued, + success_url: https://example.com/success, + type: Integration +) +``` + diff --git a/docs/TokensApi.md b/docs/TokensApi.md new file mode 100644 index 0000000..d0326c6 --- /dev/null +++ b/docs/TokensApi.md @@ -0,0 +1,81 @@ +# Conekta::TokensApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_token**](TokensApi.md#create_token) | **POST** /tokens | Create Token | + + +## create_token + +> create_token(token, opts) + +Create Token + +Generate a payment token, to associate it with a card + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::TokensApi.new +token = Conekta::Token.new # Token | requested field for token +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Create Token + result = api_instance.create_token(token, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling TokensApi->create_token: #{e}" +end +``` + +#### Using the create_token_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_token_with_http_info(token, opts) + +```ruby +begin + # Create Token + data, status_code, headers = api_instance.create_token_with_http_info(token, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling TokensApi->create_token_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **token** | [**Token**](Token.md) | requested field for token | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**TokenResponse**](TokenResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/TransactionResponse.md b/docs/TransactionResponse.md new file mode 100644 index 0000000..2d9b19a --- /dev/null +++ b/docs/TransactionResponse.md @@ -0,0 +1,38 @@ +# Conekta::TransactionResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The amount of the transaction. | | +| **charge** | **String** | Randomly assigned unique order identifier associated with the charge. | | +| **created_at** | **Integer** | Date and time of creation of the transaction in Unix format. | | +| **currency** | **String** | The currency of the transaction. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) | | +| **fee** | **Integer** | The amount to be deducted for taxes and commissions. | | +| **id** | **String** | Unique identifier of the transaction. | | +| **livemode** | **Boolean** | Indicates whether the transaction was created in live mode or test mode. | | +| **net** | **Integer** | The net amount after deducting commissions and taxes. | | +| **object** | **String** | Object name, which is transaction. | | +| **status** | **String** | Code indicating transaction status. | | +| **type** | **String** | Transaction Type | | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::TransactionResponse.new( + amount: 1000, + charge: 5ee7ec58885a45585e6d9f8m, + created_at: 1553273553, + currency: MXN, + fee: 560, + id: 5ee7ec5b8dea41085erb7f9e, + livemode: true, + net: 440, + object: transaction, + status: pending, + type: capture +) +``` + diff --git a/docs/TransactionsApi.md b/docs/TransactionsApi.md new file mode 100644 index 0000000..7e85d30 --- /dev/null +++ b/docs/TransactionsApi.md @@ -0,0 +1,165 @@ +# Conekta::TransactionsApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_transaction**](TransactionsApi.md#get_transaction) | **GET** /transactions/{id} | Get transaction | +| [**get_transactions**](TransactionsApi.md#get_transactions) | **GET** /transactions | Get List transactions | + + +## get_transaction + +> get_transaction(id, opts) + +Get transaction + +Get the details of a transaction + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::TransactionsApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get transaction + result = api_instance.get_transaction(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling TransactionsApi->get_transaction: #{e}" +end +``` + +#### Using the get_transaction_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_transaction_with_http_info(id, opts) + +```ruby +begin + # Get transaction + data, status_code, headers = api_instance.get_transaction_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling TransactionsApi->get_transaction_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**TransactionResponse**](TransactionResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_transactions + +> get_transactions(opts) + +Get List transactions + +Get transaction details in the form of a list + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::TransactionsApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get List transactions + result = api_instance.get_transactions(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling TransactionsApi->get_transactions: #{e}" +end +``` + +#### Using the get_transactions_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_transactions_with_http_info(opts) + +```ruby +begin + # Get List transactions + data, status_code, headers = api_instance.get_transactions_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling TransactionsApi->get_transactions_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetTransactionsResponse**](GetTransactionsResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/TransferDestinationResponse.md b/docs/TransferDestinationResponse.md new file mode 100644 index 0000000..ba40e31 --- /dev/null +++ b/docs/TransferDestinationResponse.md @@ -0,0 +1,32 @@ +# Conekta::TransferDestinationResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_holder** | **String** | Name of the account holder. | [optional] | +| **account_number** | **String** | Account number of the bank account. | [optional] | +| **bank** | **String** | Name of the bank. | [optional] | +| **created_at** | **Integer** | Date and time of creation of the transfer. | [optional] | +| **id** | **String** | Unique identifier of the transfer. | [optional] | +| **object** | **String** | Object name, which is bank_transfer_payout_method. | [optional] | +| **payee_id** | **String** | Unique identifier of the payee. | [optional] | +| **type** | **String** | Type of the payee. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::TransferDestinationResponse.new( + account_holder: John Doe, + account_number: 012180023547896764, + bank: BBVA Bancomer, + created_at: 1553273553, + id: pytmtd_2ide3qwTdDvNBosEC, + object: bank_transfer_payout_method, + payee_id: payee_2icdDewRxDENBos85, + type: BankTransferPayoutMethod +) +``` + diff --git a/docs/TransferMethodResponse.md b/docs/TransferMethodResponse.md new file mode 100644 index 0000000..6e07d13 --- /dev/null +++ b/docs/TransferMethodResponse.md @@ -0,0 +1,32 @@ +# Conekta::TransferMethodResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_holder** | **String** | Name of the account holder. | [optional] | +| **account_number** | **String** | Account number of the bank account. | [optional] | +| **bank** | **String** | Name of the bank. | [optional] | +| **created_at** | **Integer** | Date and time of creation of the transfer. | [optional] | +| **id** | **String** | Unique identifier of the transfer. | [optional] | +| **object** | **String** | Object name, which is bank_transfer_payout_method. | [optional] | +| **payee_id** | **String** | Unique identifier of the payee. | [optional] | +| **type** | **String** | Type of the payee. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::TransferMethodResponse.new( + account_holder: John Doe, + account_number: 012180023547896764, + bank: BBVA Bancomer, + created_at: 1553273553, + id: pytmtd_2ide3qwTdDvNBosEC, + object: bank_transfer_payout_method, + payee_id: payee_2icdDewRxDENBos85, + type: BankTransferPayoutMethod +) +``` + diff --git a/docs/TransferResponse.md b/docs/TransferResponse.md new file mode 100644 index 0000000..5aa507c --- /dev/null +++ b/docs/TransferResponse.md @@ -0,0 +1,36 @@ +# Conekta::TransferResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Amount in cents of the transfer. | [optional] | +| **created_at** | **Integer** | Date and time of creation of the transfer in Unix format. | [optional] | +| **currency** | **String** | The currency of the transfer. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) | [optional] | +| **id** | **String** | Unique identifier of the transfer. | [optional] | +| **livemode** | **Boolean** | Indicates whether the transfer was created in live mode or test mode. | [optional] | +| **destination** | [**TransferDestinationResponse**](TransferDestinationResponse.md) | | [optional] | +| **object** | **String** | Object name, which is transfer. | [optional] | +| **statement_description** | **String** | Description of the transfer. | [optional] | +| **statement_reference** | **String** | Reference number of the transfer. | [optional] | +| **status** | **String** | Code indicating transfer status. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::TransferResponse.new( + amount: 10000, + created_at: 1553273553, + currency: MXN, + id: 5b0337d4dD344ef954fe1X4b6, + livemode: true, + destination: null, + object: transfer, + statement_description: Conekta 4401234, + statement_reference: 4401234, + status: pending +) +``` + diff --git a/docs/TransfersApi.md b/docs/TransfersApi.md new file mode 100644 index 0000000..70b8804 --- /dev/null +++ b/docs/TransfersApi.md @@ -0,0 +1,165 @@ +# Conekta::TransfersApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_transfer**](TransfersApi.md#get_transfer) | **GET** /transfers/{id} | Get Transfer | +| [**get_transfers**](TransfersApi.md#get_transfers) | **GET** /transfers | Get a list of transfers | + + +## get_transfer + +> get_transfer(id, opts) + +Get Transfer + +Get the details of a Transfer + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::TransfersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Transfer + result = api_instance.get_transfer(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling TransfersApi->get_transfer: #{e}" +end +``` + +#### Using the get_transfer_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_transfer_with_http_info(id, opts) + +```ruby +begin + # Get Transfer + data, status_code, headers = api_instance.get_transfer_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling TransfersApi->get_transfer_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**TransferResponse**](TransferResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_transfers + +> get_transfers(opts) + +Get a list of transfers + +Get transfers details in the form of a list + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::TransfersApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get a list of transfers + result = api_instance.get_transfers(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling TransfersApi->get_transfers: #{e}" +end +``` + +#### Using the get_transfers_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_transfers_with_http_info(opts) + +```ruby +begin + # Get a list of transfers + data, status_code, headers = api_instance.get_transfers_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling TransfersApi->get_transfers_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetTransfersResponse**](GetTransfersResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/TransfersResponse.md b/docs/TransfersResponse.md new file mode 100644 index 0000000..ffbc2f3 --- /dev/null +++ b/docs/TransfersResponse.md @@ -0,0 +1,36 @@ +# Conekta::TransfersResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | Amount in cents of the transfer. | [optional] | +| **created_at** | **Integer** | Date and time of creation of the transfer. | [optional] | +| **currency** | **String** | The currency of the transfer. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) | [optional] | +| **id** | **String** | Unique identifier of the transfer. | [optional] | +| **livemode** | **Boolean** | Indicates whether the transfer was created in live mode or test mode. | [optional] | +| **method** | [**TransferMethodResponse**](TransferMethodResponse.md) | | [optional] | +| **object** | **String** | Object name, which is transfer. | [optional] | +| **statement_description** | **String** | Description of the transfer. | [optional] | +| **statement_reference** | **String** | Reference number of the transfer. | [optional] | +| **status** | **String** | Code indicating transfer status. | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::TransfersResponse.new( + amount: 10000, + created_at: 1553273553, + currency: MXN, + id: 5b0337d4dD344ef954fe1X4b6, + livemode: true, + method: null, + object: transfer, + statement_description: Conekta 4401234, + statement_reference: 4401234, + status: pending +) +``` + diff --git a/docs/UpdateCustomer.md b/docs/UpdateCustomer.md new file mode 100644 index 0000000..ce5cca7 --- /dev/null +++ b/docs/UpdateCustomer.md @@ -0,0 +1,44 @@ +# Conekta::UpdateCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **antifraud_info** | [**UpdateCustomerAntifraudInfo**](UpdateCustomerAntifraudInfo.md) | | [optional] | +| **default_payment_source_id** | **String** | It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id) | [optional] | +| **email** | **String** | An email address is a series of customizable characters followed by a universal Internet symbol, the at symbol (@), the name of a host server, and a web domain ending (.mx, .com, .org, . net, etc). | [optional] | +| **name** | **String** | Client's name | [optional] | +| **phone** | **String** | Is the customer's phone number | [optional] | +| **plan_id** | **String** | Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription | [optional] | +| **default_shipping_contact_id** | **String** | It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact) | [optional] | +| **corporate** | **Boolean** | It is a value that allows identifying if the email is corporate or not. | [optional][default to false] | +| **custom_reference** | **String** | It is an undefined value. | [optional] | +| **fiscal_entities** | [**Array<CustomerFiscalEntitiesRequest>**](CustomerFiscalEntitiesRequest.md) | | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **payment_sources** | [**Array<CustomerPaymentMethodsRequest>**](CustomerPaymentMethodsRequest.md) | Contains details of the payment methods that the customer has active or has used in Conekta | [optional] | +| **shipping_contacts** | [**Array<CustomerShippingContacts>**](CustomerShippingContacts.md) | Contains the detail of the shipping addresses that the client has active or has used in Conekta | [optional] | +| **subscription** | [**SubscriptionRequest**](SubscriptionRequest.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdateCustomer.new( + antifraud_info: null, + default_payment_source_id: src_1a2b3c4d5e6f7g8h, + email: miguel@gmail.com, + name: miguel, + phone: +5215555555555, + plan_id: plan_987234823, + default_shipping_contact_id: ship_cont_1a2b3c4d5e6f7g8h, + corporate: false, + custom_reference: null, + fiscal_entities: null, + metadata: null, + payment_sources: null, + shipping_contacts: null, + subscription: null +) +``` + diff --git a/docs/UpdateCustomerAntifraudInfo.md b/docs/UpdateCustomerAntifraudInfo.md new file mode 100644 index 0000000..56fbd9e --- /dev/null +++ b/docs/UpdateCustomerAntifraudInfo.md @@ -0,0 +1,20 @@ +# Conekta::UpdateCustomerAntifraudInfo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_created_at** | **Integer** | | [optional] | +| **first_paid_at** | **Integer** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdateCustomerAntifraudInfo.new( + account_created_at: 1484040996, + first_paid_at: 1485151007 +) +``` + diff --git a/docs/UpdateCustomerFiscalEntitiesResponse.md b/docs/UpdateCustomerFiscalEntitiesResponse.md new file mode 100644 index 0000000..4bb4140 --- /dev/null +++ b/docs/UpdateCustomerFiscalEntitiesResponse.md @@ -0,0 +1,38 @@ +# Conekta::UpdateCustomerFiscalEntitiesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **address** | [**CustomerFiscalEntitiesRequestAddress**](CustomerFiscalEntitiesRequestAddress.md) | | | +| **tax_id** | **String** | | [optional] | +| **email** | **String** | | [optional] | +| **phone** | **String** | | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **company_name** | **String** | | [optional] | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdateCustomerFiscalEntitiesResponse.new( + address: null, + tax_id: null, + email: null, + phone: null, + metadata: null, + company_name: conekta, + id: fis_ent_2tKZsTYcsryyu7Ah8, + object: fiscal_entities, + created_at: 1675715413, + parent_id: cus_2tKcHxhTz7xU5SymF, + default: null +) +``` + diff --git a/docs/UpdateCustomerFiscalEntitiesResponseAllOf.md b/docs/UpdateCustomerFiscalEntitiesResponseAllOf.md new file mode 100644 index 0000000..eca05a4 --- /dev/null +++ b/docs/UpdateCustomerFiscalEntitiesResponseAllOf.md @@ -0,0 +1,26 @@ +# Conekta::UpdateCustomerFiscalEntitiesResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **object** | **String** | | | +| **created_at** | **Integer** | | | +| **parent_id** | **String** | | [optional] | +| **default** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdateCustomerFiscalEntitiesResponseAllOf.new( + id: fis_ent_2tKZsTYcsryyu7Ah8, + object: fiscal_entities, + created_at: 1675715413, + parent_id: cus_2tKcHxhTz7xU5SymF, + default: null +) +``` + diff --git a/docs/UpdateCustomerPaymentMethodsResponse.md b/docs/UpdateCustomerPaymentMethodsResponse.md new file mode 100644 index 0000000..60f1a4b --- /dev/null +++ b/docs/UpdateCustomerPaymentMethodsResponse.md @@ -0,0 +1,83 @@ +# Conekta::UpdateCustomerPaymentMethodsResponse + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'conekta' + +Conekta::UpdateCustomerPaymentMethodsResponse.openapi_one_of +# => +# [ +# :'PaymentMethodCardResponse', +# :'PaymentMethodCashResponse', +# :'PaymentMethodSpeiRecurrent' +# ] +``` + +### `openapi_discriminator_name` + +Returns the discriminator's property name. + +#### Example + +```ruby +require 'conekta' + +Conekta::UpdateCustomerPaymentMethodsResponse.openapi_discriminator_name +# => :'type' +``` + +### `openapi_discriminator_name` + +Returns the discriminator's mapping. + +#### Example + +```ruby +require 'conekta' + +Conekta::UpdateCustomerPaymentMethodsResponse.openapi_discriminator_mapping +# => +# { +# :'card' => :'PaymentMethodCardResponse', +# :'cash' => :'PaymentMethodCashResponse', +# :'oxxo_recurrent' => :'PaymentMethodCashResponse', +# :'spei_recurrent' => :'PaymentMethodSpeiRecurrent' +# } +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'conekta' + +Conekta::UpdateCustomerPaymentMethodsResponse.build(data) +# => # + +Conekta::UpdateCustomerPaymentMethodsResponse.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `PaymentMethodCardResponse` +- `PaymentMethodCashResponse` +- `PaymentMethodSpeiRecurrent` +- `nil` (if no type matches) + diff --git a/docs/UpdateOrderDiscountLinesRequest.md b/docs/UpdateOrderDiscountLinesRequest.md new file mode 100644 index 0000000..ac9733e --- /dev/null +++ b/docs/UpdateOrderDiscountLinesRequest.md @@ -0,0 +1,22 @@ +# Conekta::UpdateOrderDiscountLinesRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | | [optional] | +| **code** | **String** | Discount code. | [optional] | +| **type** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdateOrderDiscountLinesRequest.new( + amount: 500, + code: 123, + type: loyalty +) +``` + diff --git a/docs/UpdateOrderTaxRequest.md b/docs/UpdateOrderTaxRequest.md new file mode 100644 index 0000000..4ab7372 --- /dev/null +++ b/docs/UpdateOrderTaxRequest.md @@ -0,0 +1,22 @@ +# Conekta::UpdateOrderTaxRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The amount to be collected for tax in cents | [optional] | +| **description** | **String** | description or tax's name | [optional] | +| **metadata** | **Hash<String, Object>** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdateOrderTaxRequest.new( + amount: 100, + description: testing, + metadata: null +) +``` + diff --git a/docs/UpdateOrderTaxResponse.md b/docs/UpdateOrderTaxResponse.md new file mode 100644 index 0000000..323e09f --- /dev/null +++ b/docs/UpdateOrderTaxResponse.md @@ -0,0 +1,28 @@ +# Conekta::UpdateOrderTaxResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | The amount to be collected for tax in cents | | +| **description** | **String** | description or tax's name | | +| **metadata** | **Hash<String, Object>** | | [optional] | +| **id** | **String** | | | +| **object** | **String** | | [optional] | +| **parent_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdateOrderTaxResponse.new( + amount: 100, + description: testing, + metadata: {key=value}, + id: tax_lin_2tQ8dC5mg1UADmVPo, + object: tax_line, + parent_id: ord_2tPAmKCEJqh8RE6nY +) +``` + diff --git a/docs/UpdateOrderTaxResponseAllOf.md b/docs/UpdateOrderTaxResponseAllOf.md new file mode 100644 index 0000000..2664c79 --- /dev/null +++ b/docs/UpdateOrderTaxResponseAllOf.md @@ -0,0 +1,22 @@ +# Conekta::UpdateOrderTaxResponseAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **object** | **String** | | [optional] | +| **parent_id** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdateOrderTaxResponseAllOf.new( + id: tax_lin_2tQ8dC5mg1UADmVPo, + object: tax_line, + parent_id: ord_2tPAmKCEJqh8RE6nY +) +``` + diff --git a/docs/UpdatePaymentMethods.md b/docs/UpdatePaymentMethods.md new file mode 100644 index 0000000..ecd5c5c --- /dev/null +++ b/docs/UpdatePaymentMethods.md @@ -0,0 +1,18 @@ +# Conekta::UpdatePaymentMethods + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdatePaymentMethods.new( + name: name of person +) +``` + diff --git a/docs/UpdateProduct.md b/docs/UpdateProduct.md new file mode 100644 index 0000000..e9065b5 --- /dev/null +++ b/docs/UpdateProduct.md @@ -0,0 +1,34 @@ +# Conekta::UpdateProduct + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **antifraud_info** | **Hash<String, Object>** | | [optional] | +| **description** | **String** | | [optional] | +| **sku** | **String** | | [optional] | +| **name** | **String** | | [optional] | +| **unit_price** | **Integer** | | [optional] | +| **quantity** | **Integer** | | [optional] | +| **tags** | **Array<String>** | | [optional] | +| **brand** | **String** | | [optional] | +| **metadata** | **Hash<String, String>** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::UpdateProduct.new( + antifraud_info: null, + description: null, + sku: null, + name: Box of Cohiba S1s, + unit_price: 20000, + quantity: 1, + tags: null, + brand: null, + metadata: null +) +``` + diff --git a/docs/WebhookKeyCreateResponse.md b/docs/WebhookKeyCreateResponse.md new file mode 100644 index 0000000..56dd996 --- /dev/null +++ b/docs/WebhookKeyCreateResponse.md @@ -0,0 +1,28 @@ +# Conekta::WebhookKeyCreateResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **active** | **Boolean** | Indicates if the webhook key is active | [optional] | +| **created_at** | **Integer** | Unix timestamp in seconds with the creation date of the webhook key | [optional] | +| **id** | **String** | Unique identifier of the webhook key | [optional] | +| **livemode** | **Boolean** | Indicates if the webhook key is in live mode | [optional] | +| **object** | **String** | Object name, value is webhook_key | [optional] | +| **public_key** | **String** | Public key to be used in the webhook | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WebhookKeyCreateResponse.new( + active: true, + created_at: 1577836800, + id: 62730ba6fb7dfd6a712f118e, + livemode: false, + object: webhook_key, + public_key: -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqULpUc6D6mSAq5a0yLY/\noOjd1mWm6q+QI8y/FI4STr2F+XgKeNnMxSqnyFrHtKQ/ut4Zi45WFnJLfEQL7aW5\n67yE2dWyo6GaL7yZUfLC0Y3sHPGzaGtvDF36ISW7LliYNoMiA3Bx5/1Sr0G23pGW\n0Mp8IO1Nlz0sJWuU/d7zCz/UN6cl9g/BP4eaQ7deS56YuWcj5sTlwqFTlwN12kpA\nIzMZ7gnvYQnZTpPny5lben6QEuxTvZcPApcyOweiESjMnXfkfWOyuYtgMrbsU6oL\nA6sWa6j0pePW7AYeBqB4tyAlenkCSqzHg8bMk5Bm7hiT6I9Pls774lJbnOYmmuNE\n8QIDAQAB\n-----END PUBLIC KEY-----\n +) +``` + diff --git a/docs/WebhookKeyDeleteResponse.md b/docs/WebhookKeyDeleteResponse.md new file mode 100644 index 0000000..5bc2aec --- /dev/null +++ b/docs/WebhookKeyDeleteResponse.md @@ -0,0 +1,28 @@ +# Conekta::WebhookKeyDeleteResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **active** | **Boolean** | Indicates if the webhook key is active | [optional] | +| **created_at** | **Integer** | Unix timestamp in seconds with the creation date of the webhook key | [optional] | +| **deleted** | **Boolean** | Indicates if the webhook key is deleted | [optional] | +| **id** | **String** | Unique identifier of the webhook key | [optional] | +| **livemode** | **Boolean** | Indicates if the webhook key is in live mode | [optional] | +| **object** | **String** | Object name, value is webhook_key | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WebhookKeyDeleteResponse.new( + active: true, + created_at: 1577836800, + deleted: true, + id: 62730ba6fb7dfd6a712f118e, + livemode: false, + object: webhook_key +) +``` + diff --git a/docs/WebhookKeyRequest.md b/docs/WebhookKeyRequest.md new file mode 100644 index 0000000..cb0ad27 --- /dev/null +++ b/docs/WebhookKeyRequest.md @@ -0,0 +1,18 @@ +# Conekta::WebhookKeyRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **active** | **Boolean** | Indicates if the webhook key is active | [optional][default to true] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WebhookKeyRequest.new( + active: true +) +``` + diff --git a/docs/WebhookKeyResponse.md b/docs/WebhookKeyResponse.md new file mode 100644 index 0000000..d7d1958 --- /dev/null +++ b/docs/WebhookKeyResponse.md @@ -0,0 +1,30 @@ +# Conekta::WebhookKeyResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Unique identifier of the webhook key | [optional] | +| **active** | **Boolean** | Indicates if the webhook key is active | [optional] | +| **created_at** | **Integer** | Unix timestamp in seconds with the creation date of the webhook key | [optional] | +| **deactivated_at** | **Integer** | Unix timestamp in seconds with the deactivation date of the webhook key | [optional] | +| **public_key** | **String** | Public key to be used in the webhook | [optional] | +| **livemode** | **Boolean** | Indicates if the webhook key is in live mode | [optional] | +| **object** | **String** | Object name, value is webhook_key | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WebhookKeyResponse.new( + id: 62730ba6fb7dfd6a712f118e, + active: true, + created_at: 1577836800, + deactivated_at: null, + public_key: -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqULpUc6D6mSAq5a0yLY/\noOjd1mWm6q+QI8y/FI4STr2F+XgKeNnMxSqnyFrHtKQ/ut4Zi45WFnJLfEQL7aW5\n67yE2dWyo6GaL7yZUfLC0Y3sHPGzaGtvDF36ISW7LliYNoMiA3Bx5/1Sr0G23pGW\n0Mp8IO1Nlz0sJWuU/d7zCz/UN6cl9g/BP4eaQ7deS56YuWcj5sTlwqFTlwN12kpA\nIzMZ7gnvYQnZTpPny5lben6QEuxTvZcPApcyOweiESjMnXfkfWOyuYtgMrbsU6oL\nA6sWa6j0pePW7AYeBqB4tyAlenkCSqzHg8bMk5Bm7hiT6I9Pls774lJbnOYmmuNE\n8QIDAQAB\n-----END PUBLIC KEY-----\n, + livemode: false, + object: webhook_key +) +``` + diff --git a/docs/WebhookKeyUpdateRequest.md b/docs/WebhookKeyUpdateRequest.md new file mode 100644 index 0000000..89352f8 --- /dev/null +++ b/docs/WebhookKeyUpdateRequest.md @@ -0,0 +1,18 @@ +# Conekta::WebhookKeyUpdateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **active** | **Boolean** | Indicates if the webhook key is active | [optional][default to false] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WebhookKeyUpdateRequest.new( + active: false +) +``` + diff --git a/docs/WebhookKeysApi.md b/docs/WebhookKeysApi.md new file mode 100644 index 0000000..0767a90 --- /dev/null +++ b/docs/WebhookKeysApi.md @@ -0,0 +1,385 @@ +# Conekta::WebhookKeysApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_webhook_key**](WebhookKeysApi.md#create_webhook_key) | **POST** /webhook_keys | Create Webhook Key | +| [**delete_webhook_key**](WebhookKeysApi.md#delete_webhook_key) | **DELETE** /webhook_keys/{id} | Delete Webhook key | +| [**get_webhook_key**](WebhookKeysApi.md#get_webhook_key) | **GET** /webhook_keys/{id} | Get Webhook Key | +| [**get_webhook_keys**](WebhookKeysApi.md#get_webhook_keys) | **GET** /webhook_keys | Get List of Webhook Keys | +| [**update_webhook_key**](WebhookKeysApi.md#update_webhook_key) | **PUT** /webhook_keys/{id} | Update Webhook Key | + + +## create_webhook_key + +> create_webhook_key(opts) + +Create Webhook Key + +Create a webhook key + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhookKeysApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + webhook_key_request: Conekta::WebhookKeyRequest.new # WebhookKeyRequest | +} + +begin + # Create Webhook Key + result = api_instance.create_webhook_key(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->create_webhook_key: #{e}" +end +``` + +#### Using the create_webhook_key_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_webhook_key_with_http_info(opts) + +```ruby +begin + # Create Webhook Key + data, status_code, headers = api_instance.create_webhook_key_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->create_webhook_key_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **webhook_key_request** | [**WebhookKeyRequest**](WebhookKeyRequest.md) | | [optional] | + +### Return type + +[**WebhookKeyCreateResponse**](WebhookKeyCreateResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## delete_webhook_key + +> delete_webhook_key(id, opts) + +Delete Webhook key + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhookKeysApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Delete Webhook key + result = api_instance.delete_webhook_key(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->delete_webhook_key: #{e}" +end +``` + +#### Using the delete_webhook_key_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_webhook_key_with_http_info(id, opts) + +```ruby +begin + # Delete Webhook key + data, status_code, headers = api_instance.delete_webhook_key_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->delete_webhook_key_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**WebhookKeyDeleteResponse**](WebhookKeyDeleteResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_webhook_key + +> get_webhook_key(id, opts) + +Get Webhook Key + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhookKeysApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Webhook Key + result = api_instance.get_webhook_key(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->get_webhook_key: #{e}" +end +``` + +#### Using the get_webhook_key_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_webhook_key_with_http_info(id, opts) + +```ruby +begin + # Get Webhook Key + data, status_code, headers = api_instance.get_webhook_key_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->get_webhook_key_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**WebhookKeyResponse**](WebhookKeyResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_webhook_keys + +> get_webhook_keys(opts) + +Get List of Webhook Keys + +Consume the list of webhook keys you have + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhookKeysApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get List of Webhook Keys + result = api_instance.get_webhook_keys(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->get_webhook_keys: #{e}" +end +``` + +#### Using the get_webhook_keys_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_webhook_keys_with_http_info(opts) + +```ruby +begin + # Get List of Webhook Keys + data, status_code, headers = api_instance.get_webhook_keys_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->get_webhook_keys_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetWebhookKeysResponse**](GetWebhookKeysResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_webhook_key + +> update_webhook_key(id, opts) + +Update Webhook Key + +updates an existing webhook key + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhookKeysApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + webhook_key_update_request: Conekta::WebhookKeyUpdateRequest.new # WebhookKeyUpdateRequest | +} + +begin + # Update Webhook Key + result = api_instance.update_webhook_key(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->update_webhook_key: #{e}" +end +``` + +#### Using the update_webhook_key_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_webhook_key_with_http_info(id, opts) + +```ruby +begin + # Update Webhook Key + data, status_code, headers = api_instance.update_webhook_key_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhookKeysApi->update_webhook_key_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **webhook_key_update_request** | [**WebhookKeyUpdateRequest**](WebhookKeyUpdateRequest.md) | | [optional] | + +### Return type + +[**WebhookKeyResponse**](WebhookKeyResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/WebhookLog.md b/docs/WebhookLog.md new file mode 100644 index 0000000..11a7de1 --- /dev/null +++ b/docs/WebhookLog.md @@ -0,0 +1,30 @@ +# Conekta::WebhookLog + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **failed_attempts** | **Integer** | | [optional] | +| **id** | **String** | | [optional] | +| **last_attempted_at** | **Integer** | | [optional] | +| **last_http_response_status** | **Integer** | | [optional] | +| **object** | **String** | | [optional] | +| **response_data** | **Hash<String, Object>** | | [optional] | +| **url** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WebhookLog.new( + failed_attempts: 10, + id: webhl_2svd2sh6GbqzyWBNZ, + last_attempted_at: 1669651274, + last_http_response_status: 200, + object: webhook_log, + response_data: {amount=3000, payable=true}, + url: https://username:password@mockoon.stg.conekta.io/payments-api/cash/merchant_approval +) +``` + diff --git a/docs/WebhookRequest.md b/docs/WebhookRequest.md new file mode 100644 index 0000000..386a859 --- /dev/null +++ b/docs/WebhookRequest.md @@ -0,0 +1,20 @@ +# Conekta::WebhookRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | Here you must place the URL of your Webhook remember that you must program what you will do with the events received. Also do not forget to handle the HTTPS protocol for greater security. | | +| **synchronous** | **Boolean** | It is a value that allows to decide if the events will be synchronous or asynchronous. We recommend asynchronous = false | [default to false] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WebhookRequest.new( + url: https://webhook.site/89277eaa-a8e4-4306-8dc5-f55c80703dc8, + synchronous: false +) +``` + diff --git a/docs/WebhookResponse.md b/docs/WebhookResponse.md new file mode 100644 index 0000000..f6f0625 --- /dev/null +++ b/docs/WebhookResponse.md @@ -0,0 +1,36 @@ +# Conekta::WebhookResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **deleted** | **Boolean** | | [optional] | +| **development_enabled** | **Boolean** | | [optional] | +| **id** | **String** | | [optional] | +| **livemode** | **Boolean** | | [optional] | +| **object** | **String** | | [optional] | +| **production_enabled** | **Boolean** | | [optional] | +| **status** | **String** | | [optional] | +| **subscribed_events** | **Array<String>** | | [optional] | +| **synchronous** | **Boolean** | | [optional] | +| **url** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WebhookResponse.new( + deleted: false, + development_enabled: false, + id: 6307a60c41de27127515a575, + livemode: true, + object: event, + production_enabled: true, + status: listening, + subscribed_events: [charge.created, charge.paid, charge.under_fraud_review, charge.fraudulent, charge.refunded, charge.preauthorized, charge.declined, charge.canceled, charge.reversed, charge.pending_confirmation], + synchronous: false, + url: https://username:password@mockoon.stg.conekta.io/payments-api/cash/merchant_approval +) +``` + diff --git a/docs/WebhookUpdateRequest.md b/docs/WebhookUpdateRequest.md new file mode 100644 index 0000000..09bf37c --- /dev/null +++ b/docs/WebhookUpdateRequest.md @@ -0,0 +1,22 @@ +# Conekta::WebhookUpdateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | Here you must place the URL of your Webhook remember that you must program what you will do with the events received. Also do not forget to handle the HTTPS protocol for greater security. | | +| **synchronous** | **Boolean** | It is a value that allows to decide if the events will be synchronous or asynchronous. We recommend asynchronous = false | [optional][default to false] | +| **subscribed_events** | **Array<String>** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WebhookUpdateRequest.new( + url: https://webhook.site/89277eaa-a8e4-4306-8dc5-f55c80703dc8, + synchronous: false, + subscribed_events: customer.created +) +``` + diff --git a/docs/WebhooksApi.md b/docs/WebhooksApi.md new file mode 100644 index 0000000..5d69c60 --- /dev/null +++ b/docs/WebhooksApi.md @@ -0,0 +1,461 @@ +# Conekta::WebhooksApi + +All URIs are relative to *https://api.conekta.io* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_webhook**](WebhooksApi.md#create_webhook) | **POST** /webhooks | Create Webhook | +| [**delete_webhook**](WebhooksApi.md#delete_webhook) | **DELETE** /webhooks/{id} | Delete Webhook | +| [**get_webhook**](WebhooksApi.md#get_webhook) | **GET** /webhooks/{id} | Get Webhook | +| [**get_webhooks**](WebhooksApi.md#get_webhooks) | **GET** /webhooks | Get List of Webhooks | +| [**test_webhook**](WebhooksApi.md#test_webhook) | **POST** /webhooks/{id}/test | Test Webhook | +| [**update_webhook**](WebhooksApi.md#update_webhook) | **PUT** /webhooks/{id} | Update Webhook | + + +## create_webhook + +> create_webhook(webhook_request, opts) + +Create Webhook + +What we do at Conekta translates into events. For example, an event of interest to us occurs at the time a payment is successfully processed. At that moment we will be interested in doing several things: Send an email to the buyer, generate an invoice, start the process of shipping the product, etc. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhooksApi.new +webhook_request = Conekta::WebhookRequest.new({url: 'https://webhook.site/89277eaa-a8e4-4306-8dc5-f55c80703dc8', synchronous: false}) # WebhookRequest | requested field for webhook +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Create Webhook + result = api_instance.create_webhook(webhook_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->create_webhook: #{e}" +end +``` + +#### Using the create_webhook_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_webhook_with_http_info(webhook_request, opts) + +```ruby +begin + # Create Webhook + data, status_code, headers = api_instance.create_webhook_with_http_info(webhook_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->create_webhook_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **webhook_request** | [**WebhookRequest**](WebhookRequest.md) | requested field for webhook | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**WebhookResponse**](WebhookResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## delete_webhook + +> delete_webhook(id, opts) + +Delete Webhook + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhooksApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Delete Webhook + result = api_instance.delete_webhook(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->delete_webhook: #{e}" +end +``` + +#### Using the delete_webhook_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_webhook_with_http_info(id, opts) + +```ruby +begin + # Delete Webhook + data, status_code, headers = api_instance.delete_webhook_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->delete_webhook_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**WebhookResponse**](WebhookResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_webhook + +> get_webhook(id, opts) + +Get Webhook + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhooksApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Get Webhook + result = api_instance.get_webhook(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->get_webhook: #{e}" +end +``` + +#### Using the get_webhook_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_webhook_with_http_info(id, opts) + +```ruby +begin + # Get Webhook + data, status_code, headers = api_instance.get_webhook_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->get_webhook_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**WebhookResponse**](WebhookResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## get_webhooks + +> get_webhooks(opts) + +Get List of Webhooks + +Consume the list of webhooks you have, each environment supports 10 webhooks (For production and testing) + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhooksApi.new +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request. + limit: 56, # Integer | The numbers of items to return, the maximum value is 250 + search: 'search_example', # String | General order search, e.g. by mail, reference etc. + _next: '_next_example', # String | next page + previous: 'previous_example' # String | previous page +} + +begin + # Get List of Webhooks + result = api_instance.get_webhooks(opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->get_webhooks: #{e}" +end +``` + +#### Using the get_webhooks_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_webhooks_with_http_info(opts) + +```ruby +begin + # Get List of Webhooks + data, status_code, headers = api_instance.get_webhooks_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->get_webhooks_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | +| **limit** | **Integer** | The numbers of items to return, the maximum value is 250 | [optional][default to 20] | +| **search** | **String** | General order search, e.g. by mail, reference etc. | [optional] | +| **_next** | **String** | next page | [optional] | +| **previous** | **String** | previous page | [optional] | + +### Return type + +[**GetWebhooksResponse**](GetWebhooksResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## test_webhook + +> test_webhook(id, opts) + +Test Webhook + +Send a webhook.ping event + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhooksApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Test Webhook + result = api_instance.test_webhook(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->test_webhook: #{e}" +end +``` + +#### Using the test_webhook_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> test_webhook_with_http_info(id, opts) + +```ruby +begin + # Test Webhook + data, status_code, headers = api_instance.test_webhook_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->test_webhook_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**WebhookResponse**](WebhookResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + +## update_webhook + +> update_webhook(id, webhook_update_request, opts) + +Update Webhook + +updates an existing webhook + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::WebhooksApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +webhook_update_request = Conekta::WebhookUpdateRequest.new({url: 'https://webhook.site/89277eaa-a8e4-4306-8dc5-f55c80703dc8'}) # WebhookUpdateRequest | requested fields in order to update a webhook +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Update Webhook + result = api_instance.update_webhook(id, webhook_update_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->update_webhook: #{e}" +end +``` + +#### Using the update_webhook_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_webhook_with_http_info(id, webhook_update_request, opts) + +```ruby +begin + # Update Webhook + data, status_code, headers = api_instance.update_webhook_with_http_info(id, webhook_update_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling WebhooksApi->update_webhook_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **webhook_update_request** | [**WebhookUpdateRequest**](WebhookUpdateRequest.md) | requested fields in order to update a webhook | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**WebhookResponse**](WebhookResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + diff --git a/docs/WhitelistlistRuleResponse.md b/docs/WhitelistlistRuleResponse.md new file mode 100644 index 0000000..b726022 --- /dev/null +++ b/docs/WhitelistlistRuleResponse.md @@ -0,0 +1,24 @@ +# Conekta::WhitelistlistRuleResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Whitelist rule id | [optional] | +| **field** | **String** | field used for whitelists rule | [optional] | +| **value** | **String** | value used for whitelists rule | [optional] | +| **description** | **String** | use an description for whitelisted rule | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::WhitelistlistRuleResponse.new( + id: 2fw8EWJusiRrxdPzT, + field: email, + value: email@example.com, + description: banned customer example@example.com +) +``` + diff --git a/lib/conekta.rb b/lib/conekta.rb index 0bdcc53..a5613b8 100644 --- a/lib/conekta.rb +++ b/lib/conekta.rb @@ -1,102 +1,264 @@ -require "json" -require "i18n" +=begin +#Conekta API -require "conekta/version" +#Conekta sdk -require "conekta/operations/find" -require "conekta/operations/where" -require "conekta/operations/create" -require "conekta/operations/delete" -require "conekta/operations/update" -require "conekta/operations/custom_action" -require "conekta/operations/create_member" +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 -require "conekta/conekta_object" -require "conekta/list" -require "conekta/resource" -require "conekta/requestor" -require "conekta/util" -require "conekta/error" -require "conekta/error_details" +=end -require "conekta/customer_info" -require "conekta/details" -require "conekta/event" -require "conekta/charge" -require "conekta/checkout" -require "conekta/customer" -require "conekta/card" -require "conekta/discount_line" -require "conekta/log" -require "conekta/method" -require "conekta/order" -require "conekta/payment_method" -require "conekta/payee" -require "conekta/payout" -require "conekta/payout_method" -require "conekta/destination" -require "conekta/plan" -require "conekta/shipping_contact" -require "conekta/shipping_line" -require "conekta/payment_source" -require "conekta/subscription" -require "conekta/tax_line" -require "conekta/token" -require "conekta/transfer" -require "conekta/webhook" -require "conekta/webhook_log" -require "conekta/refund" -require "conekta/line_item" -require "conekta/address" +# Common files +require 'conekta/api_client' +require 'conekta/api_error' +require 'conekta/version' +require 'conekta/configuration' -module Conekta - I18n.load_path += Dir[File.join(File.expand_path('../..', __FILE__), 'locales', '*.{rb,yml}').to_s] - - @api_base = 'https://api.conekta.io' - @api_version = '2.0.0' - @locale = 'es' - - def self.config - yield self - end - - def self.plugin - @plugin - end - - def self.plugin=(plugin) - @plugin = plugin - end - - def self.api_base - @api_base - end - - def self.api_base=(api_base) - @api_base = api_base - end - - def self.api_version - @api_version - end +# Models +require 'conekta/models/api_key_create_response' +require 'conekta/models/api_key_create_response_all_of' +require 'conekta/models/api_key_request' +require 'conekta/models/api_key_response' +require 'conekta/models/api_key_response_on_delete' +require 'conekta/models/api_key_update_request' +require 'conekta/models/balance_common_field' +require 'conekta/models/balance_response' +require 'conekta/models/blacklist_rule_response' +require 'conekta/models/charge_data_payment_method_bank_transfer_response' +require 'conekta/models/charge_data_payment_method_card_response' +require 'conekta/models/charge_data_payment_method_cash_response' +require 'conekta/models/charge_order_response' +require 'conekta/models/charge_order_response_payment_method' +require 'conekta/models/charge_request' +require 'conekta/models/charge_request_payment_method' +require 'conekta/models/charge_response' +require 'conekta/models/charge_response_channel' +require 'conekta/models/charge_response_payment_method' +require 'conekta/models/charge_response_refunds' +require 'conekta/models/charge_response_refunds_all_of' +require 'conekta/models/charge_response_refunds_data' +require 'conekta/models/charges_data_response' +require 'conekta/models/checkout' +require 'conekta/models/checkout_order_template' +require 'conekta/models/checkout_order_template_customer_info' +require 'conekta/models/checkout_request' +require 'conekta/models/checkout_response' +require 'conekta/models/checkouts_response' +require 'conekta/models/checkouts_response_all_of' +require 'conekta/models/company_fiscal_info_address_response' +require 'conekta/models/company_fiscal_info_response' +require 'conekta/models/company_payout_destination_response' +require 'conekta/models/company_response' +require 'conekta/models/create_customer_fiscal_entities_response' +require 'conekta/models/create_customer_fiscal_entities_response_all_of' +require 'conekta/models/create_customer_payment_methods_request' +require 'conekta/models/create_customer_payment_methods_response' +require 'conekta/models/create_risk_rules_data' +require 'conekta/models/customer' +require 'conekta/models/customer_address' +require 'conekta/models/customer_antifraud_info' +require 'conekta/models/customer_antifraud_info_response' +require 'conekta/models/customer_fiscal_entities_data_response' +require 'conekta/models/customer_fiscal_entities_request' +require 'conekta/models/customer_fiscal_entities_request_address' +require 'conekta/models/customer_fiscal_entities_response' +require 'conekta/models/customer_fiscal_entities_response_all_of' +require 'conekta/models/customer_info' +require 'conekta/models/customer_info_just_customer_id' +require 'conekta/models/customer_info_just_customer_id_response' +require 'conekta/models/customer_info_response' +require 'conekta/models/customer_payment_method_request' +require 'conekta/models/customer_payment_methods' +require 'conekta/models/customer_payment_methods_data' +require 'conekta/models/customer_payment_methods_request' +require 'conekta/models/customer_payment_methods_response' +require 'conekta/models/customer_response' +require 'conekta/models/customer_response_shipping_contacts' +require 'conekta/models/customer_response_shipping_contacts_all_of' +require 'conekta/models/customer_shipping_contacts' +require 'conekta/models/customer_shipping_contacts_address' +require 'conekta/models/customer_shipping_contacts_data_response' +require 'conekta/models/customer_shipping_contacts_data_response_all_of' +require 'conekta/models/customer_shipping_contacts_response' +require 'conekta/models/customer_shipping_contacts_response_address' +require 'conekta/models/customer_update_fiscal_entities_request' +require 'conekta/models/customer_update_shipping_contacts' +require 'conekta/models/customers_response' +require 'conekta/models/customers_response_all_of' +require 'conekta/models/delete_api_keys_response' +require 'conekta/models/delete_api_keys_response_all_of' +require 'conekta/models/deleted_blacklist_rule_response' +require 'conekta/models/deleted_whitelist_rule_response' +require 'conekta/models/details' +require 'conekta/models/details_error' +require 'conekta/models/discount_lines_data_response' +require 'conekta/models/discount_lines_response' +require 'conekta/models/discount_lines_response_all_of' +require 'conekta/models/email_checkout_request' +require 'conekta/models/error' +require 'conekta/models/error_all_of' +require 'conekta/models/event_response' +require 'conekta/models/events_resend_response' +require 'conekta/models/get_api_keys_response' +require 'conekta/models/get_api_keys_response_all_of' +require 'conekta/models/get_charges_response' +require 'conekta/models/get_charges_response_all_of' +require 'conekta/models/get_companies_response' +require 'conekta/models/get_companies_response_all_of' +require 'conekta/models/get_customer_payment_method_data_response' +require 'conekta/models/get_events_response' +require 'conekta/models/get_events_response_all_of' +require 'conekta/models/get_order_discount_lines_response' +require 'conekta/models/get_order_discount_lines_response_all_of' +require 'conekta/models/get_orders_response' +require 'conekta/models/get_payment_method_response' +require 'conekta/models/get_payment_method_response_all_of' +require 'conekta/models/get_plans_response' +require 'conekta/models/get_plans_response_all_of' +require 'conekta/models/get_transactions_response' +require 'conekta/models/get_transactions_response_all_of' +require 'conekta/models/get_transfers_response' +require 'conekta/models/get_transfers_response_all_of' +require 'conekta/models/get_webhook_keys_response' +require 'conekta/models/get_webhook_keys_response_all_of' +require 'conekta/models/get_webhooks_response' +require 'conekta/models/get_webhooks_response_all_of' +require 'conekta/models/log_response' +require 'conekta/models/logs_response' +require 'conekta/models/logs_response_data' +require 'conekta/models/order_capture_request' +require 'conekta/models/order_discount_lines_request' +require 'conekta/models/order_refund_request' +require 'conekta/models/order_request' +require 'conekta/models/order_request_customer_info' +require 'conekta/models/order_response' +require 'conekta/models/order_response_charges' +require 'conekta/models/order_response_charges_all_of' +require 'conekta/models/order_response_checkout' +require 'conekta/models/order_response_customer_info' +require 'conekta/models/order_response_customer_info_all_of' +require 'conekta/models/order_response_discount_lines' +require 'conekta/models/order_response_discount_lines_all_of' +require 'conekta/models/order_response_fiscal_entity' +require 'conekta/models/order_response_fiscal_entity_address' +require 'conekta/models/order_response_fiscal_entity_address_all_of' +require 'conekta/models/order_response_products' +require 'conekta/models/order_response_products_all_of' +require 'conekta/models/order_response_shipping_contact' +require 'conekta/models/order_response_shipping_contact_all_of' +require 'conekta/models/order_tax_request' +require 'conekta/models/order_update_request' +require 'conekta/models/order_update_request_customer_info' +require 'conekta/models/orders_response' +require 'conekta/models/page' +require 'conekta/models/pagination' +require 'conekta/models/payment_method' +require 'conekta/models/payment_method_bank_transfer' +require 'conekta/models/payment_method_card' +require 'conekta/models/payment_method_card_request' +require 'conekta/models/payment_method_card_request_all_of' +require 'conekta/models/payment_method_card_response' +require 'conekta/models/payment_method_card_response_all_of' +require 'conekta/models/payment_method_cash' +require 'conekta/models/payment_method_cash_request' +require 'conekta/models/payment_method_cash_request_all_of' +require 'conekta/models/payment_method_cash_response' +require 'conekta/models/payment_method_cash_response_all_of' +require 'conekta/models/payment_method_response' +require 'conekta/models/payment_method_spei_recurrent' +require 'conekta/models/payment_method_spei_recurrent_all_of' +require 'conekta/models/payment_method_spei_request' +require 'conekta/models/plan_request' +require 'conekta/models/plan_response' +require 'conekta/models/plan_update_request' +require 'conekta/models/product' +require 'conekta/models/product_data_response' +require 'conekta/models/product_data_response_all_of' +require 'conekta/models/product_order_response' +require 'conekta/models/product_order_response_all_of' +require 'conekta/models/risk_rules' +require 'conekta/models/risk_rules_data' +require 'conekta/models/risk_rules_list' +require 'conekta/models/shipping_order_response' +require 'conekta/models/shipping_request' +require 'conekta/models/sms_checkout_request' +require 'conekta/models/subscription_events_response' +require 'conekta/models/subscription_request' +require 'conekta/models/subscription_response' +require 'conekta/models/subscription_update_request' +require 'conekta/models/token' +require 'conekta/models/token_card' +require 'conekta/models/token_checkout' +require 'conekta/models/token_response' +require 'conekta/models/token_response_checkout' +require 'conekta/models/transaction_response' +require 'conekta/models/transfer_destination_response' +require 'conekta/models/transfer_method_response' +require 'conekta/models/transfer_response' +require 'conekta/models/transfers_response' +require 'conekta/models/update_customer' +require 'conekta/models/update_customer_antifraud_info' +require 'conekta/models/update_customer_fiscal_entities_response' +require 'conekta/models/update_customer_fiscal_entities_response_all_of' +require 'conekta/models/update_customer_payment_methods_response' +require 'conekta/models/update_order_discount_lines_request' +require 'conekta/models/update_order_tax_request' +require 'conekta/models/update_order_tax_response' +require 'conekta/models/update_order_tax_response_all_of' +require 'conekta/models/update_payment_methods' +require 'conekta/models/update_product' +require 'conekta/models/webhook_key_create_response' +require 'conekta/models/webhook_key_delete_response' +require 'conekta/models/webhook_key_request' +require 'conekta/models/webhook_key_response' +require 'conekta/models/webhook_key_update_request' +require 'conekta/models/webhook_log' +require 'conekta/models/webhook_request' +require 'conekta/models/webhook_response' +require 'conekta/models/webhook_update_request' +require 'conekta/models/whitelistlist_rule_response' - def self.api_version=(api_version) - @api_version = api_version - end - - def self.api_key - @api_key - end +# APIs +require 'conekta/api/antifraud_api' +require 'conekta/api/api_keys_api' +require 'conekta/api/balances_api' +require 'conekta/api/charges_api' +require 'conekta/api/companies_api' +require 'conekta/api/customers_api' +require 'conekta/api/discounts_api' +require 'conekta/api/events_api' +require 'conekta/api/logs_api' +require 'conekta/api/orders_api' +require 'conekta/api/payment_link_api' +require 'conekta/api/payment_methods_api' +require 'conekta/api/plans_api' +require 'conekta/api/products_api' +require 'conekta/api/shipping_contacts_api' +require 'conekta/api/shippings_api' +require 'conekta/api/subscriptions_api' +require 'conekta/api/taxes_api' +require 'conekta/api/tokens_api' +require 'conekta/api/transactions_api' +require 'conekta/api/transfers_api' +require 'conekta/api/webhook_keys_api' +require 'conekta/api/webhooks_api' - def self.api_key=(api_key) - @api_key = api_key - end - - def self.locale - @locale - end - - def self.locale=(locale) - @locale = locale +module Conekta + class << self + # Customize default settings for the SDK using block. + # Conekta.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end end end diff --git a/lib/conekta/address.rb b/lib/conekta/address.rb deleted file mode 100644 index 20d90af..0000000 --- a/lib/conekta/address.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Conekta - class Address < Resource - attr_accessor :street1, :street2, :street3, :city, :state, :zip, :country - end -end diff --git a/lib/conekta/api/antifraud_api.rb b/lib/conekta/api/antifraud_api.rb new file mode 100644 index 0000000..c7b25be --- /dev/null +++ b/lib/conekta/api/antifraud_api.rb @@ -0,0 +1,434 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class AntifraudApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create blacklisted rule + # @param create_risk_rules_data [CreateRiskRulesData] requested field for blacklist rule + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [BlacklistRuleResponse] + def create_rule_blacklist(create_risk_rules_data, opts = {}) + data, _status_code, _headers = create_rule_blacklist_with_http_info(create_risk_rules_data, opts) + data + end + + # Create blacklisted rule + # @param create_risk_rules_data [CreateRiskRulesData] requested field for blacklist rule + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(BlacklistRuleResponse, Integer, Hash)>] BlacklistRuleResponse data, response status code and response headers + def create_rule_blacklist_with_http_info(create_risk_rules_data, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AntifraudApi.create_rule_blacklist ...' + end + # verify the required parameter 'create_risk_rules_data' is set + if @api_client.config.client_side_validation && create_risk_rules_data.nil? + fail ArgumentError, "Missing the required parameter 'create_risk_rules_data' when calling AntifraudApi.create_rule_blacklist" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/antifraud/blacklists' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_risk_rules_data) + + # return_type + return_type = opts[:debug_return_type] || 'BlacklistRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"AntifraudApi.create_rule_blacklist", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AntifraudApi#create_rule_blacklist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create whitelisted rule + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [CreateRiskRulesData] :create_risk_rules_data + # @return [WhitelistlistRuleResponse] + def create_rule_whitelist(opts = {}) + data, _status_code, _headers = create_rule_whitelist_with_http_info(opts) + data + end + + # Create whitelisted rule + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [CreateRiskRulesData] :create_risk_rules_data + # @return [Array<(WhitelistlistRuleResponse, Integer, Hash)>] WhitelistlistRuleResponse data, response status code and response headers + def create_rule_whitelist_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AntifraudApi.create_rule_whitelist ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/antifraud/whitelists' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_risk_rules_data']) + + # return_type + return_type = opts[:debug_return_type] || 'WhitelistlistRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"AntifraudApi.create_rule_whitelist", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AntifraudApi#create_rule_whitelist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete blacklisted rule + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DeletedBlacklistRuleResponse] + def delete_rule_blacklist(id, opts = {}) + data, _status_code, _headers = delete_rule_blacklist_with_http_info(id, opts) + data + end + + # Delete blacklisted rule + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(DeletedBlacklistRuleResponse, Integer, Hash)>] DeletedBlacklistRuleResponse data, response status code and response headers + def delete_rule_blacklist_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AntifraudApi.delete_rule_blacklist ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling AntifraudApi.delete_rule_blacklist" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/antifraud/blacklists/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'DeletedBlacklistRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"AntifraudApi.delete_rule_blacklist", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AntifraudApi#delete_rule_blacklist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete whitelisted rule + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DeletedWhitelistRuleResponse] + def delete_rule_whitelist(id, opts = {}) + data, _status_code, _headers = delete_rule_whitelist_with_http_info(id, opts) + data + end + + # Delete whitelisted rule + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(DeletedWhitelistRuleResponse, Integer, Hash)>] DeletedWhitelistRuleResponse data, response status code and response headers + def delete_rule_whitelist_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AntifraudApi.delete_rule_whitelist ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling AntifraudApi.delete_rule_whitelist" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/antifraud/whitelists/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'DeletedWhitelistRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"AntifraudApi.delete_rule_whitelist", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AntifraudApi#delete_rule_whitelist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get list of blacklisted rules + # Return all rules + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [RiskRulesList] + def get_rule_blacklist(opts = {}) + data, _status_code, _headers = get_rule_blacklist_with_http_info(opts) + data + end + + # Get list of blacklisted rules + # Return all rules + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(RiskRulesList, Integer, Hash)>] RiskRulesList data, response status code and response headers + def get_rule_blacklist_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AntifraudApi.get_rule_blacklist ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/antifraud/blacklists' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RiskRulesList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"AntifraudApi.get_rule_blacklist", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AntifraudApi#get_rule_blacklist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a list of whitelisted rules + # Return all rules + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [RiskRulesList] + def get_rule_whitelist(opts = {}) + data, _status_code, _headers = get_rule_whitelist_with_http_info(opts) + data + end + + # Get a list of whitelisted rules + # Return all rules + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(RiskRulesList, Integer, Hash)>] RiskRulesList data, response status code and response headers + def get_rule_whitelist_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AntifraudApi.get_rule_whitelist ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/antifraud/whitelists' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RiskRulesList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"AntifraudApi.get_rule_whitelist", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AntifraudApi#get_rule_whitelist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/api_keys_api.rb b/lib/conekta/api/api_keys_api.rb new file mode 100644 index 0000000..b9ed01b --- /dev/null +++ b/lib/conekta/api/api_keys_api.rb @@ -0,0 +1,407 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class ApiKeysApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Api Key + # Create a api key + # @param api_key_request [ApiKeyRequest] requested field for a api keys + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ApiKeyCreateResponse] + def create_api_key(api_key_request, opts = {}) + data, _status_code, _headers = create_api_key_with_http_info(api_key_request, opts) + data + end + + # Create Api Key + # Create a api key + # @param api_key_request [ApiKeyRequest] requested field for a api keys + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ApiKeyCreateResponse, Integer, Hash)>] ApiKeyCreateResponse data, response status code and response headers + def create_api_key_with_http_info(api_key_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ApiKeysApi.create_api_key ...' + end + # verify the required parameter 'api_key_request' is set + if @api_client.config.client_side_validation && api_key_request.nil? + fail ArgumentError, "Missing the required parameter 'api_key_request' when calling ApiKeysApi.create_api_key" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/api_keys' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(api_key_request) + + # return_type + return_type = opts[:debug_return_type] || 'ApiKeyCreateResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ApiKeysApi.create_api_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ApiKeysApi#create_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Api Key + # Deletes a api key that corresponds to a api key ID + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [DeleteApiKeysResponse] + def delete_api_key(id, opts = {}) + data, _status_code, _headers = delete_api_key_with_http_info(id, opts) + data + end + + # Delete Api Key + # Deletes a api key that corresponds to a api key ID + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(DeleteApiKeysResponse, Integer, Hash)>] DeleteApiKeysResponse data, response status code and response headers + def delete_api_key_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ApiKeysApi.delete_api_key ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ApiKeysApi.delete_api_key" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/api_keys/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'DeleteApiKeysResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ApiKeysApi.delete_api_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ApiKeysApi#delete_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Api Key + # Gets a api key that corresponds to a api key ID + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ApiKeyResponse] + def get_api_key(id, opts = {}) + data, _status_code, _headers = get_api_key_with_http_info(id, opts) + data + end + + # Get Api Key + # Gets a api key that corresponds to a api key ID + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ApiKeyResponse, Integer, Hash)>] ApiKeyResponse data, response status code and response headers + def get_api_key_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ApiKeysApi.get_api_key ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ApiKeysApi.get_api_key" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/api_keys/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ApiKeyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ApiKeysApi.get_api_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ApiKeysApi#get_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get list of Api Keys + # Consume the list of api keys you have + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @option opts [String] :search General search, e.g. by id, description, prefix + # @return [GetApiKeysResponse] + def get_api_keys(opts = {}) + data, _status_code, _headers = get_api_keys_with_http_info(opts) + data + end + + # Get list of Api Keys + # Consume the list of api keys you have + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @option opts [String] :search General search, e.g. by id, description, prefix + # @return [Array<(GetApiKeysResponse, Integer, Hash)>] GetApiKeysResponse data, response status code and response headers + def get_api_keys_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ApiKeysApi.get_api_keys ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ApiKeysApi.get_api_keys, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ApiKeysApi.get_api_keys, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/api_keys' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetApiKeysResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ApiKeysApi.get_api_keys", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ApiKeysApi#get_api_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Api Key + # Update an existing api key + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [ApiKeyUpdateRequest] :api_key_update_request + # @return [ApiKeyResponse] + def update_api_key(id, opts = {}) + data, _status_code, _headers = update_api_key_with_http_info(id, opts) + data + end + + # Update Api Key + # Update an existing api key + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [ApiKeyUpdateRequest] :api_key_update_request + # @return [Array<(ApiKeyResponse, Integer, Hash)>] ApiKeyResponse data, response status code and response headers + def update_api_key_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ApiKeysApi.update_api_key ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ApiKeysApi.update_api_key" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/api_keys/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'api_key_update_request']) + + # return_type + return_type = opts[:debug_return_type] || 'ApiKeyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ApiKeysApi.update_api_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ApiKeysApi#update_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/balances_api.rb b/lib/conekta/api/balances_api.rb new file mode 100644 index 0000000..b394a34 --- /dev/null +++ b/lib/conekta/api/balances_api.rb @@ -0,0 +1,86 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class BalancesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get a company's balance + # Get a company's balance + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [BalanceResponse] + def get_balance(opts = {}) + data, _status_code, _headers = get_balance_with_http_info(opts) + data + end + + # Get a company's balance + # Get a company's balance + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(BalanceResponse, Integer, Hash)>] BalanceResponse data, response status code and response headers + def get_balance_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BalancesApi.get_balance ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/balances' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'BalanceResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"BalancesApi.get_balance", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BalancesApi#get_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/charges_api.rb b/lib/conekta/api/charges_api.rb new file mode 100644 index 0000000..9371d35 --- /dev/null +++ b/lib/conekta/api/charges_api.rb @@ -0,0 +1,191 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class ChargesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get A List of Charges + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetChargesResponse] + def get_charges(opts = {}) + data, _status_code, _headers = get_charges_with_http_info(opts) + data + end + + # Get A List of Charges + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetChargesResponse, Integer, Hash)>] GetChargesResponse data, response status code and response headers + def get_charges_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChargesApi.get_charges ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ChargesApi.get_charges, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ChargesApi.get_charges, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/charges' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetChargesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ChargesApi.get_charges", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChargesApi#get_charges\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create charge + # Create charge for an existing orden + # @param id [String] Identifier of the resource + # @param charge_request [ChargeRequest] requested field for a charge + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ChargeOrderResponse] + def orders_create_charge(id, charge_request, opts = {}) + data, _status_code, _headers = orders_create_charge_with_http_info(id, charge_request, opts) + data + end + + # Create charge + # Create charge for an existing orden + # @param id [String] Identifier of the resource + # @param charge_request [ChargeRequest] requested field for a charge + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ChargeOrderResponse, Integer, Hash)>] ChargeOrderResponse data, response status code and response headers + def orders_create_charge_with_http_info(id, charge_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChargesApi.orders_create_charge ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ChargesApi.orders_create_charge" + end + # verify the required parameter 'charge_request' is set + if @api_client.config.client_side_validation && charge_request.nil? + fail ArgumentError, "Missing the required parameter 'charge_request' when calling ChargesApi.orders_create_charge" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/charges'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(charge_request) + + # return_type + return_type = opts[:debug_return_type] || 'ChargeOrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ChargesApi.orders_create_charge", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChargesApi#orders_create_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/companies_api.rb b/lib/conekta/api/companies_api.rb new file mode 100644 index 0000000..3d801df --- /dev/null +++ b/lib/conekta/api/companies_api.rb @@ -0,0 +1,174 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class CompaniesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get List of Companies + # Consume the list of child companies. This is used for holding companies with several child entities. + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetCompaniesResponse] + def get_companies(opts = {}) + data, _status_code, _headers = get_companies_with_http_info(opts) + data + end + + # Get List of Companies + # Consume the list of child companies. This is used for holding companies with several child entities. + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetCompaniesResponse, Integer, Hash)>] GetCompaniesResponse data, response status code and response headers + def get_companies_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CompaniesApi.get_companies ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CompaniesApi.get_companies, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CompaniesApi.get_companies, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/companies' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetCompaniesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"CompaniesApi.get_companies", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CompaniesApi#get_companies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Company + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [CompanyResponse] + def get_company(id, opts = {}) + data, _status_code, _headers = get_company_with_http_info(id, opts) + data + end + + # Get Company + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(CompanyResponse, Integer, Hash)>] CompanyResponse data, response status code and response headers + def get_company_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CompaniesApi.get_company ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling CompaniesApi.get_company" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/companies/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CompanyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"CompaniesApi.get_company", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CompaniesApi#get_company\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/customers_api.rb b/lib/conekta/api/customers_api.rb new file mode 100644 index 0000000..83a4d0d --- /dev/null +++ b/lib/conekta/api/customers_api.rb @@ -0,0 +1,591 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class CustomersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create customer + # The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer) + # @param customer [Customer] requested field for customer + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerResponse] + def create_customer(customer, opts = {}) + data, _status_code, _headers = create_customer_with_http_info(customer, opts) + data + end + + # Create customer + # The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer) + # @param customer [Customer] requested field for customer + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CustomerResponse, Integer, Hash)>] CustomerResponse data, response status code and response headers + def create_customer_with_http_info(customer, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CustomersApi.create_customer ...' + end + # verify the required parameter 'customer' is set + if @api_client.config.client_side_validation && customer.nil? + fail ArgumentError, "Missing the required parameter 'customer' when calling CustomersApi.create_customer" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(customer) + + # return_type + return_type = opts[:debug_return_type] || 'CustomerResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"CustomersApi.create_customer", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CustomersApi#create_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create Fiscal Entity + # Create Fiscal entity resource that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param customer_fiscal_entities_request [CustomerFiscalEntitiesRequest] requested field for customer fiscal entities + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CreateCustomerFiscalEntitiesResponse] + def create_customer_fiscal_entities(id, customer_fiscal_entities_request, opts = {}) + data, _status_code, _headers = create_customer_fiscal_entities_with_http_info(id, customer_fiscal_entities_request, opts) + data + end + + # Create Fiscal Entity + # Create Fiscal entity resource that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param customer_fiscal_entities_request [CustomerFiscalEntitiesRequest] requested field for customer fiscal entities + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CreateCustomerFiscalEntitiesResponse, Integer, Hash)>] CreateCustomerFiscalEntitiesResponse data, response status code and response headers + def create_customer_fiscal_entities_with_http_info(id, customer_fiscal_entities_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CustomersApi.create_customer_fiscal_entities ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling CustomersApi.create_customer_fiscal_entities" + end + # verify the required parameter 'customer_fiscal_entities_request' is set + if @api_client.config.client_side_validation && customer_fiscal_entities_request.nil? + fail ArgumentError, "Missing the required parameter 'customer_fiscal_entities_request' when calling CustomersApi.create_customer_fiscal_entities" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/fiscal_entities'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(customer_fiscal_entities_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateCustomerFiscalEntitiesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"CustomersApi.create_customer_fiscal_entities", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CustomersApi#create_customer_fiscal_entities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Customer + # Deleted a customer resource that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerResponse] + def delete_customer_by_id(id, opts = {}) + data, _status_code, _headers = delete_customer_by_id_with_http_info(id, opts) + data + end + + # Delete Customer + # Deleted a customer resource that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CustomerResponse, Integer, Hash)>] CustomerResponse data, response status code and response headers + def delete_customer_by_id_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CustomersApi.delete_customer_by_id ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling CustomersApi.delete_customer_by_id" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CustomerResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"CustomersApi.delete_customer_by_id", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CustomersApi#delete_customer_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Customer + # Gets a customer resource that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerResponse] + def get_customer_by_id(id, opts = {}) + data, _status_code, _headers = get_customer_by_id_with_http_info(id, opts) + data + end + + # Get Customer + # Gets a customer resource that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CustomerResponse, Integer, Hash)>] CustomerResponse data, response status code and response headers + def get_customer_by_id_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CustomersApi.get_customer_by_id ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling CustomersApi.get_customer_by_id" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CustomerResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"CustomersApi.get_customer_by_id", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CustomersApi#get_customer_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a list of customers + # The purpose of business is to create and maintain a client, you will learn what elements you need to obtain a list of clients, which can be paged. + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [CustomersResponse] + def get_customers(opts = {}) + data, _status_code, _headers = get_customers_with_http_info(opts) + data + end + + # Get a list of customers + # The purpose of business is to create and maintain a client, you will learn what elements you need to obtain a list of clients, which can be paged. + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(CustomersResponse, Integer, Hash)>] CustomersResponse data, response status code and response headers + def get_customers_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CustomersApi.get_customers, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CustomersApi.get_customers, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/customers' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CustomersResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"CustomersApi.get_customers", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CustomersApi#get_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update customer + # You can update customer-related data + # @param id [String] Identifier of the resource + # @param update_customer [UpdateCustomer] requested field for customer + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerResponse] + def update_customer(id, update_customer, opts = {}) + data, _status_code, _headers = update_customer_with_http_info(id, update_customer, opts) + data + end + + # Update customer + # You can update customer-related data + # @param id [String] Identifier of the resource + # @param update_customer [UpdateCustomer] requested field for customer + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CustomerResponse, Integer, Hash)>] CustomerResponse data, response status code and response headers + def update_customer_with_http_info(id, update_customer, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CustomersApi.update_customer ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling CustomersApi.update_customer" + end + # verify the required parameter 'update_customer' is set + if @api_client.config.client_side_validation && update_customer.nil? + fail ArgumentError, "Missing the required parameter 'update_customer' when calling CustomersApi.update_customer" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_customer) + + # return_type + return_type = opts[:debug_return_type] || 'CustomerResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"CustomersApi.update_customer", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CustomersApi#update_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Fiscal Entity + # Update Fiscal Entity resource that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param fiscal_entities_id [String] identifier + # @param customer_update_fiscal_entities_request [CustomerUpdateFiscalEntitiesRequest] requested field for customer update fiscal entities + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateCustomerFiscalEntitiesResponse] + def update_customer_fiscal_entities(id, fiscal_entities_id, customer_update_fiscal_entities_request, opts = {}) + data, _status_code, _headers = update_customer_fiscal_entities_with_http_info(id, fiscal_entities_id, customer_update_fiscal_entities_request, opts) + data + end + + # Update Fiscal Entity + # Update Fiscal Entity resource that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param fiscal_entities_id [String] identifier + # @param customer_update_fiscal_entities_request [CustomerUpdateFiscalEntitiesRequest] requested field for customer update fiscal entities + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(UpdateCustomerFiscalEntitiesResponse, Integer, Hash)>] UpdateCustomerFiscalEntitiesResponse data, response status code and response headers + def update_customer_fiscal_entities_with_http_info(id, fiscal_entities_id, customer_update_fiscal_entities_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CustomersApi.update_customer_fiscal_entities ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling CustomersApi.update_customer_fiscal_entities" + end + # verify the required parameter 'fiscal_entities_id' is set + if @api_client.config.client_side_validation && fiscal_entities_id.nil? + fail ArgumentError, "Missing the required parameter 'fiscal_entities_id' when calling CustomersApi.update_customer_fiscal_entities" + end + # verify the required parameter 'customer_update_fiscal_entities_request' is set + if @api_client.config.client_side_validation && customer_update_fiscal_entities_request.nil? + fail ArgumentError, "Missing the required parameter 'customer_update_fiscal_entities_request' when calling CustomersApi.update_customer_fiscal_entities" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/fiscal_entities/{fiscal_entities_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'fiscal_entities_id' + '}', CGI.escape(fiscal_entities_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(customer_update_fiscal_entities_request) + + # return_type + return_type = opts[:debug_return_type] || 'UpdateCustomerFiscalEntitiesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"CustomersApi.update_customer_fiscal_entities", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CustomersApi#update_customer_fiscal_entities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/discounts_api.rb b/lib/conekta/api/discounts_api.rb new file mode 100644 index 0000000..3dd0197 --- /dev/null +++ b/lib/conekta/api/discounts_api.rb @@ -0,0 +1,447 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class DiscountsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Discount + # Create discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param order_discount_lines_request [OrderDiscountLinesRequest] requested field for a discount lines + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DiscountLinesResponse] + def orders_create_discount_line(id, order_discount_lines_request, opts = {}) + data, _status_code, _headers = orders_create_discount_line_with_http_info(id, order_discount_lines_request, opts) + data + end + + # Create Discount + # Create discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param order_discount_lines_request [OrderDiscountLinesRequest] requested field for a discount lines + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(DiscountLinesResponse, Integer, Hash)>] DiscountLinesResponse data, response status code and response headers + def orders_create_discount_line_with_http_info(id, order_discount_lines_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DiscountsApi.orders_create_discount_line ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling DiscountsApi.orders_create_discount_line" + end + # verify the required parameter 'order_discount_lines_request' is set + if @api_client.config.client_side_validation && order_discount_lines_request.nil? + fail ArgumentError, "Missing the required parameter 'order_discount_lines_request' when calling DiscountsApi.orders_create_discount_line" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/discount_lines'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(order_discount_lines_request) + + # return_type + return_type = opts[:debug_return_type] || 'DiscountLinesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"DiscountsApi.orders_create_discount_line", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DiscountsApi#orders_create_discount_line\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Discount + # Delete an existing discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param discount_lines_id [String] discount line id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DiscountLinesResponse] + def orders_delete_discount_lines(id, discount_lines_id, opts = {}) + data, _status_code, _headers = orders_delete_discount_lines_with_http_info(id, discount_lines_id, opts) + data + end + + # Delete Discount + # Delete an existing discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param discount_lines_id [String] discount line id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(DiscountLinesResponse, Integer, Hash)>] DiscountLinesResponse data, response status code and response headers + def orders_delete_discount_lines_with_http_info(id, discount_lines_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DiscountsApi.orders_delete_discount_lines ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling DiscountsApi.orders_delete_discount_lines" + end + # verify the required parameter 'discount_lines_id' is set + if @api_client.config.client_side_validation && discount_lines_id.nil? + fail ArgumentError, "Missing the required parameter 'discount_lines_id' when calling DiscountsApi.orders_delete_discount_lines" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/discount_lines/{discount_lines_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'discount_lines_id' + '}', CGI.escape(discount_lines_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'DiscountLinesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"DiscountsApi.orders_delete_discount_lines", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DiscountsApi#orders_delete_discount_lines\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Discount + # Get an existing discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param discount_lines_id [String] discount line id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DiscountLinesResponse] + def orders_get_discount_line(id, discount_lines_id, opts = {}) + data, _status_code, _headers = orders_get_discount_line_with_http_info(id, discount_lines_id, opts) + data + end + + # Get Discount + # Get an existing discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param discount_lines_id [String] discount line id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(DiscountLinesResponse, Integer, Hash)>] DiscountLinesResponse data, response status code and response headers + def orders_get_discount_line_with_http_info(id, discount_lines_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DiscountsApi.orders_get_discount_line ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling DiscountsApi.orders_get_discount_line" + end + # verify the required parameter 'discount_lines_id' is set + if @api_client.config.client_side_validation && discount_lines_id.nil? + fail ArgumentError, "Missing the required parameter 'discount_lines_id' when calling DiscountsApi.orders_get_discount_line" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/discount_lines/{discount_lines_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'discount_lines_id' + '}', CGI.escape(discount_lines_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'DiscountLinesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"DiscountsApi.orders_get_discount_line", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DiscountsApi#orders_get_discount_line\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a List of Discount + # Get discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetOrderDiscountLinesResponse] + def orders_get_discount_lines(id, opts = {}) + data, _status_code, _headers = orders_get_discount_lines_with_http_info(id, opts) + data + end + + # Get a List of Discount + # Get discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetOrderDiscountLinesResponse, Integer, Hash)>] GetOrderDiscountLinesResponse data, response status code and response headers + def orders_get_discount_lines_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DiscountsApi.orders_get_discount_lines ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling DiscountsApi.orders_get_discount_lines" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DiscountsApi.orders_get_discount_lines, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DiscountsApi.orders_get_discount_lines, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/orders/{id}/discount_lines'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetOrderDiscountLinesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"DiscountsApi.orders_get_discount_lines", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DiscountsApi#orders_get_discount_lines\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Discount + # Update an existing discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param discount_lines_id [String] discount line id identifier + # @param update_order_discount_lines_request [UpdateOrderDiscountLinesRequest] requested field for a discount lines + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DiscountLinesResponse] + def orders_update_discount_lines(id, discount_lines_id, update_order_discount_lines_request, opts = {}) + data, _status_code, _headers = orders_update_discount_lines_with_http_info(id, discount_lines_id, update_order_discount_lines_request, opts) + data + end + + # Update Discount + # Update an existing discount lines for an existing orden + # @param id [String] Identifier of the resource + # @param discount_lines_id [String] discount line id identifier + # @param update_order_discount_lines_request [UpdateOrderDiscountLinesRequest] requested field for a discount lines + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(DiscountLinesResponse, Integer, Hash)>] DiscountLinesResponse data, response status code and response headers + def orders_update_discount_lines_with_http_info(id, discount_lines_id, update_order_discount_lines_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DiscountsApi.orders_update_discount_lines ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling DiscountsApi.orders_update_discount_lines" + end + # verify the required parameter 'discount_lines_id' is set + if @api_client.config.client_side_validation && discount_lines_id.nil? + fail ArgumentError, "Missing the required parameter 'discount_lines_id' when calling DiscountsApi.orders_update_discount_lines" + end + # verify the required parameter 'update_order_discount_lines_request' is set + if @api_client.config.client_side_validation && update_order_discount_lines_request.nil? + fail ArgumentError, "Missing the required parameter 'update_order_discount_lines_request' when calling DiscountsApi.orders_update_discount_lines" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/discount_lines/{discount_lines_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'discount_lines_id' + '}', CGI.escape(discount_lines_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_order_discount_lines_request) + + # return_type + return_type = opts[:debug_return_type] || 'DiscountLinesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"DiscountsApi.orders_update_discount_lines", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DiscountsApi#orders_update_discount_lines\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/events_api.rb b/lib/conekta/api/events_api.rb new file mode 100644 index 0000000..5f69d6b --- /dev/null +++ b/lib/conekta/api/events_api.rb @@ -0,0 +1,256 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class EventsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get Event + # Returns a single event + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [EventResponse] + def get_event(id, opts = {}) + data, _status_code, _headers = get_event_with_http_info(id, opts) + data + end + + # Get Event + # Returns a single event + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(EventResponse, Integer, Hash)>] EventResponse data, response status code and response headers + def get_event_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: EventsApi.get_event ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_event" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/events/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'EventResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"EventsApi.get_event", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: EventsApi#get_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get list of Events + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetEventsResponse] + def get_events(opts = {}) + data, _status_code, _headers = get_events_with_http_info(opts) + data + end + + # Get list of Events + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetEventsResponse, Integer, Hash)>] GetEventsResponse data, response status code and response headers + def get_events_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: EventsApi.get_events ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EventsApi.get_events, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EventsApi.get_events, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/events' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetEventsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"EventsApi.get_events", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: EventsApi#get_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Resend Event + # Try to send an event + # @param event_id [String] event identifier + # @param webhook_log_id [String] webhook log identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [EventsResendResponse] + def resend_event(event_id, webhook_log_id, opts = {}) + data, _status_code, _headers = resend_event_with_http_info(event_id, webhook_log_id, opts) + data + end + + # Resend Event + # Try to send an event + # @param event_id [String] event identifier + # @param webhook_log_id [String] webhook log identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(EventsResendResponse, Integer, Hash)>] EventsResendResponse data, response status code and response headers + def resend_event_with_http_info(event_id, webhook_log_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: EventsApi.resend_event ...' + end + # verify the required parameter 'event_id' is set + if @api_client.config.client_side_validation && event_id.nil? + fail ArgumentError, "Missing the required parameter 'event_id' when calling EventsApi.resend_event" + end + # verify the required parameter 'webhook_log_id' is set + if @api_client.config.client_side_validation && webhook_log_id.nil? + fail ArgumentError, "Missing the required parameter 'webhook_log_id' when calling EventsApi.resend_event" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/events/{event_id}/webhook_logs/{webhook_log_id}/resend'.sub('{' + 'event_id' + '}', CGI.escape(event_id.to_s)).sub('{' + 'webhook_log_id' + '}', CGI.escape(webhook_log_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'EventsResendResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"EventsApi.resend_event", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: EventsApi#resend_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/logs_api.rb b/lib/conekta/api/logs_api.rb new file mode 100644 index 0000000..00d2631 --- /dev/null +++ b/lib/conekta/api/logs_api.rb @@ -0,0 +1,182 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class LogsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get Log + # Get the details of a specific log + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [LogResponse] + def get_log_by_id(id, opts = {}) + data, _status_code, _headers = get_log_by_id_with_http_info(id, opts) + data + end + + # Get Log + # Get the details of a specific log + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(LogResponse, Integer, Hash)>] LogResponse data, response status code and response headers + def get_log_by_id_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsApi.get_log_by_id ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling LogsApi.get_log_by_id" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/logs/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LogResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"LogsApi.get_log_by_id", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsApi#get_log_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get List Of Logs + # Get log details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [LogsResponse] + def get_logs(opts = {}) + data, _status_code, _headers = get_logs_with_http_info(opts) + data + end + + # Get List Of Logs + # Get log details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(LogsResponse, Integer, Hash)>] LogsResponse data, response status code and response headers + def get_logs_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsApi.get_logs ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LogsApi.get_logs, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LogsApi.get_logs, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/logs' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LogsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"LogsApi.get_logs", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogsApi#get_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/orders_api.rb b/lib/conekta/api/orders_api.rb new file mode 100644 index 0000000..060d436 --- /dev/null +++ b/lib/conekta/api/orders_api.rb @@ -0,0 +1,657 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class OrdersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Cancel Order + # Cancel an order that has been previously created. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + def cancel_order(id, opts = {}) + data, _status_code, _headers = cancel_order_with_http_info(id, opts) + data + end + + # Cancel Order + # Cancel an order that has been previously created. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers + def cancel_order_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.cancel_order ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.cancel_order" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/cancel'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"OrdersApi.cancel_order", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#cancel_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create order + # Create a new order. + # @param order_request [OrderRequest] requested field for order + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + def create_order(order_request, opts = {}) + data, _status_code, _headers = create_order_with_http_info(order_request, opts) + data + end + + # Create order + # Create a new order. + # @param order_request [OrderRequest] requested field for order + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers + def create_order_with_http_info(order_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.create_order ...' + end + # verify the required parameter 'order_request' is set + if @api_client.config.client_side_validation && order_request.nil? + fail ArgumentError, "Missing the required parameter 'order_request' when calling OrdersApi.create_order" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(order_request) + + # return_type + return_type = opts[:debug_return_type] || 'OrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"OrdersApi.create_order", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#create_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Order + # Info for a specific order + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + def get_order_by_id(id, opts = {}) + data, _status_code, _headers = get_order_by_id_with_http_info(id, opts) + data + end + + # Get Order + # Info for a specific order + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers + def get_order_by_id_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.get_order_by_id ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.get_order_by_id" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"OrdersApi.get_order_by_id", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#get_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a list of Orders + # Get order details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetOrdersResponse] + def get_orders(opts = {}) + data, _status_code, _headers = get_orders_with_http_info(opts) + data + end + + # Get a list of Orders + # Get order details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetOrdersResponse, Integer, Hash)>] GetOrdersResponse data, response status code and response headers + def get_orders_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.get_orders ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrdersApi.get_orders, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrdersApi.get_orders, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/orders' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetOrdersResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"OrdersApi.get_orders", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#get_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Cancel Refund + # A refunded order describes the items, amount, and reason an order is being refunded. + # @param id [String] Identifier of the resource + # @param refund_id [String] refund identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + def order_cancel_refund(id, refund_id, opts = {}) + data, _status_code, _headers = order_cancel_refund_with_http_info(id, refund_id, opts) + data + end + + # Cancel Refund + # A refunded order describes the items, amount, and reason an order is being refunded. + # @param id [String] Identifier of the resource + # @param refund_id [String] refund identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers + def order_cancel_refund_with_http_info(id, refund_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.order_cancel_refund ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.order_cancel_refund" + end + # verify the required parameter 'refund_id' is set + if @api_client.config.client_side_validation && refund_id.nil? + fail ArgumentError, "Missing the required parameter 'refund_id' when calling OrdersApi.order_cancel_refund" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/refunds/{refund_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'refund_id' + '}', CGI.escape(refund_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"OrdersApi.order_cancel_refund", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#order_cancel_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Refund Order + # A refunded order describes the items, amount, and reason an order is being refunded. + # @param id [String] Identifier of the resource + # @param order_refund_request [OrderRefundRequest] requested field for a refund + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + def order_refund(id, order_refund_request, opts = {}) + data, _status_code, _headers = order_refund_with_http_info(id, order_refund_request, opts) + data + end + + # Refund Order + # A refunded order describes the items, amount, and reason an order is being refunded. + # @param id [String] Identifier of the resource + # @param order_refund_request [OrderRefundRequest] requested field for a refund + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers + def order_refund_with_http_info(id, order_refund_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.order_refund ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.order_refund" + end + # verify the required parameter 'order_refund_request' is set + if @api_client.config.client_side_validation && order_refund_request.nil? + fail ArgumentError, "Missing the required parameter 'order_refund_request' when calling OrdersApi.order_refund" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/refunds'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(order_refund_request) + + # return_type + return_type = opts[:debug_return_type] || 'OrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"OrdersApi.order_refund", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#order_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Capture Order + # Processes an order that has been previously authorized. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [OrderCaptureRequest] :order_capture_request requested fields for capture order + # @return [OrderResponse] + def orders_create_capture(id, opts = {}) + data, _status_code, _headers = orders_create_capture_with_http_info(id, opts) + data + end + + # Capture Order + # Processes an order that has been previously authorized. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [OrderCaptureRequest] :order_capture_request requested fields for capture order + # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers + def orders_create_capture_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.orders_create_capture ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.orders_create_capture" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/capture'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'order_capture_request']) + + # return_type + return_type = opts[:debug_return_type] || 'OrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"OrdersApi.orders_create_capture", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#orders_create_capture\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Order + # Update an existing Order. + # @param id [String] Identifier of the resource + # @param order_update_request [OrderUpdateRequest] requested field for an order + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [OrderResponse] + def update_order(id, order_update_request, opts = {}) + data, _status_code, _headers = update_order_with_http_info(id, order_update_request, opts) + data + end + + # Update Order + # Update an existing Order. + # @param id [String] Identifier of the resource + # @param order_update_request [OrderUpdateRequest] requested field for an order + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers + def update_order_with_http_info(id, order_update_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.update_order ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.update_order" + end + # verify the required parameter 'order_update_request' is set + if @api_client.config.client_side_validation && order_update_request.nil? + fail ArgumentError, "Missing the required parameter 'order_update_request' when calling OrdersApi.update_order" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(order_update_request) + + # return_type + return_type = opts[:debug_return_type] || 'OrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"OrdersApi.update_order", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#update_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/payment_link_api.rb b/lib/conekta/api/payment_link_api.rb new file mode 100644 index 0000000..68cf0ba --- /dev/null +++ b/lib/conekta/api/payment_link_api.rb @@ -0,0 +1,491 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class PaymentLinkApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Cancel Payment Link + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + def cancel_checkout(id, opts = {}) + data, _status_code, _headers = cancel_checkout_with_http_info(id, opts) + data + end + + # Cancel Payment Link + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CheckoutResponse, Integer, Hash)>] CheckoutResponse data, response status code and response headers + def cancel_checkout_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentLinkApi.cancel_checkout ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PaymentLinkApi.cancel_checkout" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/checkouts/{id}/cancel'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CheckoutResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentLinkApi.cancel_checkout", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentLinkApi#cancel_checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create Unique Payment Link + # @param checkout [Checkout] requested field for checkout + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + def create_checkout(checkout, opts = {}) + data, _status_code, _headers = create_checkout_with_http_info(checkout, opts) + data + end + + # Create Unique Payment Link + # @param checkout [Checkout] requested field for checkout + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CheckoutResponse, Integer, Hash)>] CheckoutResponse data, response status code and response headers + def create_checkout_with_http_info(checkout, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentLinkApi.create_checkout ...' + end + # verify the required parameter 'checkout' is set + if @api_client.config.client_side_validation && checkout.nil? + fail ArgumentError, "Missing the required parameter 'checkout' when calling PaymentLinkApi.create_checkout" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/checkouts' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(checkout) + + # return_type + return_type = opts[:debug_return_type] || 'CheckoutResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentLinkApi.create_checkout", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentLinkApi#create_checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Send an email + # @param id [String] Identifier of the resource + # @param email_checkout_request [EmailCheckoutRequest] requested field for sms checkout + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + def email_checkout(id, email_checkout_request, opts = {}) + data, _status_code, _headers = email_checkout_with_http_info(id, email_checkout_request, opts) + data + end + + # Send an email + # @param id [String] Identifier of the resource + # @param email_checkout_request [EmailCheckoutRequest] requested field for sms checkout + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CheckoutResponse, Integer, Hash)>] CheckoutResponse data, response status code and response headers + def email_checkout_with_http_info(id, email_checkout_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentLinkApi.email_checkout ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PaymentLinkApi.email_checkout" + end + # verify the required parameter 'email_checkout_request' is set + if @api_client.config.client_side_validation && email_checkout_request.nil? + fail ArgumentError, "Missing the required parameter 'email_checkout_request' when calling PaymentLinkApi.email_checkout" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/checkouts/{id}/email'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(email_checkout_request) + + # return_type + return_type = opts[:debug_return_type] || 'CheckoutResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentLinkApi.email_checkout", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentLinkApi#email_checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a payment link by ID + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + def get_checkout(id, opts = {}) + data, _status_code, _headers = get_checkout_with_http_info(id, opts) + data + end + + # Get a payment link by ID + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CheckoutResponse, Integer, Hash)>] CheckoutResponse data, response status code and response headers + def get_checkout_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentLinkApi.get_checkout ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PaymentLinkApi.get_checkout" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/checkouts/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CheckoutResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentLinkApi.get_checkout", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentLinkApi#get_checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a list of payment links + # Returns a list of links generated by the merchant + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [CheckoutsResponse] + def get_checkouts(opts = {}) + data, _status_code, _headers = get_checkouts_with_http_info(opts) + data + end + + # Get a list of payment links + # Returns a list of links generated by the merchant + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(CheckoutsResponse, Integer, Hash)>] CheckoutsResponse data, response status code and response headers + def get_checkouts_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentLinkApi.get_checkouts ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PaymentLinkApi.get_checkouts, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PaymentLinkApi.get_checkouts, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/checkouts' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CheckoutsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentLinkApi.get_checkouts", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentLinkApi#get_checkouts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Send an sms + # @param id [String] Identifier of the resource + # @param sms_checkout_request [SmsCheckoutRequest] requested field for sms checkout + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + def sms_checkout(id, sms_checkout_request, opts = {}) + data, _status_code, _headers = sms_checkout_with_http_info(id, sms_checkout_request, opts) + data + end + + # Send an sms + # @param id [String] Identifier of the resource + # @param sms_checkout_request [SmsCheckoutRequest] requested field for sms checkout + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CheckoutResponse, Integer, Hash)>] CheckoutResponse data, response status code and response headers + def sms_checkout_with_http_info(id, sms_checkout_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentLinkApi.sms_checkout ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PaymentLinkApi.sms_checkout" + end + # verify the required parameter 'sms_checkout_request' is set + if @api_client.config.client_side_validation && sms_checkout_request.nil? + fail ArgumentError, "Missing the required parameter 'sms_checkout_request' when calling PaymentLinkApi.sms_checkout" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/checkouts/{id}/sms'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(sms_checkout_request) + + # return_type + return_type = opts[:debug_return_type] || 'CheckoutResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentLinkApi.sms_checkout", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentLinkApi#sms_checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/payment_methods_api.rb b/lib/conekta/api/payment_methods_api.rb new file mode 100644 index 0000000..00c0243 --- /dev/null +++ b/lib/conekta/api/payment_methods_api.rb @@ -0,0 +1,368 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class PaymentMethodsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Payment Method + # Create a payment method for a customer. + # @param id [String] Identifier of the resource + # @param create_customer_payment_methods_request [CreateCustomerPaymentMethodsRequest] requested field for customer payment methods + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CreateCustomerPaymentMethodsResponse] + def create_customer_payment_methods(id, create_customer_payment_methods_request, opts = {}) + data, _status_code, _headers = create_customer_payment_methods_with_http_info(id, create_customer_payment_methods_request, opts) + data + end + + # Create Payment Method + # Create a payment method for a customer. + # @param id [String] Identifier of the resource + # @param create_customer_payment_methods_request [CreateCustomerPaymentMethodsRequest] requested field for customer payment methods + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CreateCustomerPaymentMethodsResponse, Integer, Hash)>] CreateCustomerPaymentMethodsResponse data, response status code and response headers + def create_customer_payment_methods_with_http_info(id, create_customer_payment_methods_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.create_customer_payment_methods ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PaymentMethodsApi.create_customer_payment_methods" + end + # verify the required parameter 'create_customer_payment_methods_request' is set + if @api_client.config.client_side_validation && create_customer_payment_methods_request.nil? + fail ArgumentError, "Missing the required parameter 'create_customer_payment_methods_request' when calling PaymentMethodsApi.create_customer_payment_methods" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/payment_sources'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_customer_payment_methods_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateCustomerPaymentMethodsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentMethodsApi.create_customer_payment_methods", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentMethodsApi#create_customer_payment_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Payment Method + # Delete an existing payment method + # @param id [String] Identifier of the resource + # @param payment_method_id [String] Identifier of the payment method + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateCustomerPaymentMethodsResponse] + def delete_customer_payment_methods(id, payment_method_id, opts = {}) + data, _status_code, _headers = delete_customer_payment_methods_with_http_info(id, payment_method_id, opts) + data + end + + # Delete Payment Method + # Delete an existing payment method + # @param id [String] Identifier of the resource + # @param payment_method_id [String] Identifier of the payment method + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(UpdateCustomerPaymentMethodsResponse, Integer, Hash)>] UpdateCustomerPaymentMethodsResponse data, response status code and response headers + def delete_customer_payment_methods_with_http_info(id, payment_method_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.delete_customer_payment_methods ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PaymentMethodsApi.delete_customer_payment_methods" + end + # verify the required parameter 'payment_method_id' is set + if @api_client.config.client_side_validation && payment_method_id.nil? + fail ArgumentError, "Missing the required parameter 'payment_method_id' when calling PaymentMethodsApi.delete_customer_payment_methods" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/payment_sources/{payment_method_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'payment_method_id' + '}', CGI.escape(payment_method_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'UpdateCustomerPaymentMethodsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentMethodsApi.delete_customer_payment_methods", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentMethodsApi#delete_customer_payment_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Payment Methods + # Get a list of Payment Methods + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @return [GetPaymentMethodResponse] + def get_customer_payment_methods(id, opts = {}) + data, _status_code, _headers = get_customer_payment_methods_with_http_info(id, opts) + data + end + + # Get Payment Methods + # Get a list of Payment Methods + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @return [Array<(GetPaymentMethodResponse, Integer, Hash)>] GetPaymentMethodResponse data, response status code and response headers + def get_customer_payment_methods_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.get_customer_payment_methods ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PaymentMethodsApi.get_customer_payment_methods" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PaymentMethodsApi.get_customer_payment_methods, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PaymentMethodsApi.get_customer_payment_methods, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/customers/{id}/payment_sources'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetPaymentMethodResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentMethodsApi.get_customer_payment_methods", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentMethodsApi#get_customer_payment_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Payment Method + # Gets a payment Method that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param payment_method_id [String] Identifier of the payment method + # @param update_payment_methods [UpdatePaymentMethods] requested field for customer payment methods + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateCustomerPaymentMethodsResponse] + def update_customer_payment_methods(id, payment_method_id, update_payment_methods, opts = {}) + data, _status_code, _headers = update_customer_payment_methods_with_http_info(id, payment_method_id, update_payment_methods, opts) + data + end + + # Update Payment Method + # Gets a payment Method that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param payment_method_id [String] Identifier of the payment method + # @param update_payment_methods [UpdatePaymentMethods] requested field for customer payment methods + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(UpdateCustomerPaymentMethodsResponse, Integer, Hash)>] UpdateCustomerPaymentMethodsResponse data, response status code and response headers + def update_customer_payment_methods_with_http_info(id, payment_method_id, update_payment_methods, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.update_customer_payment_methods ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PaymentMethodsApi.update_customer_payment_methods" + end + # verify the required parameter 'payment_method_id' is set + if @api_client.config.client_side_validation && payment_method_id.nil? + fail ArgumentError, "Missing the required parameter 'payment_method_id' when calling PaymentMethodsApi.update_customer_payment_methods" + end + # verify the required parameter 'update_payment_methods' is set + if @api_client.config.client_side_validation && update_payment_methods.nil? + fail ArgumentError, "Missing the required parameter 'update_payment_methods' when calling PaymentMethodsApi.update_customer_payment_methods" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/payment_sources/{payment_method_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'payment_method_id' + '}', CGI.escape(payment_method_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_payment_methods) + + # return_type + return_type = opts[:debug_return_type] || 'UpdateCustomerPaymentMethodsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PaymentMethodsApi.update_customer_payment_methods", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PaymentMethodsApi#update_customer_payment_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/plans_api.rb b/lib/conekta/api/plans_api.rb new file mode 100644 index 0000000..891bcc5 --- /dev/null +++ b/lib/conekta/api/plans_api.rb @@ -0,0 +1,406 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class PlansApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Plan + # Create a new plan for an existing order + # @param plan_request [PlanRequest] requested field for plan + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [PlanResponse] + def create_plan(plan_request, opts = {}) + data, _status_code, _headers = create_plan_with_http_info(plan_request, opts) + data + end + + # Create Plan + # Create a new plan for an existing order + # @param plan_request [PlanRequest] requested field for plan + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(PlanResponse, Integer, Hash)>] PlanResponse data, response status code and response headers + def create_plan_with_http_info(plan_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PlansApi.create_plan ...' + end + # verify the required parameter 'plan_request' is set + if @api_client.config.client_side_validation && plan_request.nil? + fail ArgumentError, "Missing the required parameter 'plan_request' when calling PlansApi.create_plan" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/plans' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(plan_request) + + # return_type + return_type = opts[:debug_return_type] || 'PlanResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PlansApi.create_plan", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PlansApi#create_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Plan + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [PlanResponse] + def delete_plan(id, opts = {}) + data, _status_code, _headers = delete_plan_with_http_info(id, opts) + data + end + + # Delete Plan + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(PlanResponse, Integer, Hash)>] PlanResponse data, response status code and response headers + def delete_plan_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PlansApi.delete_plan ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PlansApi.delete_plan" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/plans/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PlanResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PlansApi.delete_plan", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PlansApi#delete_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Plan + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [PlanResponse] + def get_plan(id, opts = {}) + data, _status_code, _headers = get_plan_with_http_info(id, opts) + data + end + + # Get Plan + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(PlanResponse, Integer, Hash)>] PlanResponse data, response status code and response headers + def get_plan_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PlansApi.get_plan ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PlansApi.get_plan" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/plans/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PlanResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PlansApi.get_plan", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PlansApi#get_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get A List of Plans + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetPlansResponse] + def get_plans(opts = {}) + data, _status_code, _headers = get_plans_with_http_info(opts) + data + end + + # Get A List of Plans + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetPlansResponse, Integer, Hash)>] GetPlansResponse data, response status code and response headers + def get_plans_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PlansApi.get_plans ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PlansApi.get_plans, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PlansApi.get_plans, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/plans' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetPlansResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PlansApi.get_plans", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PlansApi#get_plans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Plan + # @param id [String] Identifier of the resource + # @param plan_update_request [PlanUpdateRequest] requested field for plan + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [PlanResponse] + def update_plan(id, plan_update_request, opts = {}) + data, _status_code, _headers = update_plan_with_http_info(id, plan_update_request, opts) + data + end + + # Update Plan + # @param id [String] Identifier of the resource + # @param plan_update_request [PlanUpdateRequest] requested field for plan + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(PlanResponse, Integer, Hash)>] PlanResponse data, response status code and response headers + def update_plan_with_http_info(id, plan_update_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PlansApi.update_plan ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling PlansApi.update_plan" + end + # verify the required parameter 'plan_update_request' is set + if @api_client.config.client_side_validation && plan_update_request.nil? + fail ArgumentError, "Missing the required parameter 'plan_update_request' when calling PlansApi.update_plan" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/plans/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(plan_update_request) + + # return_type + return_type = opts[:debug_return_type] || 'PlanResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PlansApi.update_plan", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PlansApi#update_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/products_api.rb b/lib/conekta/api/products_api.rb new file mode 100644 index 0000000..f1484a8 --- /dev/null +++ b/lib/conekta/api/products_api.rb @@ -0,0 +1,275 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class ProductsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Product + # Create a new product for an existing order. + # @param id [String] Identifier of the resource + # @param product [Product] requested field for a product + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ProductOrderResponse] + def orders_create_product(id, product, opts = {}) + data, _status_code, _headers = orders_create_product_with_http_info(id, product, opts) + data + end + + # Create Product + # Create a new product for an existing order. + # @param id [String] Identifier of the resource + # @param product [Product] requested field for a product + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ProductOrderResponse, Integer, Hash)>] ProductOrderResponse data, response status code and response headers + def orders_create_product_with_http_info(id, product, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProductsApi.orders_create_product ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.orders_create_product" + end + # verify the required parameter 'product' is set + if @api_client.config.client_side_validation && product.nil? + fail ArgumentError, "Missing the required parameter 'product' when calling ProductsApi.orders_create_product" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/line_items'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(product) + + # return_type + return_type = opts[:debug_return_type] || 'ProductOrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ProductsApi.orders_create_product", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProductsApi#orders_create_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Product + # Delete product for an existing orden + # @param id [String] Identifier of the resource + # @param line_item_id [String] identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ProductOrderResponse] + def orders_delete_product(id, line_item_id, opts = {}) + data, _status_code, _headers = orders_delete_product_with_http_info(id, line_item_id, opts) + data + end + + # Delete Product + # Delete product for an existing orden + # @param id [String] Identifier of the resource + # @param line_item_id [String] identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ProductOrderResponse, Integer, Hash)>] ProductOrderResponse data, response status code and response headers + def orders_delete_product_with_http_info(id, line_item_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProductsApi.orders_delete_product ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.orders_delete_product" + end + # verify the required parameter 'line_item_id' is set + if @api_client.config.client_side_validation && line_item_id.nil? + fail ArgumentError, "Missing the required parameter 'line_item_id' when calling ProductsApi.orders_delete_product" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/line_items/{line_item_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'line_item_id' + '}', CGI.escape(line_item_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ProductOrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ProductsApi.orders_delete_product", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProductsApi#orders_delete_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Product + # Update an existing product for an existing orden + # @param id [String] Identifier of the resource + # @param line_item_id [String] identifier + # @param update_product [UpdateProduct] requested field for products + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ProductOrderResponse] + def orders_update_product(id, line_item_id, update_product, opts = {}) + data, _status_code, _headers = orders_update_product_with_http_info(id, line_item_id, update_product, opts) + data + end + + # Update Product + # Update an existing product for an existing orden + # @param id [String] Identifier of the resource + # @param line_item_id [String] identifier + # @param update_product [UpdateProduct] requested field for products + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ProductOrderResponse, Integer, Hash)>] ProductOrderResponse data, response status code and response headers + def orders_update_product_with_http_info(id, line_item_id, update_product, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProductsApi.orders_update_product ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.orders_update_product" + end + # verify the required parameter 'line_item_id' is set + if @api_client.config.client_side_validation && line_item_id.nil? + fail ArgumentError, "Missing the required parameter 'line_item_id' when calling ProductsApi.orders_update_product" + end + # verify the required parameter 'update_product' is set + if @api_client.config.client_side_validation && update_product.nil? + fail ArgumentError, "Missing the required parameter 'update_product' when calling ProductsApi.orders_update_product" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/line_items/{line_item_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'line_item_id' + '}', CGI.escape(line_item_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_product) + + # return_type + return_type = opts[:debug_return_type] || 'ProductOrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ProductsApi.orders_update_product", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProductsApi#orders_update_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/shipping_contacts_api.rb b/lib/conekta/api/shipping_contacts_api.rb new file mode 100644 index 0000000..756a3c2 --- /dev/null +++ b/lib/conekta/api/shipping_contacts_api.rb @@ -0,0 +1,275 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class ShippingContactsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a shipping contacts + # Create a shipping contacts for a customer. + # @param id [String] Identifier of the resource + # @param customer_shipping_contacts [CustomerShippingContacts] requested field for customer shippings contacts + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerShippingContactsResponse] + def create_customer_shipping_contacts(id, customer_shipping_contacts, opts = {}) + data, _status_code, _headers = create_customer_shipping_contacts_with_http_info(id, customer_shipping_contacts, opts) + data + end + + # Create a shipping contacts + # Create a shipping contacts for a customer. + # @param id [String] Identifier of the resource + # @param customer_shipping_contacts [CustomerShippingContacts] requested field for customer shippings contacts + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CustomerShippingContactsResponse, Integer, Hash)>] CustomerShippingContactsResponse data, response status code and response headers + def create_customer_shipping_contacts_with_http_info(id, customer_shipping_contacts, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ShippingContactsApi.create_customer_shipping_contacts ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ShippingContactsApi.create_customer_shipping_contacts" + end + # verify the required parameter 'customer_shipping_contacts' is set + if @api_client.config.client_side_validation && customer_shipping_contacts.nil? + fail ArgumentError, "Missing the required parameter 'customer_shipping_contacts' when calling ShippingContactsApi.create_customer_shipping_contacts" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/shipping_contacts'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(customer_shipping_contacts) + + # return_type + return_type = opts[:debug_return_type] || 'CustomerShippingContactsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ShippingContactsApi.create_customer_shipping_contacts", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ShippingContactsApi#create_customer_shipping_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete shipping contacts + # Delete shipping contact that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param shipping_contacts_id [String] identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerShippingContactsResponse] + def delete_customer_shipping_contacts(id, shipping_contacts_id, opts = {}) + data, _status_code, _headers = delete_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, opts) + data + end + + # Delete shipping contacts + # Delete shipping contact that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param shipping_contacts_id [String] identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CustomerShippingContactsResponse, Integer, Hash)>] CustomerShippingContactsResponse data, response status code and response headers + def delete_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ShippingContactsApi.delete_customer_shipping_contacts ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ShippingContactsApi.delete_customer_shipping_contacts" + end + # verify the required parameter 'shipping_contacts_id' is set + if @api_client.config.client_side_validation && shipping_contacts_id.nil? + fail ArgumentError, "Missing the required parameter 'shipping_contacts_id' when calling ShippingContactsApi.delete_customer_shipping_contacts" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/shipping_contacts/{shipping_contacts_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_contacts_id' + '}', CGI.escape(shipping_contacts_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CustomerShippingContactsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ShippingContactsApi.delete_customer_shipping_contacts", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ShippingContactsApi#delete_customer_shipping_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update shipping contacts + # Update shipping contact that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param shipping_contacts_id [String] identifier + # @param customer_update_shipping_contacts [CustomerUpdateShippingContacts] requested field for customer update shippings contacts + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerShippingContactsResponse] + def update_customer_shipping_contacts(id, shipping_contacts_id, customer_update_shipping_contacts, opts = {}) + data, _status_code, _headers = update_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, customer_update_shipping_contacts, opts) + data + end + + # Update shipping contacts + # Update shipping contact that corresponds to a customer ID. + # @param id [String] Identifier of the resource + # @param shipping_contacts_id [String] identifier + # @param customer_update_shipping_contacts [CustomerUpdateShippingContacts] requested field for customer update shippings contacts + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(CustomerShippingContactsResponse, Integer, Hash)>] CustomerShippingContactsResponse data, response status code and response headers + def update_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, customer_update_shipping_contacts, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ShippingContactsApi.update_customer_shipping_contacts ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ShippingContactsApi.update_customer_shipping_contacts" + end + # verify the required parameter 'shipping_contacts_id' is set + if @api_client.config.client_side_validation && shipping_contacts_id.nil? + fail ArgumentError, "Missing the required parameter 'shipping_contacts_id' when calling ShippingContactsApi.update_customer_shipping_contacts" + end + # verify the required parameter 'customer_update_shipping_contacts' is set + if @api_client.config.client_side_validation && customer_update_shipping_contacts.nil? + fail ArgumentError, "Missing the required parameter 'customer_update_shipping_contacts' when calling ShippingContactsApi.update_customer_shipping_contacts" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/shipping_contacts/{shipping_contacts_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_contacts_id' + '}', CGI.escape(shipping_contacts_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(customer_update_shipping_contacts) + + # return_type + return_type = opts[:debug_return_type] || 'CustomerShippingContactsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ShippingContactsApi.update_customer_shipping_contacts", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ShippingContactsApi#update_customer_shipping_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/shippings_api.rb b/lib/conekta/api/shippings_api.rb new file mode 100644 index 0000000..bf1c8f6 --- /dev/null +++ b/lib/conekta/api/shippings_api.rb @@ -0,0 +1,275 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class ShippingsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Shipping + # Create new shipping for an existing orden + # @param id [String] Identifier of the resource + # @param shipping_request [ShippingRequest] requested field for a shipping + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ShippingOrderResponse] + def orders_create_shipping(id, shipping_request, opts = {}) + data, _status_code, _headers = orders_create_shipping_with_http_info(id, shipping_request, opts) + data + end + + # Create Shipping + # Create new shipping for an existing orden + # @param id [String] Identifier of the resource + # @param shipping_request [ShippingRequest] requested field for a shipping + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ShippingOrderResponse, Integer, Hash)>] ShippingOrderResponse data, response status code and response headers + def orders_create_shipping_with_http_info(id, shipping_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_create_shipping ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ShippingsApi.orders_create_shipping" + end + # verify the required parameter 'shipping_request' is set + if @api_client.config.client_side_validation && shipping_request.nil? + fail ArgumentError, "Missing the required parameter 'shipping_request' when calling ShippingsApi.orders_create_shipping" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/shipping_lines'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(shipping_request) + + # return_type + return_type = opts[:debug_return_type] || 'ShippingOrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ShippingsApi.orders_create_shipping", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ShippingsApi#orders_create_shipping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Shipping + # Delete shipping + # @param id [String] Identifier of the resource + # @param shipping_id [String] identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ShippingOrderResponse] + def orders_delete_shipping(id, shipping_id, opts = {}) + data, _status_code, _headers = orders_delete_shipping_with_http_info(id, shipping_id, opts) + data + end + + # Delete Shipping + # Delete shipping + # @param id [String] Identifier of the resource + # @param shipping_id [String] identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ShippingOrderResponse, Integer, Hash)>] ShippingOrderResponse data, response status code and response headers + def orders_delete_shipping_with_http_info(id, shipping_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_delete_shipping ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ShippingsApi.orders_delete_shipping" + end + # verify the required parameter 'shipping_id' is set + if @api_client.config.client_side_validation && shipping_id.nil? + fail ArgumentError, "Missing the required parameter 'shipping_id' when calling ShippingsApi.orders_delete_shipping" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/shipping_lines/{shipping_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_id' + '}', CGI.escape(shipping_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ShippingOrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ShippingsApi.orders_delete_shipping", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ShippingsApi#orders_delete_shipping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Shipping + # Update existing shipping for an existing orden + # @param id [String] Identifier of the resource + # @param shipping_id [String] identifier + # @param shipping_request [ShippingRequest] requested field for a shipping + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ShippingOrderResponse] + def orders_update_shipping(id, shipping_id, shipping_request, opts = {}) + data, _status_code, _headers = orders_update_shipping_with_http_info(id, shipping_id, shipping_request, opts) + data + end + + # Update Shipping + # Update existing shipping for an existing orden + # @param id [String] Identifier of the resource + # @param shipping_id [String] identifier + # @param shipping_request [ShippingRequest] requested field for a shipping + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ShippingOrderResponse, Integer, Hash)>] ShippingOrderResponse data, response status code and response headers + def orders_update_shipping_with_http_info(id, shipping_id, shipping_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ShippingsApi.orders_update_shipping ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ShippingsApi.orders_update_shipping" + end + # verify the required parameter 'shipping_id' is set + if @api_client.config.client_side_validation && shipping_id.nil? + fail ArgumentError, "Missing the required parameter 'shipping_id' when calling ShippingsApi.orders_update_shipping" + end + # verify the required parameter 'shipping_request' is set + if @api_client.config.client_side_validation && shipping_request.nil? + fail ArgumentError, "Missing the required parameter 'shipping_request' when calling ShippingsApi.orders_update_shipping" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/shipping_lines/{shipping_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_id' + '}', CGI.escape(shipping_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(shipping_request) + + # return_type + return_type = opts[:debug_return_type] || 'ShippingOrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ShippingsApi.orders_update_shipping", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ShippingsApi#orders_update_shipping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/subscriptions_api.rb b/lib/conekta/api/subscriptions_api.rb new file mode 100644 index 0000000..869fca8 --- /dev/null +++ b/lib/conekta/api/subscriptions_api.rb @@ -0,0 +1,550 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class SubscriptionsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Cancel Subscription + # You can cancel the subscription to stop the plans that your customers consume + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + def cancel_subscription(id, opts = {}) + data, _status_code, _headers = cancel_subscription_with_http_info(id, opts) + data + end + + # Cancel Subscription + # You can cancel the subscription to stop the plans that your customers consume + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(SubscriptionResponse, Integer, Hash)>] SubscriptionResponse data, response status code and response headers + def cancel_subscription_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SubscriptionsApi.cancel_subscription ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling SubscriptionsApi.cancel_subscription" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/subscription/cancel'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SubscriptionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"SubscriptionsApi.cancel_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SubscriptionsApi#cancel_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create Subscription + # You can create the subscription to include the plans that your customers consume + # @param id [String] Identifier of the resource + # @param subscription_request [SubscriptionRequest] requested field for subscriptions + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + def create_subscription(id, subscription_request, opts = {}) + data, _status_code, _headers = create_subscription_with_http_info(id, subscription_request, opts) + data + end + + # Create Subscription + # You can create the subscription to include the plans that your customers consume + # @param id [String] Identifier of the resource + # @param subscription_request [SubscriptionRequest] requested field for subscriptions + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(SubscriptionResponse, Integer, Hash)>] SubscriptionResponse data, response status code and response headers + def create_subscription_with_http_info(id, subscription_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SubscriptionsApi.create_subscription ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling SubscriptionsApi.create_subscription" + end + # verify the required parameter 'subscription_request' is set + if @api_client.config.client_side_validation && subscription_request.nil? + fail ArgumentError, "Missing the required parameter 'subscription_request' when calling SubscriptionsApi.create_subscription" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/subscription'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(subscription_request) + + # return_type + return_type = opts[:debug_return_type] || 'SubscriptionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"SubscriptionsApi.create_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SubscriptionsApi#create_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Events By Subscription + # You can get the events of the subscription(s) of a client, with the customer id + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionEventsResponse] + def get_all_events_from_subscription(id, opts = {}) + data, _status_code, _headers = get_all_events_from_subscription_with_http_info(id, opts) + data + end + + # Get Events By Subscription + # You can get the events of the subscription(s) of a client, with the customer id + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(SubscriptionEventsResponse, Integer, Hash)>] SubscriptionEventsResponse data, response status code and response headers + def get_all_events_from_subscription_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SubscriptionsApi.get_all_events_from_subscription ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling SubscriptionsApi.get_all_events_from_subscription" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/subscription/events'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SubscriptionEventsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"SubscriptionsApi.get_all_events_from_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SubscriptionsApi#get_all_events_from_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Subscription + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [SubscriptionResponse] + def get_subscription(id, opts = {}) + data, _status_code, _headers = get_subscription_with_http_info(id, opts) + data + end + + # Get Subscription + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(SubscriptionResponse, Integer, Hash)>] SubscriptionResponse data, response status code and response headers + def get_subscription_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SubscriptionsApi.get_subscription ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling SubscriptionsApi.get_subscription" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/subscription'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SubscriptionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"SubscriptionsApi.get_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SubscriptionsApi#get_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Pause Subscription + # You can pause the subscription to stop the plans that your customers consume + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + def pause_subscription(id, opts = {}) + data, _status_code, _headers = pause_subscription_with_http_info(id, opts) + data + end + + # Pause Subscription + # You can pause the subscription to stop the plans that your customers consume + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(SubscriptionResponse, Integer, Hash)>] SubscriptionResponse data, response status code and response headers + def pause_subscription_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SubscriptionsApi.pause_subscription ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling SubscriptionsApi.pause_subscription" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/subscription/pause'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SubscriptionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"SubscriptionsApi.pause_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SubscriptionsApi#pause_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Resume Subscription + # You can resume the subscription to start the plans that your customers consume + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + def resume_subscription(id, opts = {}) + data, _status_code, _headers = resume_subscription_with_http_info(id, opts) + data + end + + # Resume Subscription + # You can resume the subscription to start the plans that your customers consume + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(SubscriptionResponse, Integer, Hash)>] SubscriptionResponse data, response status code and response headers + def resume_subscription_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SubscriptionsApi.resume_subscription ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling SubscriptionsApi.resume_subscription" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/subscription/resume'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SubscriptionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"SubscriptionsApi.resume_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SubscriptionsApi#resume_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Subscription + # You can modify the subscription to change the plans that your customers consume + # @param id [String] Identifier of the resource + # @param subscription_update_request [SubscriptionUpdateRequest] requested field for update a subscription + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + def update_subscription(id, subscription_update_request, opts = {}) + data, _status_code, _headers = update_subscription_with_http_info(id, subscription_update_request, opts) + data + end + + # Update Subscription + # You can modify the subscription to change the plans that your customers consume + # @param id [String] Identifier of the resource + # @param subscription_update_request [SubscriptionUpdateRequest] requested field for update a subscription + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(SubscriptionResponse, Integer, Hash)>] SubscriptionResponse data, response status code and response headers + def update_subscription_with_http_info(id, subscription_update_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SubscriptionsApi.update_subscription ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling SubscriptionsApi.update_subscription" + end + # verify the required parameter 'subscription_update_request' is set + if @api_client.config.client_side_validation && subscription_update_request.nil? + fail ArgumentError, "Missing the required parameter 'subscription_update_request' when calling SubscriptionsApi.update_subscription" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/customers/{id}/subscription'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(subscription_update_request) + + # return_type + return_type = opts[:debug_return_type] || 'SubscriptionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"SubscriptionsApi.update_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SubscriptionsApi#update_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/taxes_api.rb b/lib/conekta/api/taxes_api.rb new file mode 100644 index 0000000..2ab73be --- /dev/null +++ b/lib/conekta/api/taxes_api.rb @@ -0,0 +1,275 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class TaxesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Tax + # Create new taxes for an existing orden + # @param id [String] Identifier of the resource + # @param order_tax_request [OrderTaxRequest] requested field for a taxes + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateOrderTaxResponse] + def orders_create_taxes(id, order_tax_request, opts = {}) + data, _status_code, _headers = orders_create_taxes_with_http_info(id, order_tax_request, opts) + data + end + + # Create Tax + # Create new taxes for an existing orden + # @param id [String] Identifier of the resource + # @param order_tax_request [OrderTaxRequest] requested field for a taxes + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(UpdateOrderTaxResponse, Integer, Hash)>] UpdateOrderTaxResponse data, response status code and response headers + def orders_create_taxes_with_http_info(id, order_tax_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TaxesApi.orders_create_taxes ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling TaxesApi.orders_create_taxes" + end + # verify the required parameter 'order_tax_request' is set + if @api_client.config.client_side_validation && order_tax_request.nil? + fail ArgumentError, "Missing the required parameter 'order_tax_request' when calling TaxesApi.orders_create_taxes" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/tax_lines'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(order_tax_request) + + # return_type + return_type = opts[:debug_return_type] || 'UpdateOrderTaxResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"TaxesApi.orders_create_taxes", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TaxesApi#orders_create_taxes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Tax + # Delete taxes for an existing orden + # @param id [String] Identifier of the resource + # @param tax_id [String] identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateOrderTaxResponse] + def orders_delete_taxes(id, tax_id, opts = {}) + data, _status_code, _headers = orders_delete_taxes_with_http_info(id, tax_id, opts) + data + end + + # Delete Tax + # Delete taxes for an existing orden + # @param id [String] Identifier of the resource + # @param tax_id [String] identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(UpdateOrderTaxResponse, Integer, Hash)>] UpdateOrderTaxResponse data, response status code and response headers + def orders_delete_taxes_with_http_info(id, tax_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TaxesApi.orders_delete_taxes ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling TaxesApi.orders_delete_taxes" + end + # verify the required parameter 'tax_id' is set + if @api_client.config.client_side_validation && tax_id.nil? + fail ArgumentError, "Missing the required parameter 'tax_id' when calling TaxesApi.orders_delete_taxes" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/tax_lines/{tax_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'tax_id' + '}', CGI.escape(tax_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'UpdateOrderTaxResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"TaxesApi.orders_delete_taxes", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TaxesApi#orders_delete_taxes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Tax + # Update taxes for an existing orden + # @param id [String] Identifier of the resource + # @param tax_id [String] identifier + # @param update_order_tax_request [UpdateOrderTaxRequest] requested field for taxes + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateOrderTaxResponse] + def orders_update_taxes(id, tax_id, update_order_tax_request, opts = {}) + data, _status_code, _headers = orders_update_taxes_with_http_info(id, tax_id, update_order_tax_request, opts) + data + end + + # Update Tax + # Update taxes for an existing orden + # @param id [String] Identifier of the resource + # @param tax_id [String] identifier + # @param update_order_tax_request [UpdateOrderTaxRequest] requested field for taxes + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(UpdateOrderTaxResponse, Integer, Hash)>] UpdateOrderTaxResponse data, response status code and response headers + def orders_update_taxes_with_http_info(id, tax_id, update_order_tax_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TaxesApi.orders_update_taxes ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling TaxesApi.orders_update_taxes" + end + # verify the required parameter 'tax_id' is set + if @api_client.config.client_side_validation && tax_id.nil? + fail ArgumentError, "Missing the required parameter 'tax_id' when calling TaxesApi.orders_update_taxes" + end + # verify the required parameter 'update_order_tax_request' is set + if @api_client.config.client_side_validation && update_order_tax_request.nil? + fail ArgumentError, "Missing the required parameter 'update_order_tax_request' when calling TaxesApi.orders_update_taxes" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/tax_lines/{tax_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'tax_id' + '}', CGI.escape(tax_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_order_tax_request) + + # return_type + return_type = opts[:debug_return_type] || 'UpdateOrderTaxResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"TaxesApi.orders_update_taxes", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TaxesApi#orders_update_taxes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/tokens_api.rb b/lib/conekta/api/tokens_api.rb new file mode 100644 index 0000000..909713a --- /dev/null +++ b/lib/conekta/api/tokens_api.rb @@ -0,0 +1,97 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class TokensApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Token + # Generate a payment token, to associate it with a card + # @param token [Token] requested field for token + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [TokenResponse] + def create_token(token, opts = {}) + data, _status_code, _headers = create_token_with_http_info(token, opts) + data + end + + # Create Token + # Generate a payment token, to associate it with a card + # @param token [Token] requested field for token + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(TokenResponse, Integer, Hash)>] TokenResponse data, response status code and response headers + def create_token_with_http_info(token, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TokensApi.create_token ...' + end + # verify the required parameter 'token' is set + if @api_client.config.client_side_validation && token.nil? + fail ArgumentError, "Missing the required parameter 'token' when calling TokensApi.create_token" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/tokens' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(token) + + # return_type + return_type = opts[:debug_return_type] || 'TokenResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"TokensApi.create_token", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TokensApi#create_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/transactions_api.rb b/lib/conekta/api/transactions_api.rb new file mode 100644 index 0000000..52e8be8 --- /dev/null +++ b/lib/conekta/api/transactions_api.rb @@ -0,0 +1,182 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class TransactionsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get transaction + # Get the details of a transaction + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [TransactionResponse] + def get_transaction(id, opts = {}) + data, _status_code, _headers = get_transaction_with_http_info(id, opts) + data + end + + # Get transaction + # Get the details of a transaction + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(TransactionResponse, Integer, Hash)>] TransactionResponse data, response status code and response headers + def get_transaction_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transaction ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling TransactionsApi.get_transaction" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/transactions/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TransactionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"TransactionsApi.get_transaction", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get List transactions + # Get transaction details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetTransactionsResponse] + def get_transactions(opts = {}) + data, _status_code, _headers = get_transactions_with_http_info(opts) + data + end + + # Get List transactions + # Get transaction details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetTransactionsResponse, Integer, Hash)>] GetTransactionsResponse data, response status code and response headers + def get_transactions_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TransactionsApi.get_transactions, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TransactionsApi.get_transactions, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/transactions' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetTransactionsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"TransactionsApi.get_transactions", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/transfers_api.rb b/lib/conekta/api/transfers_api.rb new file mode 100644 index 0000000..9f29bd5 --- /dev/null +++ b/lib/conekta/api/transfers_api.rb @@ -0,0 +1,182 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class TransfersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get Transfer + # Get the details of a Transfer + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [TransferResponse] + def get_transfer(id, opts = {}) + data, _status_code, _headers = get_transfer_with_http_info(id, opts) + data + end + + # Get Transfer + # Get the details of a Transfer + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(TransferResponse, Integer, Hash)>] TransferResponse data, response status code and response headers + def get_transfer_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TransfersApi.get_transfer ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling TransfersApi.get_transfer" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/transfers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TransferResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"TransfersApi.get_transfer", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransfersApi#get_transfer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a list of transfers + # Get transfers details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetTransfersResponse] + def get_transfers(opts = {}) + data, _status_code, _headers = get_transfers_with_http_info(opts) + data + end + + # Get a list of transfers + # Get transfers details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetTransfersResponse, Integer, Hash)>] GetTransfersResponse data, response status code and response headers + def get_transfers_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TransfersApi.get_transfers ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TransfersApi.get_transfers, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TransfersApi.get_transfers, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/transfers' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetTransfersResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"TransfersApi.get_transfers", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransfersApi#get_transfers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/webhook_keys_api.rb b/lib/conekta/api/webhook_keys_api.rb new file mode 100644 index 0000000..436138d --- /dev/null +++ b/lib/conekta/api/webhook_keys_api.rb @@ -0,0 +1,396 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class WebhookKeysApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Webhook Key + # Create a webhook key + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [WebhookKeyRequest] :webhook_key_request + # @return [WebhookKeyCreateResponse] + def create_webhook_key(opts = {}) + data, _status_code, _headers = create_webhook_key_with_http_info(opts) + data + end + + # Create Webhook Key + # Create a webhook key + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [WebhookKeyRequest] :webhook_key_request + # @return [Array<(WebhookKeyCreateResponse, Integer, Hash)>] WebhookKeyCreateResponse data, response status code and response headers + def create_webhook_key_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhookKeysApi.create_webhook_key ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/webhook_keys' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'webhook_key_request']) + + # return_type + return_type = opts[:debug_return_type] || 'WebhookKeyCreateResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhookKeysApi.create_webhook_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhookKeysApi#create_webhook_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Webhook key + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [WebhookKeyDeleteResponse] + def delete_webhook_key(id, opts = {}) + data, _status_code, _headers = delete_webhook_key_with_http_info(id, opts) + data + end + + # Delete Webhook key + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(WebhookKeyDeleteResponse, Integer, Hash)>] WebhookKeyDeleteResponse data, response status code and response headers + def delete_webhook_key_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhookKeysApi.delete_webhook_key ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhookKeysApi.delete_webhook_key" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/webhook_keys/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WebhookKeyDeleteResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhookKeysApi.delete_webhook_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhookKeysApi#delete_webhook_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Webhook Key + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [WebhookKeyResponse] + def get_webhook_key(id, opts = {}) + data, _status_code, _headers = get_webhook_key_with_http_info(id, opts) + data + end + + # Get Webhook Key + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(WebhookKeyResponse, Integer, Hash)>] WebhookKeyResponse data, response status code and response headers + def get_webhook_key_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhookKeysApi.get_webhook_key ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhookKeysApi.get_webhook_key" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/webhook_keys/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WebhookKeyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhookKeysApi.get_webhook_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhookKeysApi#get_webhook_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get List of Webhook Keys + # Consume the list of webhook keys you have + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetWebhookKeysResponse] + def get_webhook_keys(opts = {}) + data, _status_code, _headers = get_webhook_keys_with_http_info(opts) + data + end + + # Get List of Webhook Keys + # Consume the list of webhook keys you have + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetWebhookKeysResponse, Integer, Hash)>] GetWebhookKeysResponse data, response status code and response headers + def get_webhook_keys_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhookKeysApi.get_webhook_keys ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhookKeysApi.get_webhook_keys, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhookKeysApi.get_webhook_keys, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/webhook_keys' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetWebhookKeysResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhookKeysApi.get_webhook_keys", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhookKeysApi#get_webhook_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Webhook Key + # updates an existing webhook key + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [WebhookKeyUpdateRequest] :webhook_key_update_request + # @return [WebhookKeyResponse] + def update_webhook_key(id, opts = {}) + data, _status_code, _headers = update_webhook_key_with_http_info(id, opts) + data + end + + # Update Webhook Key + # updates an existing webhook key + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [WebhookKeyUpdateRequest] :webhook_key_update_request + # @return [Array<(WebhookKeyResponse, Integer, Hash)>] WebhookKeyResponse data, response status code and response headers + def update_webhook_key_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhookKeysApi.update_webhook_key ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhookKeysApi.update_webhook_key" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/webhook_keys/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'webhook_key_update_request']) + + # return_type + return_type = opts[:debug_return_type] || 'WebhookKeyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhookKeysApi.update_webhook_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhookKeysApi#update_webhook_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api/webhooks_api.rb b/lib/conekta/api/webhooks_api.rb new file mode 100644 index 0000000..c576a1f --- /dev/null +++ b/lib/conekta/api/webhooks_api.rb @@ -0,0 +1,477 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'cgi' + +module Conekta + class WebhooksApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Webhook + # What we do at Conekta translates into events. For example, an event of interest to us occurs at the time a payment is successfully processed. At that moment we will be interested in doing several things: Send an email to the buyer, generate an invoice, start the process of shipping the product, etc. + # @param webhook_request [WebhookRequest] requested field for webhook + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [WebhookResponse] + def create_webhook(webhook_request, opts = {}) + data, _status_code, _headers = create_webhook_with_http_info(webhook_request, opts) + data + end + + # Create Webhook + # What we do at Conekta translates into events. For example, an event of interest to us occurs at the time a payment is successfully processed. At that moment we will be interested in doing several things: Send an email to the buyer, generate an invoice, start the process of shipping the product, etc. + # @param webhook_request [WebhookRequest] requested field for webhook + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(WebhookResponse, Integer, Hash)>] WebhookResponse data, response status code and response headers + def create_webhook_with_http_info(webhook_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.create_webhook ...' + end + # verify the required parameter 'webhook_request' is set + if @api_client.config.client_side_validation && webhook_request.nil? + fail ArgumentError, "Missing the required parameter 'webhook_request' when calling WebhooksApi.create_webhook" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/webhooks' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_request) + + # return_type + return_type = opts[:debug_return_type] || 'WebhookResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhooksApi.create_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Webhook + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [WebhookResponse] + def delete_webhook(id, opts = {}) + data, _status_code, _headers = delete_webhook_with_http_info(id, opts) + data + end + + # Delete Webhook + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(WebhookResponse, Integer, Hash)>] WebhookResponse data, response status code and response headers + def delete_webhook_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.delete_webhook" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WebhookResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhooksApi.delete_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Webhook + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [WebhookResponse] + def get_webhook(id, opts = {}) + data, _status_code, _headers = get_webhook_with_http_info(id, opts) + data + end + + # Get Webhook + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(WebhookResponse, Integer, Hash)>] WebhookResponse data, response status code and response headers + def get_webhook_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.get_webhook" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WebhookResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhooksApi.get_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get List of Webhooks + # Consume the list of webhooks you have, each environment supports 10 webhooks (For production and testing) + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetWebhooksResponse] + def get_webhooks(opts = {}) + data, _status_code, _headers = get_webhooks_with_http_info(opts) + data + end + + # Get List of Webhooks + # Consume the list of webhooks you have, each environment supports 10 webhooks (For production and testing) + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 (default to 20) + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [Array<(GetWebhooksResponse, Integer, Hash)>] GetWebhooksResponse data, response status code and response headers + def get_webhooks_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhooks ...' + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhooksApi.get_webhooks, must be smaller than or equal to 250.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhooksApi.get_webhooks, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/webhooks' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? + query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? + query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetWebhooksResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhooksApi.get_webhooks", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#get_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test Webhook + # Send a webhook.ping event + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [WebhookResponse] + def test_webhook(id, opts = {}) + data, _status_code, _headers = test_webhook_with_http_info(id, opts) + data + end + + # Test Webhook + # Send a webhook.ping event + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(WebhookResponse, Integer, Hash)>] WebhookResponse data, response status code and response headers + def test_webhook_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.test_webhook ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.test_webhook" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/webhooks/{id}/test'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WebhookResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhooksApi.test_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#test_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Webhook + # updates an existing webhook + # @param id [String] Identifier of the resource + # @param webhook_update_request [WebhookUpdateRequest] requested fields in order to update a webhook + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [WebhookResponse] + def update_webhook(id, webhook_update_request, opts = {}) + data, _status_code, _headers = update_webhook_with_http_info(id, webhook_update_request, opts) + data + end + + # Update Webhook + # updates an existing webhook + # @param id [String] Identifier of the resource + # @param webhook_update_request [WebhookUpdateRequest] requested fields in order to update a webhook + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(WebhookResponse, Integer, Hash)>] WebhookResponse data, response status code and response headers + def update_webhook_with_http_info(id, webhook_update_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.update_webhook ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.update_webhook" + end + # verify the required parameter 'webhook_update_request' is set + if @api_client.config.client_side_validation && webhook_update_request.nil? + fail ArgumentError, "Missing the required parameter 'webhook_update_request' when calling WebhooksApi.update_webhook" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_update_request) + + # return_type + return_type = opts[:debug_return_type] || 'WebhookResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"WebhooksApi.update_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/conekta/api_client.rb b/lib/conekta/api_client.rb new file mode 100644 index 0000000..064fec9 --- /dev/null +++ b/lib/conekta/api_client.rb @@ -0,0 +1,439 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'faraday' +require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') + +module Conekta + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "Conekta/v2 RubyBindings/#{Conekta::VERSION}" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent, + 'X-Conekta-Client-User-Agent' => conekta_headers.to_json + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + begin + response = connection(opts).public_send(http_method.to_sym.downcase) do |req| + build_request(http_method, path, req, opts) + end + + if config.debugging + config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.status == 0 && response.respond_to?(:return_message) + # Errors from libcurl will be made visible here + fail ApiError.new(code: 0, + message: response.return_message) + else + fail ApiError.new(code: response.status, + response_headers: response.headers, + response_body: response.body), + response.reason_phrase + end + end + rescue Faraday::TimeoutError + fail ApiError.new('Connection timed out') + rescue Faraday::ConnectionFailed + fail ApiError.new('Connection failed') + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.status, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Faraday::Request] A Faraday Request + def build_request(http_method, path, request, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + if config.debugging + config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + request.headers = header_params + request.body = req_body + + # Overload default options only if provided + request.options.params_encoder = config.params_encoder if config.params_encoder + request.options.timeout = config.timeout if config.timeout + + request.url url + request.params = query_params + download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' + data = URI.encode_www_form(form_params) + elsif header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Tempfile + # TODO hardcode to application/octet-stream, need better way to detect content type + data[key] = Faraday::FilePart.new(value.path, 'application/octet-stream', value.path) + when ::Array, nil + # let Faraday handle Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + def download_file(request) + @stream = [] + + # handle streaming Responses + request.options.on_data = Proc.new do |chunk, overall_received_bytes| + @stream << chunk + end + end + + def connection(opts) + opts[:header_params]['Content-Type'] == 'multipart/form-data' ? connection_multipart : connection_regular + end + + def connection_multipart + @connection_multipart ||= build_connection do |conn| + conn.request :multipart + conn.request :url_encoded + end + end + + def connection_regular + @connection_regular ||= build_connection + end + + def build_connection + Faraday.new(url: config.base_url, ssl: ssl_options, proxy: config.proxy) do |conn| + basic_auth(conn) + config.configure_middleware(conn) + yield(conn) if block_given? + conn.adapter(Faraday.default_adapter) + config.configure_connection(conn) + end + end + + def ssl_options + { + ca_file: config.ssl_ca_file, + verify: config.ssl_verify, + verify_mode: config.ssl_verify_mode, + client_cert: config.ssl_client_cert, + client_key: config.ssl_client_key + } + end + + def basic_auth(conn) + if config.username && config.password + if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') + conn.request(:authorization, :basic, config.username, config.password) + else + conn.request(:basic_auth, config.username, config.password) + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + if return_type == 'File' + if @config.return_binary_data == true + # return byte stream + encoding = body.encoding + return @stream.join.force_encoding(encoding) + else + # return file instead of binary data + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = body.encoding + @tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile.write(@stream.join.force_encoding(encoding)) + @tempfile.close + @config.logger.info "Temp file written to #{@tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + return @tempfile + end + end + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + def conekta_headers + params = { + bindings_version: Conekta::VERSION, + lang: 'ruby', + lang_version: RUBY_VERSION, + publisher: 'conekta' + } + + @conekta_headers ||= params + end + end +end diff --git a/lib/conekta/api_error.rb b/lib/conekta/api_error.rb new file mode 100644 index 0000000..26376b7 --- /dev/null +++ b/lib/conekta/api_error.rb @@ -0,0 +1,58 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +module Conekta + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/conekta/card.rb b/lib/conekta/card.rb deleted file mode 100644 index 5c6b7d1..0000000 --- a/lib/conekta/card.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Conekta - class Card < Resource - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - attr_accessor :created_at, :last4, :bin, :name, - :exp_month, :exp_year, :brand, - :parent_id, :default - - def _url - ensure_id - - self.customer._url + self.class._url + "/" + id - end - - def delete - self.delete_member('customer','cards') - end - end -end diff --git a/lib/conekta/charge.rb b/lib/conekta/charge.rb deleted file mode 100644 index 991a834..0000000 --- a/lib/conekta/charge.rb +++ /dev/null @@ -1,25 +0,0 @@ -module Conekta - class Charge < Resource - include Conekta::Operations::Find - include Conekta::Operations::Where - include Conekta::Operations::Create - include Conekta::Operations::CustomAction - - attr_accessor :livemode, :amount, :created_at, :currency, :description, - :reference_id, :failure_code, :failure_message, :fee, - :monthly_installments, :device_fingerprint, :status, - :exchange_rate, :foreign_currency, :amount_in_foreign_currency, - :checkout_id, :checkout_order_count - - # Usage: charge_reference.capture(2000) - def capture(capture_amount=nil) - params = { 'amount' => (capture_amount || self.amount) } - custom_action(:post, 'capture', params) - end - - def refund(params=nil) - params = { 'amount' => (params || self.amount) } - custom_action(:post, 'refund', params) - end - end -end diff --git a/lib/conekta/checkout.rb b/lib/conekta/checkout.rb deleted file mode 100644 index 7787c47..0000000 --- a/lib/conekta/checkout.rb +++ /dev/null @@ -1,35 +0,0 @@ -module Conekta - class Checkout < Resource - include Conekta::Operations::Create - include Conekta::Operations::Where - include Conekta::Operations::Find - include Conekta::Operations::CustomAction - - attr_accessor :_id, :livemode, :company_id, :entity_id, :emails_sent, - :sms_sent, :name, :slug, :status, :url, - :type, :recurrent, :is_redirect_on_failure, - :payments_limit_count, :paid_payments_count, - :expires_at, :allowed_payment_methods, - :needs_shipping_contact, :monthly_installments_options, - :monthly_installments_enabled, - :returns_control_on, :on_demand_enabled - - def _url - ensure_id - - "/checkouts/#{id}" - end - - def send_sms(params = {}) - custom_action(:post, "sms", params) - end - - def send_email(params = {}) - custom_action(:post, "email", params) - end - - def cancel(params = {}) - custom_action(:put, "cancel", params) - end - end -end diff --git a/lib/conekta/conekta_object.rb b/lib/conekta/conekta_object.rb deleted file mode 100644 index f377dfa..0000000 --- a/lib/conekta/conekta_object.rb +++ /dev/null @@ -1,109 +0,0 @@ -module Conekta - class ConektaObject < Hash - attr_reader :values - - def initialize - @values = Hash.new - end - - def set_val(k,v) - @values ||= {} - @values[k] = v - self[k] = v - end - - def unset_key(k) - @values.delete(k) - self.delete(k) - end - - def first - self[0] - end - - def last - self[self.keys.last] - end - - def load_from(response) - if response.instance_of?(Array) - response.each_with_index do |v, i| - load_from_enumerable(i,v) - end - elsif response.kind_of?(Hash) - response = response.to_hash if response.class != Hash - response.each do |k,v| - load_from_enumerable(k,v) - end - end - end - - def to_s - @values.inspect - end - - def inspect - if self.respond_to? :each - if self.class.class_name != "ConektaObject" - self.to_s - else - self.to_a.map{|x| x[1] } - end - else - super - end - end - - def self.class_name - self.name.split('::')[-1] - end - - def class_name - self.class.name.split('::')[-1] - end - - def create_attr(k,v) - # Conflict with Resource Class Url - k = "_#{k}" if k.to_s == "method" - - if ! k.to_s.match(/-/) and ! k.to_s.match(/^[0-9]+/) - create_method( "#{k}=".to_sym ) { |val| - instance_variable_set( "@" + k, val) - } - self.send("#{k}=".to_sym, v) - self.class.send(:remove_method, "#{k}=".to_sym) - create_method( k.to_sym ) { - instance_variable_get( "@" + k ) - } - end - end - - protected - - def to_hash - hash = Hash.new - self.values.each do |k,v| - hash[k] = v - end - hash - end - - def create_method(name, &block) - self.class.send(:define_method, name, &block) - end - - def load_from_enumerable(k,v) - if v.respond_to? :each and !v.instance_of?(ConektaObject) - v = Conekta::Util.convert_to_conekta_object(k,v) - end - - if self.instance_of?(ConektaObject) - self[k] = v - else - self.create_attr(k,v) - end - self.set_val(k,v) - end - - end -end diff --git a/lib/conekta/configuration.rb b/lib/conekta/configuration.rb new file mode 100644 index 0000000..cbf38f8 --- /dev/null +++ b/lib/conekta/configuration.rb @@ -0,0 +1,379 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +module Conekta + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :ssl_verify + + ### TLS/SSL setting + # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html) + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + attr_accessor :ssl_verify_mode + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + attr_accessor :ssl_ca_file + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :ssl_client_cert + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :ssl_client_key + + ### Proxy setting + # HTTP Proxy settings + attr_accessor :proxy + + # Set this to customize parameters encoder of array parameter. + # Default to nil. Faraday uses NestedParamsEncoder when nil. + # + # @see The params_encoder option of Faraday. Related source code: + # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders + attr_accessor :params_encoder + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.conekta.io' + @base_path = '' + @server_index = 0 + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @ssl_verify = true + @ssl_verify_mode = nil + @ssl_ca_file = File.dirname(__FILE__) + '/../ssl_data/ca_bundle.crt' + @ssl_client_cert = nil + @ssl_client_key = nil + @middlewares = Hash.new { |h, k| h[k] = [] } + @configure_connection_blocks = [] + @timeout = 60 + # return data as binary instead of file + @return_binary_data = false + @params_encoder = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + index = server_operation_index[operation] + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil + + server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'bearerAuth' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.conekta.io", + description: "Conekta main server", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + # Configure Faraday connection directly. + # + # ``` + # c.configure_faraday_connection do |conn| + # conn.use Faraday::HttpCache, shared_cache: false, logger: logger + # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger| + # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]') + # end + # end + # + # c.configure_faraday_connection do |conn| + # conn.adapter :typhoeus + # end + # ``` + # + # @param block [Proc] `#call`able object that takes one arg, the connection + def configure_faraday_connection(&block) + @configure_connection_blocks << block + end + + def configure_connection(conn) + @configure_connection_blocks.each do |block| + block.call(conn) + end + end + + # Adds middleware to the stack + def use(*middleware) + set_faraday_middleware(:use, *middleware) + end + + # Adds request middleware to the stack + def request(*middleware) + set_faraday_middleware(:request, *middleware) + end + + # Adds response middleware to the stack + def response(*middleware) + set_faraday_middleware(:response, *middleware) + end + + # Adds Faraday middleware setting information to the stack + # + # @example Use the `set_faraday_middleware` method to set middleware information + # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503]) + # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug }) + # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false) + # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 }) + # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger) + # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware) + # + # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143 + def set_faraday_middleware(operation, key, *args, &block) + unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation) + fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \ + " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete." + end + + @middlewares[operation] << [key, args, block] + end + ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true) + + # Set up middleware on the connection + def configure_middleware(connection) + return if @middlewares.empty? + + [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation| + next unless @middlewares.key?(operation) + + @middlewares[operation].each do |key, args, block| + connection.builder.send(operation, key, *args, &block) + end + end + + if @middlewares.key?(:delete) + @middlewares[:delete].each do |key, _args, _block| + connection.builder.delete(key) + end + end + end + end +end diff --git a/lib/conekta/customer.rb b/lib/conekta/customer.rb deleted file mode 100644 index 9dc6b8a..0000000 --- a/lib/conekta/customer.rb +++ /dev/null @@ -1,82 +0,0 @@ -module Conekta - class Customer < Resource - include Conekta::Operations::Find - include Conekta::Operations::Where - include Conekta::Operations::Create - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - include Conekta::Operations::CreateMember - - attr_accessor :livemode, :name, :email, :phone, :default_shipping_contact_id, - :referrer, :account_age, - :paid_transactions, :first_paid_at, :corporate, :default_payment_source_id, - :shipping_contacts, :subscription, :payment_sources, :cards - - def initialize(id=nil) - @id = id - @payment_sources ||= List.new("PaymentSource", {}) - @shipping_contacts ||= List.new("ShippingContacts", {}) - super(id) - end - - def load_from(response=nil) - if response - super - end - - customer = self - - if Conekta.api_version == "2.0.0" - submodels = [:payment_sources, :shipping_contacts] - create_submodels_lists(customer, submodels) - else - submodels = [:cards] - - submodels.each do |submodel| - self.send(submodel).each do |k,v| - if !v.respond_to? :deleted or !v.deleted - v.create_attr('customer', customer) - - self.send(submodel).set_val(k,v) - end - end - end - end - - if self.respond_to? :subscription and self.subscription - self.subscription.create_attr('customer', customer) - end - end - - def create_card(params) - self.create_member_with_relation('cards', params, self) - end - - def create_payment_source(params) - self.create_member_with_relation('payment_sources', params, self) - end - - def create_offline_recurrent_reference(params) - self.create_member_with_relation('payment_sources', params, self) - end - - def create_subscription(params) - self.create_member('subscription', params) - end - - def create_shipping_contact(params) - self.create_member_with_relation('shipping_contacts', params, self) - end - - def create_submodels_lists(customer, submodels) - submodels.each do |submodel| - self.send(submodel).each do |k, v| - v.create_attr('customer', customer) - - self.send(submodel).set_val(k,v) - end if self.respond_to?(submodel) && !self.send(submodel).nil? - end - end - end -end diff --git a/lib/conekta/customer_info.rb b/lib/conekta/customer_info.rb deleted file mode 100644 index f69ea64..0000000 --- a/lib/conekta/customer_info.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Conekta - class CustomerInfo < Resource - attr_accessor :email, :phone, :name, :corporate - end -end diff --git a/lib/conekta/destination.rb b/lib/conekta/destination.rb deleted file mode 100644 index fbfad83..0000000 --- a/lib/conekta/destination.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Conekta - class Destination < Resource - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - def _url - ensure_id - - self.payee._url + self.class._url + "/" + id - end - - def delete - self.delete_member('payee','destinations') - end - end -end diff --git a/lib/conekta/details.rb b/lib/conekta/details.rb deleted file mode 100644 index 68099ad..0000000 --- a/lib/conekta/details.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Conekta - class Details < Resource - attr_accessor :name, :description, :unit_price, :quantity, :sku, :category - end -end diff --git a/lib/conekta/discount_line.rb b/lib/conekta/discount_line.rb deleted file mode 100644 index 6742064..0000000 --- a/lib/conekta/discount_line.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Conekta - class DiscountLine < Resource - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - attr_accessor :code, :amount, :type, :parent_id - - def _url - ensure_id - - "#{self.order._url}#{self.class._url}/#{id}" - end - - def delete - self.delete_member('order', 'discount_lines') - end - end -end diff --git a/lib/conekta/error.rb b/lib/conekta/error.rb deleted file mode 100644 index 6ad6470..0000000 --- a/lib/conekta/error.rb +++ /dev/null @@ -1,100 +0,0 @@ -module Conekta - class Error < StandardError - attr_reader :message, :type, :log_id, :details, :data - - def initialize(options={}) - @type = options["type"] - @log_id = options["log_id"] - if options["details"] - @details = options["details"].collect{|details| - Conekta::ErrorDetails.new(details) - } - else - temp_details = Conekta::ErrorDetails.new({ - "message" => options["message_to_purchaser"], - "debug_message" => options["message"], - "param" => options["param"] - }) - @details = [temp_details] - end - @message = @details.first.debug_message - @data = options["data"] - - super - end - - def class_name - self.class.name.split('::')[-1] - end - - def self.error_handler(response, http_status) - if http_status.to_s.empty? || http_status == 0 - NoConnectionError.new({ - "details" => [ - { - "debug_message" => I18n.translate( - 'error.requestor.connection', - locale: :en, - base: Conekta.api_base - ), - "message" => I18n.translate( - 'error.requestor.connection_purchaser', - locale: Conekta.locale.to_sym - ), - "code" => "error.requestor.connection" - } - ] - }) - else - case http_status - when -1, 0 - NoConnectionError.new(response) - when 400 - MalformedRequestError.new(response) - when 401 - AuthenticationError.new(response) - when 402 - ProcessingError.new(response) - when 404 - ResourceNotFoundError.new(response) - when 409 - VersionConflictError.new(response) - when 422 - ParameterValidationError.new(response) - when 428 - PreconditionRequiredError.new(response) - when 500 - ApiError.new(response) - else - Error.new(response) - end - end - end - end - class ApiError < Error - end - - class NoConnectionError < Error - end - - class AuthenticationError < Error - end - - class ParameterValidationError < Error - end - - class ProcessingError < Error - end - - class ResourceNotFoundError < Error - end - - class VersionConflictError < Error - end - - class PreconditionRequiredError < Error - end - - class MalformedRequestError < Error - end -end diff --git a/lib/conekta/error_details.rb b/lib/conekta/error_details.rb deleted file mode 100644 index ff58347..0000000 --- a/lib/conekta/error_details.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Conekta - class ErrorDetails < ConektaObject - attr_reader :debug_message, :message, :param, :code - - def initialize(options={}) - load_from(options) - @debug_message = options["debug_message"] - @message = options["message"] - @param = options["param"] - @code = options["code"] - super() - end - end -end diff --git a/lib/conekta/event.rb b/lib/conekta/event.rb deleted file mode 100644 index 917c5de..0000000 --- a/lib/conekta/event.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Conekta - class Event < Resource - include Conekta::Operations::Where - include Conekta::Operations::Find - - attr_accessor :data, :livemode, :webhook_status, :created_at, :type - - end -end \ No newline at end of file diff --git a/lib/conekta/line_item.rb b/lib/conekta/line_item.rb deleted file mode 100644 index 4531073..0000000 --- a/lib/conekta/line_item.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Conekta - class LineItem < Resource - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - attr_accessor :name, :description, :unit_price, :quantity, - :sku, :shippable, :tags, :brand, :type, - :parent_id - - def _url - ensure_id - - "#{self.order._url}#{self.class._url}/#{id}" - end - - def delete - self.delete_member('order','line_items') - end - end -end diff --git a/lib/conekta/list.rb b/lib/conekta/list.rb deleted file mode 100644 index 5710143..0000000 --- a/lib/conekta/list.rb +++ /dev/null @@ -1,58 +0,0 @@ -module Conekta - class List < ConektaObject - attr_reader :elements_type, :params, :has_more, :total - - def initialize(elements_type, params) - super() - @elements_type = elements_type - @params = (params || {}) - @total = 0 - end - - def add_element(element) - element = - Conekta::Util.convert_to_conekta_object(element['object'], element) - - self[@total] = element - self.values[@total] = element - @total = @total + 1 - - self - end - - def next(options={}) - if self.size > 0 - @params["next"] = self.last.id - end - - @params["previous"] = nil - - move_cursor(options[:limit]) - end - - def previous(options={}) - if self.size > 0 - @params["previous"] = self.first.id - end - - @params["next"] = nil - - move_cursor(options[:limit]) - end - - def load_from(response) - @has_more = response["has_more"] - self.map{|key, _| self.unset_key(key) } - super(response["data"]) - end - - private - - def move_cursor(limit) - @params["limit"] = limit if !limit.nil? && !limit.to_s.empty? - _url = Util.types[@elements_type.downcase]._url - response = Requestor.new.request(:get, _url, @params) - self.load_from(response) - end - end -end diff --git a/lib/conekta/log.rb b/lib/conekta/log.rb deleted file mode 100644 index 8937a54..0000000 --- a/lib/conekta/log.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Conekta - class Log < Resource - include Conekta::Operations::Where - include Conekta::Operations::Find - - attr_accessor :method, :url, :status, :version, :ip_address, :related, - :request_body, :response_body, :request_headers, - :response_headers, :created_at, :query_string - end -end diff --git a/lib/conekta/method.rb b/lib/conekta/method.rb deleted file mode 100644 index a375521..0000000 --- a/lib/conekta/method.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Conekta - class Method < Resource - end -end diff --git a/lib/conekta/models/api_key_create_response.rb b/lib/conekta/models/api_key_create_response.rb new file mode 100644 index 0000000..738a6ed --- /dev/null +++ b/lib/conekta/models/api_key_create_response.rb @@ -0,0 +1,339 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ApiKeyCreateResponse + # It is occupied as a user when authenticated with basic authentication, with a blank password. This value will only appear once, in the request to create a new key. Copy and save it in a safe place. + attr_accessor :authentication_token + + # Indicates if the api key is active + attr_accessor :active + + # Unix timestamp in seconds of when the api key was created + attr_accessor :created_at + + # Unix timestamp in seconds of when the api key was last updated + attr_accessor :updated_at + + # Unix timestamp in seconds of when the api key was deleted + attr_accessor :deactivated_at + + # A name or brief explanation of what this api key is used for + attr_accessor :description + + # Unique identifier of the api key + attr_accessor :id + + # Indicates if the api key is in production + attr_accessor :livemode + + # Indicates if the api key was deleted + attr_accessor :deleted + + # Object name, value is 'api_key' + attr_accessor :object + + # The first few characters of the authentication_token + attr_accessor :prefix + + # Indicates if the api key is private or public + attr_accessor :role + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'authentication_token' => :'authentication_token', + :'active' => :'active', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'deactivated_at' => :'deactivated_at', + :'description' => :'description', + :'id' => :'id', + :'livemode' => :'livemode', + :'deleted' => :'deleted', + :'object' => :'object', + :'prefix' => :'prefix', + :'role' => :'role' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'authentication_token' => :'String', + :'active' => :'Boolean', + :'created_at' => :'Integer', + :'updated_at' => :'Integer', + :'deactivated_at' => :'Integer', + :'description' => :'String', + :'id' => :'String', + :'livemode' => :'Boolean', + :'deleted' => :'Boolean', + :'object' => :'String', + :'prefix' => :'String', + :'role' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'deactivated_at', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ApiKeyCreateResponseAllOf', + :'ApiKeyResponse' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ApiKeyCreateResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ApiKeyCreateResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'authentication_token') + self.authentication_token = attributes[:'authentication_token'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'deactivated_at') + self.deactivated_at = attributes[:'deactivated_at'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'prefix') + self.prefix = attributes[:'prefix'] + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + authentication_token == o.authentication_token && + active == o.active && + created_at == o.created_at && + updated_at == o.updated_at && + deactivated_at == o.deactivated_at && + description == o.description && + id == o.id && + livemode == o.livemode && + deleted == o.deleted && + object == o.object && + prefix == o.prefix && + role == o.role + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [authentication_token, active, created_at, updated_at, deactivated_at, description, id, livemode, deleted, object, prefix, role].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/api_key_create_response_all_of.rb b/lib/conekta/models/api_key_create_response_all_of.rb new file mode 100644 index 0000000..e375341 --- /dev/null +++ b/lib/conekta/models/api_key_create_response_all_of.rb @@ -0,0 +1,220 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ApiKeyCreateResponseAllOf + # It is occupied as a user when authenticated with basic authentication, with a blank password. This value will only appear once, in the request to create a new key. Copy and save it in a safe place. + attr_accessor :authentication_token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'authentication_token' => :'authentication_token' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'authentication_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ApiKeyCreateResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ApiKeyCreateResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'authentication_token') + self.authentication_token = attributes[:'authentication_token'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + authentication_token == o.authentication_token + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [authentication_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/api_key_request.rb b/lib/conekta/models/api_key_request.rb new file mode 100644 index 0000000..fce266c --- /dev/null +++ b/lib/conekta/models/api_key_request.rb @@ -0,0 +1,234 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ApiKeyRequest + # A name or brief explanation of what this api key is used for + attr_accessor :description + + attr_accessor :role + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'role' => :'role' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'description' => :'String', + :'role' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ApiKeyRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ApiKeyRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @role.nil? + invalid_properties.push('invalid value for "role", role cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @role.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + role == o.role + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [description, role].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/api_key_response.rb b/lib/conekta/models/api_key_response.rb new file mode 100644 index 0000000..755fcd9 --- /dev/null +++ b/lib/conekta/models/api_key_response.rb @@ -0,0 +1,322 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # api keys model + class ApiKeyResponse + # Indicates if the api key is active + attr_accessor :active + + # Unix timestamp in seconds of when the api key was created + attr_accessor :created_at + + # Unix timestamp in seconds of when the api key was last updated + attr_accessor :updated_at + + # Unix timestamp in seconds of when the api key was deleted + attr_accessor :deactivated_at + + # A name or brief explanation of what this api key is used for + attr_accessor :description + + # Unique identifier of the api key + attr_accessor :id + + # Indicates if the api key is in production + attr_accessor :livemode + + # Indicates if the api key was deleted + attr_accessor :deleted + + # Object name, value is 'api_key' + attr_accessor :object + + # The first few characters of the authentication_token + attr_accessor :prefix + + # Indicates if the api key is private or public + attr_accessor :role + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'active' => :'active', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'deactivated_at' => :'deactivated_at', + :'description' => :'description', + :'id' => :'id', + :'livemode' => :'livemode', + :'deleted' => :'deleted', + :'object' => :'object', + :'prefix' => :'prefix', + :'role' => :'role' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'active' => :'Boolean', + :'created_at' => :'Integer', + :'updated_at' => :'Integer', + :'deactivated_at' => :'Integer', + :'description' => :'String', + :'id' => :'String', + :'livemode' => :'Boolean', + :'deleted' => :'Boolean', + :'object' => :'String', + :'prefix' => :'String', + :'role' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'deactivated_at', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ApiKeyResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ApiKeyResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'deactivated_at') + self.deactivated_at = attributes[:'deactivated_at'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'prefix') + self.prefix = attributes[:'prefix'] + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active && + created_at == o.created_at && + updated_at == o.updated_at && + deactivated_at == o.deactivated_at && + description == o.description && + id == o.id && + livemode == o.livemode && + deleted == o.deleted && + object == o.object && + prefix == o.prefix && + role == o.role + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [active, created_at, updated_at, deactivated_at, description, id, livemode, deleted, object, prefix, role].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/api_key_response_on_delete.rb b/lib/conekta/models/api_key_response_on_delete.rb new file mode 100644 index 0000000..59e79f4 --- /dev/null +++ b/lib/conekta/models/api_key_response_on_delete.rb @@ -0,0 +1,301 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # api keys model + class ApiKeyResponseOnDelete + # Indicates if the api key is active + attr_accessor :active + + # Unix timestamp in seconds of when the api key was created + attr_accessor :created_at + + # A name or brief explanation of what this api key is used for + attr_accessor :description + + # Indicates if the api key is in production + attr_accessor :livemode + + # The first few characters of the authentication_token + attr_accessor :prefix + + # Unique identifier of the api key + attr_accessor :id + + # Object name, value is 'api_key' + attr_accessor :object + + # Indicates if the api key was deleted + attr_accessor :deleted + + # Indicates if the api key is private or public + attr_accessor :role + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'active' => :'active', + :'created_at' => :'created_at', + :'description' => :'description', + :'livemode' => :'livemode', + :'prefix' => :'prefix', + :'id' => :'id', + :'object' => :'object', + :'deleted' => :'deleted', + :'role' => :'role' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'active' => :'Boolean', + :'created_at' => :'Integer', + :'description' => :'String', + :'livemode' => :'Boolean', + :'prefix' => :'String', + :'id' => :'String', + :'object' => :'String', + :'deleted' => :'Boolean', + :'role' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ApiKeyResponseOnDelete` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ApiKeyResponseOnDelete`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'prefix') + self.prefix = attributes[:'prefix'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active && + created_at == o.created_at && + description == o.description && + livemode == o.livemode && + prefix == o.prefix && + id == o.id && + object == o.object && + deleted == o.deleted && + role == o.role + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [active, created_at, description, livemode, prefix, id, object, deleted, role].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/api_key_update_request.rb b/lib/conekta/models/api_key_update_request.rb new file mode 100644 index 0000000..b677928 --- /dev/null +++ b/lib/conekta/models/api_key_update_request.rb @@ -0,0 +1,230 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ApiKeyUpdateRequest + # Indicates if the webhook key is active + attr_accessor :active + + # A name or brief explanation of what this api key is used for + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'active' => :'active', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'active' => :'Boolean', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ApiKeyUpdateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ApiKeyUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [active, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/balance_common_field.rb b/lib/conekta/models/balance_common_field.rb new file mode 100644 index 0000000..f6ed4f8 --- /dev/null +++ b/lib/conekta/models/balance_common_field.rb @@ -0,0 +1,231 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # balance common fields model + class BalanceCommonField + # The balance's amount + attr_accessor :amount + + # The balance's currency + attr_accessor :currency + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'currency' => :'currency' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'currency' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::BalanceCommonField` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::BalanceCommonField`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + currency == o.currency + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, currency].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/balance_response.rb b/lib/conekta/models/balance_response.rb new file mode 100644 index 0000000..879296f --- /dev/null +++ b/lib/conekta/models/balance_response.rb @@ -0,0 +1,329 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # balance model + class BalanceResponse + # The balance's available + attr_accessor :available + + # The balance's cashout retention amount + attr_accessor :cashout_retention_amount + + # The balance's conekta retention + attr_accessor :conekta_retention + + # The balance's gateway + attr_accessor :gateway + + # The balance's pending + attr_accessor :pending + + # The balance's retained + attr_accessor :retained + + # The balance's retention amount + attr_accessor :retention_amount + + # The balance's target collateral amount + attr_accessor :target_collateral_amount + + # The balance's target retention amount + attr_accessor :target_retention_amount + + # The balance's temporarily retained + attr_accessor :temporarily_retained + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'available' => :'available', + :'cashout_retention_amount' => :'cashout_retention_amount', + :'conekta_retention' => :'conekta_retention', + :'gateway' => :'gateway', + :'pending' => :'pending', + :'retained' => :'retained', + :'retention_amount' => :'retention_amount', + :'target_collateral_amount' => :'target_collateral_amount', + :'target_retention_amount' => :'target_retention_amount', + :'temporarily_retained' => :'temporarily_retained' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'available' => :'Array', + :'cashout_retention_amount' => :'Array', + :'conekta_retention' => :'Array', + :'gateway' => :'Array', + :'pending' => :'Array', + :'retained' => :'Array', + :'retention_amount' => :'Array', + :'target_collateral_amount' => :'Object', + :'target_retention_amount' => :'Array', + :'temporarily_retained' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::BalanceResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::BalanceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'available') + if (value = attributes[:'available']).is_a?(Array) + self.available = value + end + end + + if attributes.key?(:'cashout_retention_amount') + if (value = attributes[:'cashout_retention_amount']).is_a?(Array) + self.cashout_retention_amount = value + end + end + + if attributes.key?(:'conekta_retention') + if (value = attributes[:'conekta_retention']).is_a?(Array) + self.conekta_retention = value + end + end + + if attributes.key?(:'gateway') + if (value = attributes[:'gateway']).is_a?(Array) + self.gateway = value + end + end + + if attributes.key?(:'pending') + if (value = attributes[:'pending']).is_a?(Array) + self.pending = value + end + end + + if attributes.key?(:'retained') + if (value = attributes[:'retained']).is_a?(Array) + self.retained = value + end + end + + if attributes.key?(:'retention_amount') + if (value = attributes[:'retention_amount']).is_a?(Array) + self.retention_amount = value + end + end + + if attributes.key?(:'target_collateral_amount') + self.target_collateral_amount = attributes[:'target_collateral_amount'] + end + + if attributes.key?(:'target_retention_amount') + if (value = attributes[:'target_retention_amount']).is_a?(Array) + self.target_retention_amount = value + end + end + + if attributes.key?(:'temporarily_retained') + if (value = attributes[:'temporarily_retained']).is_a?(Array) + self.temporarily_retained = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + available == o.available && + cashout_retention_amount == o.cashout_retention_amount && + conekta_retention == o.conekta_retention && + gateway == o.gateway && + pending == o.pending && + retained == o.retained && + retention_amount == o.retention_amount && + target_collateral_amount == o.target_collateral_amount && + target_retention_amount == o.target_retention_amount && + temporarily_retained == o.temporarily_retained + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [available, cashout_retention_amount, conekta_retention, gateway, pending, retained, retention_amount, target_collateral_amount, target_retention_amount, temporarily_retained].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/blacklist_rule_response.rb b/lib/conekta/models/blacklist_rule_response.rb new file mode 100644 index 0000000..1e1fe44 --- /dev/null +++ b/lib/conekta/models/blacklist_rule_response.rb @@ -0,0 +1,250 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class BlacklistRuleResponse + # Blacklist rule id + attr_accessor :id + + # field used for blacklists rule + attr_accessor :field + + # value used for blacklists rule + attr_accessor :value + + # use an description for blacklisted rule + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'field' => :'field', + :'value' => :'value', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'field' => :'String', + :'value' => :'String', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::BlacklistRuleResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::BlacklistRuleResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + field == o.field && + value == o.value && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, field, value, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_data_payment_method_bank_transfer_response.rb b/lib/conekta/models/charge_data_payment_method_bank_transfer_response.rb new file mode 100644 index 0000000..0621d3b --- /dev/null +++ b/lib/conekta/models/charge_data_payment_method_bank_transfer_response.rb @@ -0,0 +1,367 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # use for bank transfer responses + class ChargeDataPaymentMethodBankTransferResponse + attr_accessor :bank + + attr_accessor :clabe + + attr_accessor :description + + attr_accessor :executed_at + + attr_accessor :expires_at + + attr_accessor :issuing_account_bank + + attr_accessor :issuing_account_number + + attr_accessor :issuing_account_holder_name + + attr_accessor :issuing_account_tax_id + + attr_accessor :payment_attempts + + attr_accessor :receiving_account_holder_name + + attr_accessor :receiving_account_number + + attr_accessor :receiving_account_bank + + attr_accessor :receiving_account_tax_id + + attr_accessor :reference_number + + attr_accessor :tracking_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bank' => :'bank', + :'clabe' => :'clabe', + :'description' => :'description', + :'executed_at' => :'executed_at', + :'expires_at' => :'expires_at', + :'issuing_account_bank' => :'issuing_account_bank', + :'issuing_account_number' => :'issuing_account_number', + :'issuing_account_holder_name' => :'issuing_account_holder_name', + :'issuing_account_tax_id' => :'issuing_account_tax_id', + :'payment_attempts' => :'payment_attempts', + :'receiving_account_holder_name' => :'receiving_account_holder_name', + :'receiving_account_number' => :'receiving_account_number', + :'receiving_account_bank' => :'receiving_account_bank', + :'receiving_account_tax_id' => :'receiving_account_tax_id', + :'reference_number' => :'reference_number', + :'tracking_code' => :'tracking_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'bank' => :'String', + :'clabe' => :'String', + :'description' => :'String', + :'executed_at' => :'Integer', + :'expires_at' => :'Integer', + :'issuing_account_bank' => :'String', + :'issuing_account_number' => :'String', + :'issuing_account_holder_name' => :'String', + :'issuing_account_tax_id' => :'String', + :'payment_attempts' => :'Array', + :'receiving_account_holder_name' => :'String', + :'receiving_account_number' => :'String', + :'receiving_account_bank' => :'String', + :'receiving_account_tax_id' => :'String', + :'reference_number' => :'String', + :'tracking_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'description', + :'executed_at', + :'issuing_account_bank', + :'issuing_account_number', + :'issuing_account_holder_name', + :'issuing_account_tax_id', + :'receiving_account_holder_name', + :'receiving_account_tax_id', + :'reference_number', + :'tracking_code' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeDataPaymentMethodBankTransferResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeDataPaymentMethodBankTransferResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'bank') + self.bank = attributes[:'bank'] + end + + if attributes.key?(:'clabe') + self.clabe = attributes[:'clabe'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'executed_at') + self.executed_at = attributes[:'executed_at'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'issuing_account_bank') + self.issuing_account_bank = attributes[:'issuing_account_bank'] + end + + if attributes.key?(:'issuing_account_number') + self.issuing_account_number = attributes[:'issuing_account_number'] + end + + if attributes.key?(:'issuing_account_holder_name') + self.issuing_account_holder_name = attributes[:'issuing_account_holder_name'] + end + + if attributes.key?(:'issuing_account_tax_id') + self.issuing_account_tax_id = attributes[:'issuing_account_tax_id'] + end + + if attributes.key?(:'payment_attempts') + if (value = attributes[:'payment_attempts']).is_a?(Array) + self.payment_attempts = value + end + end + + if attributes.key?(:'receiving_account_holder_name') + self.receiving_account_holder_name = attributes[:'receiving_account_holder_name'] + end + + if attributes.key?(:'receiving_account_number') + self.receiving_account_number = attributes[:'receiving_account_number'] + end + + if attributes.key?(:'receiving_account_bank') + self.receiving_account_bank = attributes[:'receiving_account_bank'] + end + + if attributes.key?(:'receiving_account_tax_id') + self.receiving_account_tax_id = attributes[:'receiving_account_tax_id'] + end + + if attributes.key?(:'reference_number') + self.reference_number = attributes[:'reference_number'] + end + + if attributes.key?(:'tracking_code') + self.tracking_code = attributes[:'tracking_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bank == o.bank && + clabe == o.clabe && + description == o.description && + executed_at == o.executed_at && + expires_at == o.expires_at && + issuing_account_bank == o.issuing_account_bank && + issuing_account_number == o.issuing_account_number && + issuing_account_holder_name == o.issuing_account_holder_name && + issuing_account_tax_id == o.issuing_account_tax_id && + payment_attempts == o.payment_attempts && + receiving_account_holder_name == o.receiving_account_holder_name && + receiving_account_number == o.receiving_account_number && + receiving_account_bank == o.receiving_account_bank && + receiving_account_tax_id == o.receiving_account_tax_id && + reference_number == o.reference_number && + tracking_code == o.tracking_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [bank, clabe, description, executed_at, expires_at, issuing_account_bank, issuing_account_number, issuing_account_holder_name, issuing_account_tax_id, payment_attempts, receiving_account_holder_name, receiving_account_number, receiving_account_bank, receiving_account_tax_id, reference_number, tracking_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_data_payment_method_card_response.rb b/lib/conekta/models/charge_data_payment_method_card_response.rb new file mode 100644 index 0000000..bbf09aa --- /dev/null +++ b/lib/conekta/models/charge_data_payment_method_card_response.rb @@ -0,0 +1,337 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # use for card responses + class ChargeDataPaymentMethodCardResponse + attr_accessor :account_type + + attr_accessor :auth_code + + attr_accessor :brand + + # Id sent for recurrent charges. + attr_accessor :contract_id + + attr_accessor :country + + attr_accessor :exp_month + + attr_accessor :exp_year + + attr_accessor :fraud_indicators + + attr_accessor :issuer + + attr_accessor :last4 + + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_type' => :'account_type', + :'auth_code' => :'auth_code', + :'brand' => :'brand', + :'contract_id' => :'contract_id', + :'country' => :'country', + :'exp_month' => :'exp_month', + :'exp_year' => :'exp_year', + :'fraud_indicators' => :'fraud_indicators', + :'issuer' => :'issuer', + :'last4' => :'last4', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_type' => :'String', + :'auth_code' => :'String', + :'brand' => :'String', + :'contract_id' => :'String', + :'country' => :'String', + :'exp_month' => :'String', + :'exp_year' => :'String', + :'fraud_indicators' => :'Array', + :'issuer' => :'String', + :'last4' => :'String', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeDataPaymentMethodCardResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeDataPaymentMethodCardResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_type') + self.account_type = attributes[:'account_type'] + end + + if attributes.key?(:'auth_code') + self.auth_code = attributes[:'auth_code'] + end + + if attributes.key?(:'brand') + self.brand = attributes[:'brand'] + end + + if attributes.key?(:'contract_id') + self.contract_id = attributes[:'contract_id'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'exp_month') + self.exp_month = attributes[:'exp_month'] + end + + if attributes.key?(:'exp_year') + self.exp_year = attributes[:'exp_year'] + end + + if attributes.key?(:'fraud_indicators') + if (value = attributes[:'fraud_indicators']).is_a?(Array) + self.fraud_indicators = value + end + end + + if attributes.key?(:'issuer') + self.issuer = attributes[:'issuer'] + end + + if attributes.key?(:'last4') + self.last4 = attributes[:'last4'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@contract_id.nil? && @contract_id.to_s.length > 10 + invalid_properties.push('invalid value for "contract_id", the character length must be smaller than or equal to 10.') + end + + if !@contract_id.nil? && @contract_id.to_s.length < 10 + invalid_properties.push('invalid value for "contract_id", the character length must be great than or equal to 10.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@contract_id.nil? && @contract_id.to_s.length > 10 + return false if !@contract_id.nil? && @contract_id.to_s.length < 10 + true + end + + # Custom attribute writer method with validation + # @param [Object] contract_id Value to be assigned + def contract_id=(contract_id) + if !contract_id.nil? && contract_id.to_s.length > 10 + fail ArgumentError, 'invalid value for "contract_id", the character length must be smaller than or equal to 10.' + end + + if !contract_id.nil? && contract_id.to_s.length < 10 + fail ArgumentError, 'invalid value for "contract_id", the character length must be great than or equal to 10.' + end + + @contract_id = contract_id + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_type == o.account_type && + auth_code == o.auth_code && + brand == o.brand && + contract_id == o.contract_id && + country == o.country && + exp_month == o.exp_month && + exp_year == o.exp_year && + fraud_indicators == o.fraud_indicators && + issuer == o.issuer && + last4 == o.last4 && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_type, auth_code, brand, contract_id, country, exp_month, exp_year, fraud_indicators, issuer, last4, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_data_payment_method_cash_response.rb b/lib/conekta/models/charge_data_payment_method_cash_response.rb new file mode 100644 index 0000000..04681e0 --- /dev/null +++ b/lib/conekta/models/charge_data_payment_method_cash_response.rb @@ -0,0 +1,286 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # use for cash responses + class ChargeDataPaymentMethodCashResponse + attr_accessor :auth_code + + attr_accessor :cashier_id + + attr_accessor :reference + + attr_accessor :barcode_url + + attr_accessor :expires_at + + attr_accessor :service_name + + attr_accessor :store + + attr_accessor :store_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'auth_code' => :'auth_code', + :'cashier_id' => :'cashier_id', + :'reference' => :'reference', + :'barcode_url' => :'barcode_url', + :'expires_at' => :'expires_at', + :'service_name' => :'service_name', + :'store' => :'store', + :'store_name' => :'store_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'auth_code' => :'Integer', + :'cashier_id' => :'String', + :'reference' => :'String', + :'barcode_url' => :'String', + :'expires_at' => :'Integer', + :'service_name' => :'String', + :'store' => :'String', + :'store_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'auth_code', + :'cashier_id', + :'store', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeDataPaymentMethodCashResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeDataPaymentMethodCashResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'auth_code') + self.auth_code = attributes[:'auth_code'] + end + + if attributes.key?(:'cashier_id') + self.cashier_id = attributes[:'cashier_id'] + end + + if attributes.key?(:'reference') + self.reference = attributes[:'reference'] + end + + if attributes.key?(:'barcode_url') + self.barcode_url = attributes[:'barcode_url'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'service_name') + self.service_name = attributes[:'service_name'] + end + + if attributes.key?(:'store') + self.store = attributes[:'store'] + end + + if attributes.key?(:'store_name') + self.store_name = attributes[:'store_name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + auth_code == o.auth_code && + cashier_id == o.cashier_id && + reference == o.reference && + barcode_url == o.barcode_url && + expires_at == o.expires_at && + service_name == o.service_name && + store == o.store && + store_name == o.store_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [auth_code, cashier_id, reference, barcode_url, expires_at, service_name, store, store_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_order_response.rb b/lib/conekta/models/charge_order_response.rb new file mode 100644 index 0000000..339bee0 --- /dev/null +++ b/lib/conekta/models/charge_order_response.rb @@ -0,0 +1,397 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ChargeOrderResponse + attr_accessor :amount + + attr_accessor :channel + + attr_accessor :created_at + + attr_accessor :currency + + attr_accessor :customer_id + + attr_accessor :description + + attr_accessor :device_fingerprint + + attr_accessor :failure_code + + attr_accessor :failure_message + + attr_accessor :fee + + attr_accessor :id + + attr_accessor :livemode + + attr_accessor :monthly_installments + + attr_accessor :object + + attr_accessor :order_id + + attr_accessor :paid_at + + attr_accessor :payment_method + + # Reference ID of the charge + attr_accessor :reference_id + + attr_accessor :refunds + + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'channel' => :'channel', + :'created_at' => :'created_at', + :'currency' => :'currency', + :'customer_id' => :'customer_id', + :'description' => :'description', + :'device_fingerprint' => :'device_fingerprint', + :'failure_code' => :'failure_code', + :'failure_message' => :'failure_message', + :'fee' => :'fee', + :'id' => :'id', + :'livemode' => :'livemode', + :'monthly_installments' => :'monthly_installments', + :'object' => :'object', + :'order_id' => :'order_id', + :'paid_at' => :'paid_at', + :'payment_method' => :'payment_method', + :'reference_id' => :'reference_id', + :'refunds' => :'refunds', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'channel' => :'ChargeResponseChannel', + :'created_at' => :'Integer', + :'currency' => :'String', + :'customer_id' => :'String', + :'description' => :'String', + :'device_fingerprint' => :'String', + :'failure_code' => :'String', + :'failure_message' => :'String', + :'fee' => :'Integer', + :'id' => :'String', + :'livemode' => :'Boolean', + :'monthly_installments' => :'Integer', + :'object' => :'String', + :'order_id' => :'String', + :'paid_at' => :'Integer', + :'payment_method' => :'ChargeOrderResponsePaymentMethod', + :'reference_id' => :'String', + :'refunds' => :'Array', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'device_fingerprint', + :'monthly_installments', + :'paid_at', + :'reference_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeOrderResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeOrderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'device_fingerprint') + self.device_fingerprint = attributes[:'device_fingerprint'] + end + + if attributes.key?(:'failure_code') + self.failure_code = attributes[:'failure_code'] + end + + if attributes.key?(:'failure_message') + self.failure_message = attributes[:'failure_message'] + end + + if attributes.key?(:'fee') + self.fee = attributes[:'fee'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'monthly_installments') + self.monthly_installments = attributes[:'monthly_installments'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'paid_at') + self.paid_at = attributes[:'paid_at'] + end + + if attributes.key?(:'payment_method') + self.payment_method = attributes[:'payment_method'] + end + + if attributes.key?(:'reference_id') + self.reference_id = attributes[:'reference_id'] + end + + if attributes.key?(:'refunds') + if (value = attributes[:'refunds']).is_a?(Array) + self.refunds = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + channel == o.channel && + created_at == o.created_at && + currency == o.currency && + customer_id == o.customer_id && + description == o.description && + device_fingerprint == o.device_fingerprint && + failure_code == o.failure_code && + failure_message == o.failure_message && + fee == o.fee && + id == o.id && + livemode == o.livemode && + monthly_installments == o.monthly_installments && + object == o.object && + order_id == o.order_id && + paid_at == o.paid_at && + payment_method == o.payment_method && + reference_id == o.reference_id && + refunds == o.refunds && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, channel, created_at, currency, customer_id, description, device_fingerprint, failure_code, failure_message, fee, id, livemode, monthly_installments, object, order_id, paid_at, payment_method, reference_id, refunds, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_order_response_payment_method.rb b/lib/conekta/models/charge_order_response_payment_method.rb new file mode 100644 index 0000000..6ef6340 --- /dev/null +++ b/lib/conekta/models/charge_order_response_payment_method.rb @@ -0,0 +1,57 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + module ChargeOrderResponsePaymentMethod + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'PaymentMethodBankTransfer', + :'PaymentMethodCard', + :'PaymentMethodCash' + ] + end + + # Discriminator's property name (OpenAPI v3) + def openapi_discriminator_name + :'object' + end + + # Discriminator's mapping (OpenAPI v3) + def openapi_discriminator_mapping + { + :'bank_transfer_payment' => :'PaymentMethodBankTransfer', + :'card_payment' => :'PaymentMethodCard', + :'cash_payment' => :'PaymentMethodCash' + } + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + discriminator_value = data[openapi_discriminator_name] + return nil if discriminator_value.nil? + + klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym] + return nil unless klass + + Conekta.const_get(klass).build_from_hash(data) + end + end + end + +end diff --git a/lib/conekta/models/charge_request.rb b/lib/conekta/models/charge_request.rb new file mode 100644 index 0000000..8228307 --- /dev/null +++ b/lib/conekta/models/charge_request.rb @@ -0,0 +1,254 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # The charges to be made + class ChargeRequest + attr_accessor :amount + + # How many months without interest to apply, it can be 3, 6, 9, 12 or 18 + attr_accessor :monthly_installments + + attr_accessor :payment_method + + # Custom reference to add to the charge + attr_accessor :reference_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'monthly_installments' => :'monthly_installments', + :'payment_method' => :'payment_method', + :'reference_id' => :'reference_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'monthly_installments' => :'Integer', + :'payment_method' => :'ChargeRequestPaymentMethod', + :'reference_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'monthly_installments') + self.monthly_installments = attributes[:'monthly_installments'] + end + + if attributes.key?(:'payment_method') + self.payment_method = attributes[:'payment_method'] + end + + if attributes.key?(:'reference_id') + self.reference_id = attributes[:'reference_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payment_method.nil? + invalid_properties.push('invalid value for "payment_method", payment_method cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @payment_method.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + monthly_installments == o.monthly_installments && + payment_method == o.payment_method && + reference_id == o.reference_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, monthly_installments, payment_method, reference_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_request_payment_method.rb b/lib/conekta/models/charge_request_payment_method.rb new file mode 100644 index 0000000..620b550 --- /dev/null +++ b/lib/conekta/models/charge_request_payment_method.rb @@ -0,0 +1,287 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # 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 + class ChargeRequestPaymentMethod + # Method expiration date as unix timestamp + attr_accessor :expires_at + + attr_accessor :type + + attr_accessor :token_id + + attr_accessor :payment_source_id + + # Optional id sent to indicate the bank contract for recurrent card charges. + attr_accessor :contract_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expires_at' => :'expires_at', + :'type' => :'type', + :'token_id' => :'token_id', + :'payment_source_id' => :'payment_source_id', + :'contract_id' => :'contract_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'expires_at' => :'Integer', + :'type' => :'String', + :'token_id' => :'String', + :'payment_source_id' => :'String', + :'contract_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeRequestPaymentMethod` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeRequestPaymentMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'token_id') + self.token_id = attributes[:'token_id'] + end + + if attributes.key?(:'payment_source_id') + self.payment_source_id = attributes[:'payment_source_id'] + end + + if attributes.key?(:'contract_id') + self.contract_id = attributes[:'contract_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if !@contract_id.nil? && @contract_id.to_s.length > 10 + invalid_properties.push('invalid value for "contract_id", the character length must be smaller than or equal to 10.') + end + + if !@contract_id.nil? && @contract_id.to_s.length < 10 + invalid_properties.push('invalid value for "contract_id", the character length must be great than or equal to 10.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + return false if !@contract_id.nil? && @contract_id.to_s.length > 10 + return false if !@contract_id.nil? && @contract_id.to_s.length < 10 + true + end + + # Custom attribute writer method with validation + # @param [Object] contract_id Value to be assigned + def contract_id=(contract_id) + if !contract_id.nil? && contract_id.to_s.length > 10 + fail ArgumentError, 'invalid value for "contract_id", the character length must be smaller than or equal to 10.' + end + + if !contract_id.nil? && contract_id.to_s.length < 10 + fail ArgumentError, 'invalid value for "contract_id", the character length must be great than or equal to 10.' + end + + @contract_id = contract_id + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expires_at == o.expires_at && + type == o.type && + token_id == o.token_id && + payment_source_id == o.payment_source_id && + contract_id == o.contract_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [expires_at, type, token_id, payment_source_id, contract_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_response.rb b/lib/conekta/models/charge_response.rb new file mode 100644 index 0000000..e68c168 --- /dev/null +++ b/lib/conekta/models/charge_response.rb @@ -0,0 +1,385 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ChargeResponse + attr_accessor :amount + + attr_accessor :channel + + attr_accessor :created_at + + attr_accessor :currency + + attr_accessor :customer_id + + attr_accessor :description + + attr_accessor :device_fingerprint + + attr_accessor :failure_code + + attr_accessor :failure_message + + attr_accessor :fee + + attr_accessor :id + + attr_accessor :livemode + + attr_accessor :object + + attr_accessor :order_id + + attr_accessor :paid_at + + attr_accessor :payment_method + + # Reference ID of the charge + attr_accessor :reference_id + + attr_accessor :refunds + + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'channel' => :'channel', + :'created_at' => :'created_at', + :'currency' => :'currency', + :'customer_id' => :'customer_id', + :'description' => :'description', + :'device_fingerprint' => :'device_fingerprint', + :'failure_code' => :'failure_code', + :'failure_message' => :'failure_message', + :'fee' => :'fee', + :'id' => :'id', + :'livemode' => :'livemode', + :'object' => :'object', + :'order_id' => :'order_id', + :'paid_at' => :'paid_at', + :'payment_method' => :'payment_method', + :'reference_id' => :'reference_id', + :'refunds' => :'refunds', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'channel' => :'ChargeResponseChannel', + :'created_at' => :'Integer', + :'currency' => :'String', + :'customer_id' => :'String', + :'description' => :'String', + :'device_fingerprint' => :'String', + :'failure_code' => :'String', + :'failure_message' => :'String', + :'fee' => :'Integer', + :'id' => :'String', + :'livemode' => :'Boolean', + :'object' => :'String', + :'order_id' => :'String', + :'paid_at' => :'Integer', + :'payment_method' => :'ChargeResponsePaymentMethod', + :'reference_id' => :'String', + :'refunds' => :'ChargeResponseRefunds', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'paid_at', + :'reference_id', + :'refunds', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'device_fingerprint') + self.device_fingerprint = attributes[:'device_fingerprint'] + end + + if attributes.key?(:'failure_code') + self.failure_code = attributes[:'failure_code'] + end + + if attributes.key?(:'failure_message') + self.failure_message = attributes[:'failure_message'] + end + + if attributes.key?(:'fee') + self.fee = attributes[:'fee'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'paid_at') + self.paid_at = attributes[:'paid_at'] + end + + if attributes.key?(:'payment_method') + self.payment_method = attributes[:'payment_method'] + end + + if attributes.key?(:'reference_id') + self.reference_id = attributes[:'reference_id'] + end + + if attributes.key?(:'refunds') + self.refunds = attributes[:'refunds'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + channel == o.channel && + created_at == o.created_at && + currency == o.currency && + customer_id == o.customer_id && + description == o.description && + device_fingerprint == o.device_fingerprint && + failure_code == o.failure_code && + failure_message == o.failure_message && + fee == o.fee && + id == o.id && + livemode == o.livemode && + object == o.object && + order_id == o.order_id && + paid_at == o.paid_at && + payment_method == o.payment_method && + reference_id == o.reference_id && + refunds == o.refunds && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, channel, created_at, currency, customer_id, description, device_fingerprint, failure_code, failure_message, fee, id, livemode, object, order_id, paid_at, payment_method, reference_id, refunds, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_response_channel.rb b/lib/conekta/models/charge_response_channel.rb new file mode 100644 index 0000000..ac6e605 --- /dev/null +++ b/lib/conekta/models/charge_response_channel.rb @@ -0,0 +1,246 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ChargeResponseChannel + attr_accessor :segment + + attr_accessor :checkout_request_id + + attr_accessor :checkout_request_type + + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'segment' => :'segment', + :'checkout_request_id' => :'checkout_request_id', + :'checkout_request_type' => :'checkout_request_type', + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'segment' => :'String', + :'checkout_request_id' => :'String', + :'checkout_request_type' => :'String', + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeResponseChannel` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeResponseChannel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'segment') + self.segment = attributes[:'segment'] + end + + if attributes.key?(:'checkout_request_id') + self.checkout_request_id = attributes[:'checkout_request_id'] + end + + if attributes.key?(:'checkout_request_type') + self.checkout_request_type = attributes[:'checkout_request_type'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + segment == o.segment && + checkout_request_id == o.checkout_request_id && + checkout_request_type == o.checkout_request_type && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [segment, checkout_request_id, checkout_request_type, id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_response_payment_method.rb b/lib/conekta/models/charge_response_payment_method.rb new file mode 100644 index 0000000..e920e2c --- /dev/null +++ b/lib/conekta/models/charge_response_payment_method.rb @@ -0,0 +1,57 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + module ChargeResponsePaymentMethod + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'PaymentMethodBankTransfer', + :'PaymentMethodCard', + :'PaymentMethodCash' + ] + end + + # Discriminator's property name (OpenAPI v3) + def openapi_discriminator_name + :'object' + end + + # Discriminator's mapping (OpenAPI v3) + def openapi_discriminator_mapping + { + :'bank_transfer_payment' => :'PaymentMethodBankTransfer', + :'card_payment' => :'PaymentMethodCard', + :'cash_payment' => :'PaymentMethodCash' + } + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + discriminator_value = data[openapi_discriminator_name] + return nil if discriminator_value.nil? + + klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym] + return nil unless klass + + Conekta.const_get(klass).build_from_hash(data) + end + end + end + +end diff --git a/lib/conekta/models/charge_response_refunds.rb b/lib/conekta/models/charge_response_refunds.rb new file mode 100644 index 0000000..3f62dd9 --- /dev/null +++ b/lib/conekta/models/charge_response_refunds.rb @@ -0,0 +1,283 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ChargeResponseRefunds + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + # refunds + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ChargeResponseRefundsAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeResponseRefunds` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeResponseRefunds`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_response_refunds_all_of.rb b/lib/conekta/models/charge_response_refunds_all_of.rb new file mode 100644 index 0000000..f1d60fd --- /dev/null +++ b/lib/conekta/models/charge_response_refunds_all_of.rb @@ -0,0 +1,222 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ChargeResponseRefundsAllOf + # refunds + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeResponseRefundsAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeResponseRefundsAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charge_response_refunds_data.rb b/lib/conekta/models/charge_response_refunds_data.rb new file mode 100644 index 0000000..71b07d5 --- /dev/null +++ b/lib/conekta/models/charge_response_refunds_data.rb @@ -0,0 +1,295 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ChargeResponseRefundsData + attr_accessor :amount + + attr_accessor :auth_code + + attr_accessor :created_at + + # refund expiration date + attr_accessor :expires_at + + attr_accessor :id + + attr_accessor :object + + # refund status + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'auth_code' => :'auth_code', + :'created_at' => :'created_at', + :'expires_at' => :'expires_at', + :'id' => :'id', + :'object' => :'object', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'auth_code' => :'String', + :'created_at' => :'Integer', + :'expires_at' => :'Integer', + :'id' => :'String', + :'object' => :'String', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargeResponseRefundsData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargeResponseRefundsData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'auth_code') + self.auth_code = attributes[:'auth_code'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @created_at.nil? + return false if @id.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + auth_code == o.auth_code && + created_at == o.created_at && + expires_at == o.expires_at && + id == o.id && + object == o.object && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, auth_code, created_at, expires_at, id, object, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charges_data_response.rb b/lib/conekta/models/charges_data_response.rb new file mode 100644 index 0000000..9e8d9cb --- /dev/null +++ b/lib/conekta/models/charges_data_response.rb @@ -0,0 +1,392 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ChargesDataResponse + attr_accessor :amount + + attr_accessor :channel + + attr_accessor :created_at + + attr_accessor :currency + + attr_accessor :customer_id + + attr_accessor :description + + attr_accessor :device_fingerprint + + attr_accessor :failure_code + + attr_accessor :failure_message + + attr_accessor :fee + + attr_accessor :id + + attr_accessor :livemode + + attr_accessor :object + + attr_accessor :order_id + + attr_accessor :paid_at + + attr_accessor :payment_method + + # Reference ID of the charge + attr_accessor :reference_id + + attr_accessor :refunds + + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'channel' => :'channel', + :'created_at' => :'created_at', + :'currency' => :'currency', + :'customer_id' => :'customer_id', + :'description' => :'description', + :'device_fingerprint' => :'device_fingerprint', + :'failure_code' => :'failure_code', + :'failure_message' => :'failure_message', + :'fee' => :'fee', + :'id' => :'id', + :'livemode' => :'livemode', + :'object' => :'object', + :'order_id' => :'order_id', + :'paid_at' => :'paid_at', + :'payment_method' => :'payment_method', + :'reference_id' => :'reference_id', + :'refunds' => :'refunds', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'channel' => :'ChargeResponseChannel', + :'created_at' => :'Integer', + :'currency' => :'String', + :'customer_id' => :'String', + :'description' => :'String', + :'device_fingerprint' => :'String', + :'failure_code' => :'String', + :'failure_message' => :'String', + :'fee' => :'Integer', + :'id' => :'String', + :'livemode' => :'Boolean', + :'object' => :'String', + :'order_id' => :'String', + :'paid_at' => :'Integer', + :'payment_method' => :'ChargeResponsePaymentMethod', + :'reference_id' => :'String', + :'refunds' => :'ChargeResponseRefunds', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'paid_at', + :'reference_id', + :'refunds', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ChargeResponse' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargesDataResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargesDataResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'device_fingerprint') + self.device_fingerprint = attributes[:'device_fingerprint'] + end + + if attributes.key?(:'failure_code') + self.failure_code = attributes[:'failure_code'] + end + + if attributes.key?(:'failure_message') + self.failure_message = attributes[:'failure_message'] + end + + if attributes.key?(:'fee') + self.fee = attributes[:'fee'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'paid_at') + self.paid_at = attributes[:'paid_at'] + end + + if attributes.key?(:'payment_method') + self.payment_method = attributes[:'payment_method'] + end + + if attributes.key?(:'reference_id') + self.reference_id = attributes[:'reference_id'] + end + + if attributes.key?(:'refunds') + self.refunds = attributes[:'refunds'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + channel == o.channel && + created_at == o.created_at && + currency == o.currency && + customer_id == o.customer_id && + description == o.description && + device_fingerprint == o.device_fingerprint && + failure_code == o.failure_code && + failure_message == o.failure_message && + fee == o.fee && + id == o.id && + livemode == o.livemode && + object == o.object && + order_id == o.order_id && + paid_at == o.paid_at && + payment_method == o.payment_method && + reference_id == o.reference_id && + refunds == o.refunds && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, channel, created_at, currency, customer_id, description, device_fingerprint, failure_code, failure_message, fee, id, livemode, object, order_id, paid_at, payment_method, reference_id, refunds, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/checkout.rb b/lib/conekta/models/checkout.rb new file mode 100644 index 0000000..ef5ab21 --- /dev/null +++ b/lib/conekta/models/checkout.rb @@ -0,0 +1,355 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # It is a sub-resource of the Order model that can be stipulated in order to configure its corresponding checkout + class Checkout + # Those are the payment methods that will be available for the link + attr_accessor :allowed_payment_methods + + # It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 2 to 365 days (the valid range will be taken from the next day of the creation date at 00:01 hrs) + attr_accessor :expires_at + + # This flag allows you to specify if months without interest will be active. + attr_accessor :monthly_installments_enabled + + # This field allows you to specify the number of months without interest. + attr_accessor :monthly_installments_options + + # Reason for charge + attr_accessor :name + + # This flag allows you to fill in the shipping information at checkout. + attr_accessor :needs_shipping_contact + + # This flag allows you to specify if the link will be on demand. + attr_accessor :on_demand_enabled + + attr_accessor :order_template + + # It is the number of payments that can be made through the link. + attr_accessor :payments_limit_count + + # false: single use. true: multiple payments + attr_accessor :recurrent + + # It is the type of link that will be created. It must be a valid type. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'allowed_payment_methods' => :'allowed_payment_methods', + :'expires_at' => :'expires_at', + :'monthly_installments_enabled' => :'monthly_installments_enabled', + :'monthly_installments_options' => :'monthly_installments_options', + :'name' => :'name', + :'needs_shipping_contact' => :'needs_shipping_contact', + :'on_demand_enabled' => :'on_demand_enabled', + :'order_template' => :'order_template', + :'payments_limit_count' => :'payments_limit_count', + :'recurrent' => :'recurrent', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'allowed_payment_methods' => :'Array', + :'expires_at' => :'Integer', + :'monthly_installments_enabled' => :'Boolean', + :'monthly_installments_options' => :'Array', + :'name' => :'String', + :'needs_shipping_contact' => :'Boolean', + :'on_demand_enabled' => :'Boolean', + :'order_template' => :'CheckoutOrderTemplate', + :'payments_limit_count' => :'Integer', + :'recurrent' => :'Boolean', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'on_demand_enabled', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::Checkout` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::Checkout`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'allowed_payment_methods') + if (value = attributes[:'allowed_payment_methods']).is_a?(Array) + self.allowed_payment_methods = value + end + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'monthly_installments_enabled') + self.monthly_installments_enabled = attributes[:'monthly_installments_enabled'] + end + + if attributes.key?(:'monthly_installments_options') + if (value = attributes[:'monthly_installments_options']).is_a?(Array) + self.monthly_installments_options = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'needs_shipping_contact') + self.needs_shipping_contact = attributes[:'needs_shipping_contact'] + end + + if attributes.key?(:'on_demand_enabled') + self.on_demand_enabled = attributes[:'on_demand_enabled'] + end + + if attributes.key?(:'order_template') + self.order_template = attributes[:'order_template'] + end + + if attributes.key?(:'payments_limit_count') + self.payments_limit_count = attributes[:'payments_limit_count'] + end + + if attributes.key?(:'recurrent') + self.recurrent = attributes[:'recurrent'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @allowed_payment_methods.nil? + invalid_properties.push('invalid value for "allowed_payment_methods", allowed_payment_methods cannot be nil.') + end + + if @expires_at.nil? + invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @order_template.nil? + invalid_properties.push('invalid value for "order_template", order_template cannot be nil.') + end + + if @recurrent.nil? + invalid_properties.push('invalid value for "recurrent", recurrent cannot be nil.') + end + + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @allowed_payment_methods.nil? + return false if @expires_at.nil? + return false if @name.nil? + return false if @order_template.nil? + return false if @recurrent.nil? + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + allowed_payment_methods == o.allowed_payment_methods && + expires_at == o.expires_at && + monthly_installments_enabled == o.monthly_installments_enabled && + monthly_installments_options == o.monthly_installments_options && + name == o.name && + needs_shipping_contact == o.needs_shipping_contact && + on_demand_enabled == o.on_demand_enabled && + order_template == o.order_template && + payments_limit_count == o.payments_limit_count && + recurrent == o.recurrent && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [allowed_payment_methods, expires_at, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, on_demand_enabled, order_template, payments_limit_count, recurrent, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/checkout_order_template.rb b/lib/conekta/models/checkout_order_template.rb new file mode 100644 index 0000000..ea1cb67 --- /dev/null +++ b/lib/conekta/models/checkout_order_template.rb @@ -0,0 +1,298 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # It maintains the attributes with which the order will be created when receiving a new payment. + class CheckoutOrderTemplate + # It is the currency in which the order will be created. It must be a valid ISO 4217 currency code. + attr_accessor :currency + + attr_accessor :customer_info + + # They are the products to buy. Each contains the \"unit price\" and \"quantity\" parameters that are used to calculate the total amount of the order. + attr_accessor :line_items + + # It is a set of key-value pairs that you can attach to the order. It can be used to store additional information about the order in a structured format. + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'currency' => :'currency', + :'customer_info' => :'customer_info', + :'line_items' => :'line_items', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'currency' => :'String', + :'customer_info' => :'CheckoutOrderTemplateCustomerInfo', + :'line_items' => :'Array', + :'metadata' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CheckoutOrderTemplate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CheckoutOrderTemplate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'customer_info') + self.customer_info = attributes[:'customer_info'] + end + + if attributes.key?(:'line_items') + if (value = attributes[:'line_items']).is_a?(Array) + self.line_items = value + end + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @currency.nil? + invalid_properties.push('invalid value for "currency", currency cannot be nil.') + end + + if @currency.to_s.length > 3 + invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') + end + + if @line_items.nil? + invalid_properties.push('invalid value for "line_items", line_items cannot be nil.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @currency.nil? + return false if @currency.to_s.length > 3 + return false if @line_items.nil? + return false if !@metadata.nil? && @metadata.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if currency.nil? + fail ArgumentError, 'currency cannot be nil' + end + + if currency.to_s.length > 3 + fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.' + end + + @currency = currency + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + currency == o.currency && + customer_info == o.customer_info && + line_items == o.line_items && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [currency, customer_info, line_items, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/checkout_order_template_customer_info.rb b/lib/conekta/models/checkout_order_template_customer_info.rb new file mode 100644 index 0000000..c76dbb2 --- /dev/null +++ b/lib/conekta/models/checkout_order_template_customer_info.rb @@ -0,0 +1,106 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # It is the information of the customer who will be created when receiving a new payment. + module CheckoutOrderTemplateCustomerInfo + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'CustomerInfo', + :'CustomerInfoJustCustomerId' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Conekta.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/conekta/models/checkout_request.rb b/lib/conekta/models/checkout_request.rb new file mode 100644 index 0000000..7005d78 --- /dev/null +++ b/lib/conekta/models/checkout_request.rb @@ -0,0 +1,307 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # [Checkout](https://developers.conekta.com/v2.1.0/reference/payment-link) details + class CheckoutRequest + # Are the payment methods available for this link + attr_accessor :allowed_payment_methods + + # Unix timestamp of checkout expiration + attr_accessor :expires_at + + # Redirection url back to the site in case of failed payment, applies only to HostedPayment. + attr_accessor :failure_url + + attr_accessor :monthly_installments_enabled + + attr_accessor :monthly_installments_options + + # Reason for payment + attr_accessor :name + + attr_accessor :on_demand_enabled + + # Redirection url back to the site in case of successful payment, applies only to HostedPayment + attr_accessor :success_url + + # This field represents the type of checkout + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'allowed_payment_methods' => :'allowed_payment_methods', + :'expires_at' => :'expires_at', + :'failure_url' => :'failure_url', + :'monthly_installments_enabled' => :'monthly_installments_enabled', + :'monthly_installments_options' => :'monthly_installments_options', + :'name' => :'name', + :'on_demand_enabled' => :'on_demand_enabled', + :'success_url' => :'success_url', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'allowed_payment_methods' => :'Array', + :'expires_at' => :'Integer', + :'failure_url' => :'String', + :'monthly_installments_enabled' => :'Boolean', + :'monthly_installments_options' => :'Array', + :'name' => :'String', + :'on_demand_enabled' => :'Boolean', + :'success_url' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CheckoutRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CheckoutRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'allowed_payment_methods') + if (value = attributes[:'allowed_payment_methods']).is_a?(Array) + self.allowed_payment_methods = value + end + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'failure_url') + self.failure_url = attributes[:'failure_url'] + end + + if attributes.key?(:'monthly_installments_enabled') + self.monthly_installments_enabled = attributes[:'monthly_installments_enabled'] + end + + if attributes.key?(:'monthly_installments_options') + if (value = attributes[:'monthly_installments_options']).is_a?(Array) + self.monthly_installments_options = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'on_demand_enabled') + self.on_demand_enabled = attributes[:'on_demand_enabled'] + end + + if attributes.key?(:'success_url') + self.success_url = attributes[:'success_url'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @allowed_payment_methods.nil? + invalid_properties.push('invalid value for "allowed_payment_methods", allowed_payment_methods cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @allowed_payment_methods.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + allowed_payment_methods == o.allowed_payment_methods && + expires_at == o.expires_at && + failure_url == o.failure_url && + monthly_installments_enabled == o.monthly_installments_enabled && + monthly_installments_options == o.monthly_installments_options && + name == o.name && + on_demand_enabled == o.on_demand_enabled && + success_url == o.success_url && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [allowed_payment_methods, expires_at, failure_url, monthly_installments_enabled, monthly_installments_options, name, on_demand_enabled, success_url, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/checkout_response.rb b/lib/conekta/models/checkout_response.rb new file mode 100644 index 0000000..91c1b09 --- /dev/null +++ b/lib/conekta/models/checkout_response.rb @@ -0,0 +1,466 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # checkout response + class CheckoutResponse + attr_accessor :allowed_payment_methods + + attr_accessor :can_not_expire + + attr_accessor :emails_sent + + attr_accessor :exclude_card_networks + + attr_accessor :expires_at + + attr_accessor :failure_url + + attr_accessor :force_3ds_flow + + attr_accessor :id + + attr_accessor :livemode + + attr_accessor :metadata + + attr_accessor :monthly_installments_enabled + + attr_accessor :monthly_installments_options + + # Reason for charge + attr_accessor :name + + attr_accessor :needs_shipping_contact + + attr_accessor :object + + attr_accessor :paid_payments_count + + attr_accessor :payments_limit_count + + attr_accessor :recurrent + + attr_accessor :slug + + attr_accessor :sms_sent + + attr_accessor :starts_at + + attr_accessor :status + + attr_accessor :success_url + + attr_accessor :type + + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'allowed_payment_methods' => :'allowed_payment_methods', + :'can_not_expire' => :'can_not_expire', + :'emails_sent' => :'emails_sent', + :'exclude_card_networks' => :'exclude_card_networks', + :'expires_at' => :'expires_at', + :'failure_url' => :'failure_url', + :'force_3ds_flow' => :'force_3ds_flow', + :'id' => :'id', + :'livemode' => :'livemode', + :'metadata' => :'metadata', + :'monthly_installments_enabled' => :'monthly_installments_enabled', + :'monthly_installments_options' => :'monthly_installments_options', + :'name' => :'name', + :'needs_shipping_contact' => :'needs_shipping_contact', + :'object' => :'object', + :'paid_payments_count' => :'paid_payments_count', + :'payments_limit_count' => :'payments_limit_count', + :'recurrent' => :'recurrent', + :'slug' => :'slug', + :'sms_sent' => :'sms_sent', + :'starts_at' => :'starts_at', + :'status' => :'status', + :'success_url' => :'success_url', + :'type' => :'type', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'allowed_payment_methods' => :'Array', + :'can_not_expire' => :'Boolean', + :'emails_sent' => :'Integer', + :'exclude_card_networks' => :'Array', + :'expires_at' => :'Integer', + :'failure_url' => :'String', + :'force_3ds_flow' => :'Boolean', + :'id' => :'String', + :'livemode' => :'Boolean', + :'metadata' => :'Hash', + :'monthly_installments_enabled' => :'Boolean', + :'monthly_installments_options' => :'Array', + :'name' => :'String', + :'needs_shipping_contact' => :'Boolean', + :'object' => :'String', + :'paid_payments_count' => :'Integer', + :'payments_limit_count' => :'Integer', + :'recurrent' => :'Boolean', + :'slug' => :'String', + :'sms_sent' => :'Integer', + :'starts_at' => :'Integer', + :'status' => :'String', + :'success_url' => :'String', + :'type' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'payments_limit_count', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CheckoutResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CheckoutResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'allowed_payment_methods') + if (value = attributes[:'allowed_payment_methods']).is_a?(Array) + self.allowed_payment_methods = value + end + end + + if attributes.key?(:'can_not_expire') + self.can_not_expire = attributes[:'can_not_expire'] + end + + if attributes.key?(:'emails_sent') + self.emails_sent = attributes[:'emails_sent'] + end + + if attributes.key?(:'exclude_card_networks') + if (value = attributes[:'exclude_card_networks']).is_a?(Array) + self.exclude_card_networks = value + end + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'failure_url') + self.failure_url = attributes[:'failure_url'] + end + + if attributes.key?(:'force_3ds_flow') + self.force_3ds_flow = attributes[:'force_3ds_flow'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'monthly_installments_enabled') + self.monthly_installments_enabled = attributes[:'monthly_installments_enabled'] + end + + if attributes.key?(:'monthly_installments_options') + if (value = attributes[:'monthly_installments_options']).is_a?(Array) + self.monthly_installments_options = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'needs_shipping_contact') + self.needs_shipping_contact = attributes[:'needs_shipping_contact'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'paid_payments_count') + self.paid_payments_count = attributes[:'paid_payments_count'] + end + + if attributes.key?(:'payments_limit_count') + self.payments_limit_count = attributes[:'payments_limit_count'] + end + + if attributes.key?(:'recurrent') + self.recurrent = attributes[:'recurrent'] + end + + if attributes.key?(:'slug') + self.slug = attributes[:'slug'] + end + + if attributes.key?(:'sms_sent') + self.sms_sent = attributes[:'sms_sent'] + end + + if attributes.key?(:'starts_at') + self.starts_at = attributes[:'starts_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'success_url') + self.success_url = attributes[:'success_url'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @livemode.nil? + invalid_properties.push('invalid value for "livemode", livemode cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @livemode.nil? + return false if @name.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + allowed_payment_methods == o.allowed_payment_methods && + can_not_expire == o.can_not_expire && + emails_sent == o.emails_sent && + exclude_card_networks == o.exclude_card_networks && + expires_at == o.expires_at && + failure_url == o.failure_url && + force_3ds_flow == o.force_3ds_flow && + id == o.id && + livemode == o.livemode && + metadata == o.metadata && + monthly_installments_enabled == o.monthly_installments_enabled && + monthly_installments_options == o.monthly_installments_options && + name == o.name && + needs_shipping_contact == o.needs_shipping_contact && + object == o.object && + paid_payments_count == o.paid_payments_count && + payments_limit_count == o.payments_limit_count && + recurrent == o.recurrent && + slug == o.slug && + sms_sent == o.sms_sent && + starts_at == o.starts_at && + status == o.status && + success_url == o.success_url && + type == o.type && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [allowed_payment_methods, can_not_expire, emails_sent, exclude_card_networks, expires_at, failure_url, force_3ds_flow, id, livemode, metadata, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, object, paid_payments_count, payments_limit_count, recurrent, slug, sms_sent, starts_at, status, success_url, type, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/checkouts_response.rb b/lib/conekta/models/checkouts_response.rb new file mode 100644 index 0000000..95823e2 --- /dev/null +++ b/lib/conekta/models/checkouts_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CheckoutsResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CheckoutsResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CheckoutsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CheckoutsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/checkouts_response_all_of.rb b/lib/conekta/models/checkouts_response_all_of.rb new file mode 100644 index 0000000..2bdabcc --- /dev/null +++ b/lib/conekta/models/checkouts_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CheckoutsResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CheckoutsResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CheckoutsResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/company_fiscal_info_address_response.rb b/lib/conekta/models/company_fiscal_info_address_response.rb new file mode 100644 index 0000000..21411af --- /dev/null +++ b/lib/conekta/models/company_fiscal_info_address_response.rb @@ -0,0 +1,335 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Company fiscal info address model + class CompanyFiscalInfoAddressResponse + # The resource's type + attr_accessor :object + + # Street Address + attr_accessor :street1 + + # Colonia + attr_accessor :street2 + + # City + attr_accessor :city + + # State + attr_accessor :state + + # Country + attr_accessor :country + + # Postal code + attr_accessor :postal_code + + # Street number + attr_accessor :external_number + + # Unit / apartment number + attr_accessor :internal_number + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'street1' => :'street1', + :'street2' => :'street2', + :'city' => :'city', + :'state' => :'state', + :'country' => :'country', + :'postal_code' => :'postal_code', + :'external_number' => :'external_number', + :'internal_number' => :'internal_number' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'street1' => :'String', + :'street2' => :'String', + :'city' => :'String', + :'state' => :'String', + :'country' => :'String', + :'postal_code' => :'String', + :'external_number' => :'String', + :'internal_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CompanyFiscalInfoAddressResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CompanyFiscalInfoAddressResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'street1') + self.street1 = attributes[:'street1'] + end + + if attributes.key?(:'street2') + self.street2 = attributes[:'street2'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'external_number') + self.external_number = attributes[:'external_number'] + end + + if attributes.key?(:'internal_number') + self.internal_number = attributes[:'internal_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + object_validator = EnumAttributeValidator.new('String', ["address"]) + return false unless object_validator.valid?(@object) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] object Object to be assigned + def object=(object) + validator = EnumAttributeValidator.new('String', ["address"]) + unless validator.valid?(object) + fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." + end + @object = object + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + street1 == o.street1 && + street2 == o.street2 && + city == o.city && + state == o.state && + country == o.country && + postal_code == o.postal_code && + external_number == o.external_number && + internal_number == o.internal_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, street1, street2, city, state, country, postal_code, external_number, internal_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/company_fiscal_info_response.rb b/lib/conekta/models/company_fiscal_info_response.rb new file mode 100644 index 0000000..60b2700 --- /dev/null +++ b/lib/conekta/models/company_fiscal_info_response.rb @@ -0,0 +1,314 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Company fiscal info model + class CompanyFiscalInfoResponse + # The resource's type + attr_accessor :object + + # Tax ID of the company + attr_accessor :tax_id + + # Legal name of the company + attr_accessor :legal_entity_name + + # Business type of the company + attr_accessor :business_type + + # Phone number of the company + attr_accessor :phone + + # Business type if 'persona_fisica' + attr_accessor :physical_person_business_type + + attr_accessor :address + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'tax_id' => :'tax_id', + :'legal_entity_name' => :'legal_entity_name', + :'business_type' => :'business_type', + :'phone' => :'phone', + :'physical_person_business_type' => :'physical_person_business_type', + :'address' => :'address' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'tax_id' => :'String', + :'legal_entity_name' => :'String', + :'business_type' => :'String', + :'phone' => :'String', + :'physical_person_business_type' => :'String', + :'address' => :'CompanyFiscalInfoAddressResponse' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CompanyFiscalInfoResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CompanyFiscalInfoResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'tax_id') + self.tax_id = attributes[:'tax_id'] + end + + if attributes.key?(:'legal_entity_name') + self.legal_entity_name = attributes[:'legal_entity_name'] + end + + if attributes.key?(:'business_type') + self.business_type = attributes[:'business_type'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'physical_person_business_type') + self.physical_person_business_type = attributes[:'physical_person_business_type'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + object_validator = EnumAttributeValidator.new('String', ["fiscal_info"]) + return false unless object_validator.valid?(@object) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] object Object to be assigned + def object=(object) + validator = EnumAttributeValidator.new('String', ["fiscal_info"]) + unless validator.valid?(object) + fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." + end + @object = object + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + tax_id == o.tax_id && + legal_entity_name == o.legal_entity_name && + business_type == o.business_type && + phone == o.phone && + physical_person_business_type == o.physical_person_business_type && + address == o.address + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, tax_id, legal_entity_name, business_type, phone, physical_person_business_type, address].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/company_payout_destination_response.rb b/lib/conekta/models/company_payout_destination_response.rb new file mode 100644 index 0000000..ba3e74d --- /dev/null +++ b/lib/conekta/models/company_payout_destination_response.rb @@ -0,0 +1,317 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Company payout destination model + class CompanyPayoutDestinationResponse + # The resource's type + attr_accessor :object + + # currency of the receiving account + attr_accessor :currency + + # Name of the account holder + attr_accessor :account_holder_name + + # Name of the bank + attr_accessor :bank + + # Type of the payout destination + attr_accessor :type + + # Account number of the receiving account + attr_accessor :account_number + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'currency' => :'currency', + :'account_holder_name' => :'account_holder_name', + :'bank' => :'bank', + :'type' => :'type', + :'account_number' => :'account_number' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'currency' => :'String', + :'account_holder_name' => :'String', + :'bank' => :'String', + :'type' => :'String', + :'account_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CompanyPayoutDestinationResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CompanyPayoutDestinationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'account_holder_name') + self.account_holder_name = attributes[:'account_holder_name'] + end + + if attributes.key?(:'bank') + self.bank = attributes[:'bank'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'account_number') + self.account_number = attributes[:'account_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + object_validator = EnumAttributeValidator.new('String', ["payout_destination"]) + return false unless object_validator.valid?(@object) + type_validator = EnumAttributeValidator.new('String', ["bank_account"]) + return false unless type_validator.valid?(@type) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] object Object to be assigned + def object=(object) + validator = EnumAttributeValidator.new('String', ["payout_destination"]) + unless validator.valid?(object) + fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." + end + @object = object + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["bank_account"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + currency == o.currency && + account_holder_name == o.account_holder_name && + bank == o.bank && + type == o.type && + account_number == o.account_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, currency, account_holder_name, bank, type, account_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/company_response.rb b/lib/conekta/models/company_response.rb new file mode 100644 index 0000000..e1ef5c1 --- /dev/null +++ b/lib/conekta/models/company_response.rb @@ -0,0 +1,323 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Company model + class CompanyResponse + # The child company's unique identifier + attr_accessor :id + + # The resource's creation date (unix timestamp) + attr_accessor :created_at + + # The child company's name + attr_accessor :name + + # The resource's type + attr_accessor :object + + # Id of the parent company + attr_accessor :parent_company_id + + # Whether the parent company's fiscal data is to be used for liquidation and tax purposes + attr_accessor :use_parent_fiscal_data + + attr_accessor :payout_destination + + attr_accessor :fiscal_info + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'name' => :'name', + :'object' => :'object', + :'parent_company_id' => :'parent_company_id', + :'use_parent_fiscal_data' => :'use_parent_fiscal_data', + :'payout_destination' => :'payout_destination', + :'fiscal_info' => :'fiscal_info' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Integer', + :'name' => :'String', + :'object' => :'String', + :'parent_company_id' => :'String', + :'use_parent_fiscal_data' => :'Boolean', + :'payout_destination' => :'CompanyPayoutDestinationResponse', + :'fiscal_info' => :'CompanyFiscalInfoResponse' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CompanyResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CompanyResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_company_id') + self.parent_company_id = attributes[:'parent_company_id'] + end + + if attributes.key?(:'use_parent_fiscal_data') + self.use_parent_fiscal_data = attributes[:'use_parent_fiscal_data'] + end + + if attributes.key?(:'payout_destination') + self.payout_destination = attributes[:'payout_destination'] + end + + if attributes.key?(:'fiscal_info') + self.fiscal_info = attributes[:'fiscal_info'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + object_validator = EnumAttributeValidator.new('String', ["company"]) + return false unless object_validator.valid?(@object) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] object Object to be assigned + def object=(object) + validator = EnumAttributeValidator.new('String', ["company"]) + unless validator.valid?(object) + fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}." + end + @object = object + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + name == o.name && + object == o.object && + parent_company_id == o.parent_company_id && + use_parent_fiscal_data == o.use_parent_fiscal_data && + payout_destination == o.payout_destination && + fiscal_info == o.fiscal_info + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, name, object, parent_company_id, use_parent_fiscal_data, payout_destination, fiscal_info].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/create_customer_fiscal_entities_response.rb b/lib/conekta/models/create_customer_fiscal_entities_response.rb new file mode 100644 index 0000000..c911f8e --- /dev/null +++ b/lib/conekta/models/create_customer_fiscal_entities_response.rb @@ -0,0 +1,339 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CreateCustomerFiscalEntitiesResponse + attr_accessor :address + + attr_accessor :tax_id + + attr_accessor :email + + attr_accessor :phone + + attr_accessor :metadata + + attr_accessor :company_name + + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + attr_accessor :parent_id + + attr_accessor :default + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'tax_id' => :'tax_id', + :'email' => :'email', + :'phone' => :'phone', + :'metadata' => :'metadata', + :'company_name' => :'company_name', + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'parent_id' => :'parent_id', + :'default' => :'default' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'address' => :'CustomerFiscalEntitiesRequestAddress', + :'tax_id' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'metadata' => :'Hash', + :'company_name' => :'String', + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer', + :'parent_id' => :'String', + :'default' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CreateCustomerFiscalEntitiesResponseAllOf', + :'CustomerFiscalEntitiesRequest' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CreateCustomerFiscalEntitiesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CreateCustomerFiscalEntitiesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'tax_id') + self.tax_id = attributes[:'tax_id'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'company_name') + self.company_name = attributes[:'company_name'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @address.nil? + invalid_properties.push('invalid value for "address", address cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @address.nil? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + address == o.address && + tax_id == o.tax_id && + email == o.email && + phone == o.phone && + metadata == o.metadata && + company_name == o.company_name && + id == o.id && + object == o.object && + created_at == o.created_at && + parent_id == o.parent_id && + default == o.default + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [address, tax_id, email, phone, metadata, company_name, id, object, created_at, parent_id, default].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/create_customer_fiscal_entities_response_all_of.rb b/lib/conekta/models/create_customer_fiscal_entities_response_all_of.rb new file mode 100644 index 0000000..461e941 --- /dev/null +++ b/lib/conekta/models/create_customer_fiscal_entities_response_all_of.rb @@ -0,0 +1,270 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CreateCustomerFiscalEntitiesResponseAllOf + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + attr_accessor :parent_id + + attr_accessor :default + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'parent_id' => :'parent_id', + :'default' => :'default' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer', + :'parent_id' => :'String', + :'default' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CreateCustomerFiscalEntitiesResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CreateCustomerFiscalEntitiesResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + created_at == o.created_at && + parent_id == o.parent_id && + default == o.default + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, created_at, parent_id, default].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/create_customer_payment_methods_request.rb b/lib/conekta/models/create_customer_payment_methods_request.rb new file mode 100644 index 0000000..1d48a0d --- /dev/null +++ b/lib/conekta/models/create_customer_payment_methods_request.rb @@ -0,0 +1,107 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Contains details of the payment methods that the customer has active or has used in Conekta + module CreateCustomerPaymentMethodsRequest + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'PaymentMethodCardRequest', + :'PaymentMethodCashRequest', + :'PaymentMethodSpeiRequest' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Conekta.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/conekta/models/create_customer_payment_methods_response.rb b/lib/conekta/models/create_customer_payment_methods_response.rb new file mode 100644 index 0000000..ff02a18 --- /dev/null +++ b/lib/conekta/models/create_customer_payment_methods_response.rb @@ -0,0 +1,58 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + module CreateCustomerPaymentMethodsResponse + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'PaymentMethodCardResponse', + :'PaymentMethodCashResponse', + :'PaymentMethodSpeiRecurrent' + ] + end + + # Discriminator's property name (OpenAPI v3) + def openapi_discriminator_name + :'type' + end + + # Discriminator's mapping (OpenAPI v3) + def openapi_discriminator_mapping + { + :'card' => :'PaymentMethodCardResponse', + :'cash' => :'PaymentMethodCashResponse', + :'oxxo_recurrent' => :'PaymentMethodCashResponse', + :'spei_recurrent' => :'PaymentMethodSpeiRecurrent' + } + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + discriminator_value = data[openapi_discriminator_name] + return nil if discriminator_value.nil? + + klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym] + return nil unless klass + + Conekta.const_get(klass).build_from_hash(data) + end + end + end + +end diff --git a/lib/conekta/models/create_risk_rules_data.rb b/lib/conekta/models/create_risk_rules_data.rb new file mode 100644 index 0000000..bed6d3e --- /dev/null +++ b/lib/conekta/models/create_risk_rules_data.rb @@ -0,0 +1,255 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CreateRiskRulesData + # Description of the rule + attr_accessor :description + + # Field to be used for the rule + attr_accessor :field + + # Value to be used for the rule + attr_accessor :value + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'field' => :'field', + :'value' => :'value' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'description' => :'String', + :'field' => :'String', + :'value' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CreateRiskRulesData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CreateRiskRulesData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @description.nil? + invalid_properties.push('invalid value for "description", description cannot be nil.') + end + + if @field.nil? + invalid_properties.push('invalid value for "field", field cannot be nil.') + end + + if @value.nil? + invalid_properties.push('invalid value for "value", value cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @description.nil? + return false if @field.nil? + return false if @value.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + field == o.field && + value == o.value + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [description, field, value].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer.rb b/lib/conekta/models/customer.rb new file mode 100644 index 0000000..debe7a7 --- /dev/null +++ b/lib/conekta/models/customer.rb @@ -0,0 +1,388 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # a customer + class Customer + attr_accessor :antifraud_info + + # It is a value that allows identifying if the email is corporate or not. + attr_accessor :corporate + + # It is an undefined value. + attr_accessor :custom_reference + + # An email address is a series of customizable characters followed by a universal Internet symbol, the at symbol (@), the name of a host server, and a web domain ending (.mx, .com, .org, . net, etc). + attr_accessor :email + + # It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id) + attr_accessor :default_payment_source_id + + # It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact) + attr_accessor :default_shipping_contact_id + + attr_accessor :fiscal_entities + + attr_accessor :metadata + + # Client's name + attr_accessor :name + + # Contains details of the payment methods that the customer has active or has used in Conekta + attr_accessor :payment_sources + + # Is the customer's phone number + attr_accessor :phone + + # Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription + attr_accessor :plan_id + + # Contains the detail of the shipping addresses that the client has active or has used in Conekta + attr_accessor :shipping_contacts + + attr_accessor :subscription + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'antifraud_info' => :'antifraud_info', + :'corporate' => :'corporate', + :'custom_reference' => :'custom_reference', + :'email' => :'email', + :'default_payment_source_id' => :'default_payment_source_id', + :'default_shipping_contact_id' => :'default_shipping_contact_id', + :'fiscal_entities' => :'fiscal_entities', + :'metadata' => :'metadata', + :'name' => :'name', + :'payment_sources' => :'payment_sources', + :'phone' => :'phone', + :'plan_id' => :'plan_id', + :'shipping_contacts' => :'shipping_contacts', + :'subscription' => :'subscription' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'antifraud_info' => :'CustomerAntifraudInfo', + :'corporate' => :'Boolean', + :'custom_reference' => :'String', + :'email' => :'String', + :'default_payment_source_id' => :'String', + :'default_shipping_contact_id' => :'String', + :'fiscal_entities' => :'Array', + :'metadata' => :'Hash', + :'name' => :'String', + :'payment_sources' => :'Array', + :'phone' => :'String', + :'plan_id' => :'String', + :'shipping_contacts' => :'Array', + :'subscription' => :'SubscriptionRequest' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'antifraud_info', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::Customer` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::Customer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'antifraud_info') + self.antifraud_info = attributes[:'antifraud_info'] + end + + if attributes.key?(:'corporate') + self.corporate = attributes[:'corporate'] + else + self.corporate = false + end + + if attributes.key?(:'custom_reference') + self.custom_reference = attributes[:'custom_reference'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'default_payment_source_id') + self.default_payment_source_id = attributes[:'default_payment_source_id'] + end + + if attributes.key?(:'default_shipping_contact_id') + self.default_shipping_contact_id = attributes[:'default_shipping_contact_id'] + end + + if attributes.key?(:'fiscal_entities') + if (value = attributes[:'fiscal_entities']).is_a?(Array) + self.fiscal_entities = value + end + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'payment_sources') + if (value = attributes[:'payment_sources']).is_a?(Array) + self.payment_sources = value + end + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'plan_id') + self.plan_id = attributes[:'plan_id'] + end + + if attributes.key?(:'shipping_contacts') + if (value = attributes[:'shipping_contacts']).is_a?(Array) + self.shipping_contacts = value + end + end + + if attributes.key?(:'subscription') + self.subscription = attributes[:'subscription'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @phone.nil? + invalid_properties.push('invalid value for "phone", phone cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @email.nil? + return false if !@metadata.nil? && @metadata.length > 100 + return false if @name.nil? + return false if @phone.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + antifraud_info == o.antifraud_info && + corporate == o.corporate && + custom_reference == o.custom_reference && + email == o.email && + default_payment_source_id == o.default_payment_source_id && + default_shipping_contact_id == o.default_shipping_contact_id && + fiscal_entities == o.fiscal_entities && + metadata == o.metadata && + name == o.name && + payment_sources == o.payment_sources && + phone == o.phone && + plan_id == o.plan_id && + shipping_contacts == o.shipping_contacts && + subscription == o.subscription + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [antifraud_info, corporate, custom_reference, email, default_payment_source_id, default_shipping_contact_id, fiscal_entities, metadata, name, payment_sources, phone, plan_id, shipping_contacts, subscription].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_address.rb b/lib/conekta/models/customer_address.rb new file mode 100644 index 0000000..f11ed6c --- /dev/null +++ b/lib/conekta/models/customer_address.rb @@ -0,0 +1,298 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerAddress + attr_accessor :street1 + + attr_accessor :street2 + + attr_accessor :postal_code + + attr_accessor :city + + attr_accessor :state + + # this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + attr_accessor :country + + attr_accessor :residential + + attr_accessor :external_number + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'street1' => :'street1', + :'street2' => :'street2', + :'postal_code' => :'postal_code', + :'city' => :'city', + :'state' => :'state', + :'country' => :'country', + :'residential' => :'residential', + :'external_number' => :'external_number' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'street1' => :'String', + :'street2' => :'String', + :'postal_code' => :'String', + :'city' => :'String', + :'state' => :'String', + :'country' => :'String', + :'residential' => :'Boolean', + :'external_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerAddress` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'street1') + self.street1 = attributes[:'street1'] + end + + if attributes.key?(:'street2') + self.street2 = attributes[:'street2'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'residential') + self.residential = attributes[:'residential'] + end + + if attributes.key?(:'external_number') + self.external_number = attributes[:'external_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @street1.nil? + invalid_properties.push('invalid value for "street1", street1 cannot be nil.') + end + + if @postal_code.nil? + invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.') + end + + if @city.nil? + invalid_properties.push('invalid value for "city", city cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @street1.nil? + return false if @postal_code.nil? + return false if @city.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + street1 == o.street1 && + street2 == o.street2 && + postal_code == o.postal_code && + city == o.city && + state == o.state && + country == o.country && + residential == o.residential && + external_number == o.external_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [street1, street2, postal_code, city, state, country, residential, external_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_antifraud_info.rb b/lib/conekta/models/customer_antifraud_info.rb new file mode 100644 index 0000000..ad72453 --- /dev/null +++ b/lib/conekta/models/customer_antifraud_info.rb @@ -0,0 +1,228 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerAntifraudInfo + attr_accessor :account_created_at + + attr_accessor :first_paid_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_created_at' => :'account_created_at', + :'first_paid_at' => :'first_paid_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_created_at' => :'Integer', + :'first_paid_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerAntifraudInfo` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerAntifraudInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_created_at') + self.account_created_at = attributes[:'account_created_at'] + end + + if attributes.key?(:'first_paid_at') + self.first_paid_at = attributes[:'first_paid_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_created_at == o.account_created_at && + first_paid_at == o.first_paid_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_created_at, first_paid_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_antifraud_info_response.rb b/lib/conekta/models/customer_antifraud_info_response.rb new file mode 100644 index 0000000..dd1df46 --- /dev/null +++ b/lib/conekta/models/customer_antifraud_info_response.rb @@ -0,0 +1,228 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerAntifraudInfoResponse + attr_accessor :first_paid_at + + attr_accessor :account_created_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'first_paid_at' => :'first_paid_at', + :'account_created_at' => :'account_created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'first_paid_at' => :'Integer', + :'account_created_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerAntifraudInfoResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerAntifraudInfoResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'first_paid_at') + self.first_paid_at = attributes[:'first_paid_at'] + end + + if attributes.key?(:'account_created_at') + self.account_created_at = attributes[:'account_created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_paid_at == o.first_paid_at && + account_created_at == o.account_created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [first_paid_at, account_created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_fiscal_entities_data_response.rb b/lib/conekta/models/customer_fiscal_entities_data_response.rb new file mode 100644 index 0000000..474f0a7 --- /dev/null +++ b/lib/conekta/models/customer_fiscal_entities_data_response.rb @@ -0,0 +1,339 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerFiscalEntitiesDataResponse + attr_accessor :address + + attr_accessor :tax_id + + attr_accessor :email + + attr_accessor :phone + + attr_accessor :metadata + + attr_accessor :company_name + + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + attr_accessor :parent_id + + attr_accessor :default + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'tax_id' => :'tax_id', + :'email' => :'email', + :'phone' => :'phone', + :'metadata' => :'metadata', + :'company_name' => :'company_name', + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'parent_id' => :'parent_id', + :'default' => :'default' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'address' => :'CustomerFiscalEntitiesRequestAddress', + :'tax_id' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'metadata' => :'Hash', + :'company_name' => :'String', + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer', + :'parent_id' => :'String', + :'default' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CreateCustomerFiscalEntitiesResponseAllOf', + :'CustomerFiscalEntitiesRequest' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerFiscalEntitiesDataResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerFiscalEntitiesDataResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'tax_id') + self.tax_id = attributes[:'tax_id'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'company_name') + self.company_name = attributes[:'company_name'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @address.nil? + invalid_properties.push('invalid value for "address", address cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @address.nil? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + address == o.address && + tax_id == o.tax_id && + email == o.email && + phone == o.phone && + metadata == o.metadata && + company_name == o.company_name && + id == o.id && + object == o.object && + created_at == o.created_at && + parent_id == o.parent_id && + default == o.default + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [address, tax_id, email, phone, metadata, company_name, id, object, created_at, parent_id, default].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_fiscal_entities_request.rb b/lib/conekta/models/customer_fiscal_entities_request.rb new file mode 100644 index 0000000..2b89220 --- /dev/null +++ b/lib/conekta/models/customer_fiscal_entities_request.rb @@ -0,0 +1,271 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerFiscalEntitiesRequest + attr_accessor :address + + attr_accessor :tax_id + + attr_accessor :email + + attr_accessor :phone + + attr_accessor :metadata + + attr_accessor :company_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'tax_id' => :'tax_id', + :'email' => :'email', + :'phone' => :'phone', + :'metadata' => :'metadata', + :'company_name' => :'company_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'address' => :'CustomerFiscalEntitiesRequestAddress', + :'tax_id' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'metadata' => :'Hash', + :'company_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerFiscalEntitiesRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerFiscalEntitiesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'tax_id') + self.tax_id = attributes[:'tax_id'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'company_name') + self.company_name = attributes[:'company_name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @address.nil? + invalid_properties.push('invalid value for "address", address cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @address.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + address == o.address && + tax_id == o.tax_id && + email == o.email && + phone == o.phone && + metadata == o.metadata && + company_name == o.company_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [address, tax_id, email, phone, metadata, company_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_fiscal_entities_request_address.rb b/lib/conekta/models/customer_fiscal_entities_request_address.rb new file mode 100644 index 0000000..ebb357c --- /dev/null +++ b/lib/conekta/models/customer_fiscal_entities_request_address.rb @@ -0,0 +1,305 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerFiscalEntitiesRequestAddress + attr_accessor :street1 + + attr_accessor :street2 + + attr_accessor :postal_code + + attr_accessor :city + + attr_accessor :state + + # this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + attr_accessor :country + + attr_accessor :residential + + attr_accessor :external_number + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'street1' => :'street1', + :'street2' => :'street2', + :'postal_code' => :'postal_code', + :'city' => :'city', + :'state' => :'state', + :'country' => :'country', + :'residential' => :'residential', + :'external_number' => :'external_number' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'street1' => :'String', + :'street2' => :'String', + :'postal_code' => :'String', + :'city' => :'String', + :'state' => :'String', + :'country' => :'String', + :'residential' => :'Boolean', + :'external_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerAddress' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerFiscalEntitiesRequestAddress` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerFiscalEntitiesRequestAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'street1') + self.street1 = attributes[:'street1'] + end + + if attributes.key?(:'street2') + self.street2 = attributes[:'street2'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'residential') + self.residential = attributes[:'residential'] + end + + if attributes.key?(:'external_number') + self.external_number = attributes[:'external_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @street1.nil? + invalid_properties.push('invalid value for "street1", street1 cannot be nil.') + end + + if @postal_code.nil? + invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.') + end + + if @city.nil? + invalid_properties.push('invalid value for "city", city cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @street1.nil? + return false if @postal_code.nil? + return false if @city.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + street1 == o.street1 && + street2 == o.street2 && + postal_code == o.postal_code && + city == o.city && + state == o.state && + country == o.country && + residential == o.residential && + external_number == o.external_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [street1, street2, postal_code, city, state, country, residential, external_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_fiscal_entities_response.rb b/lib/conekta/models/customer_fiscal_entities_response.rb new file mode 100644 index 0000000..00af6b1 --- /dev/null +++ b/lib/conekta/models/customer_fiscal_entities_response.rb @@ -0,0 +1,259 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerFiscalEntitiesResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerFiscalEntitiesResponseAllOf', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerFiscalEntitiesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerFiscalEntitiesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_fiscal_entities_response_all_of.rb b/lib/conekta/models/customer_fiscal_entities_response_all_of.rb new file mode 100644 index 0000000..929c98c --- /dev/null +++ b/lib/conekta/models/customer_fiscal_entities_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerFiscalEntitiesResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerFiscalEntitiesResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerFiscalEntitiesResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_info.rb b/lib/conekta/models/customer_info.rb new file mode 100644 index 0000000..65c6a45 --- /dev/null +++ b/lib/conekta/models/customer_info.rb @@ -0,0 +1,270 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerInfo + attr_accessor :name + + attr_accessor :email + + attr_accessor :phone + + attr_accessor :corporate + + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'email' => :'email', + :'phone' => :'phone', + :'corporate' => :'corporate', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'corporate' => :'Boolean', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerInfo` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'corporate') + self.corporate = attributes[:'corporate'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @phone.nil? + invalid_properties.push('invalid value for "phone", phone cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @name.nil? + return false if @email.nil? + return false if @phone.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + email == o.email && + phone == o.phone && + corporate == o.corporate && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, email, phone, corporate, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_info_just_customer_id.rb b/lib/conekta/models/customer_info_just_customer_id.rb new file mode 100644 index 0000000..6d29c7e --- /dev/null +++ b/lib/conekta/models/customer_info_just_customer_id.rb @@ -0,0 +1,224 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerInfoJustCustomerId + attr_accessor :customer_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer_id' => :'customer_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'customer_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerInfoJustCustomerId` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerInfoJustCustomerId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @customer_id.nil? + invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @customer_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + customer_id == o.customer_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [customer_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_info_just_customer_id_response.rb b/lib/conekta/models/customer_info_just_customer_id_response.rb new file mode 100644 index 0000000..e6293fa --- /dev/null +++ b/lib/conekta/models/customer_info_just_customer_id_response.rb @@ -0,0 +1,219 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerInfoJustCustomerIdResponse + attr_accessor :customer_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer_id' => :'customer_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'customer_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerInfoJustCustomerIdResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerInfoJustCustomerIdResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + customer_id == o.customer_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [customer_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_info_response.rb b/lib/conekta/models/customer_info_response.rb new file mode 100644 index 0000000..1dbde74 --- /dev/null +++ b/lib/conekta/models/customer_info_response.rb @@ -0,0 +1,257 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerInfoResponse + attr_accessor :name + + attr_accessor :email + + attr_accessor :phone + + attr_accessor :corporate + + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'email' => :'email', + :'phone' => :'phone', + :'corporate' => :'corporate', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'corporate' => :'Boolean', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerInfoResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerInfoResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'corporate') + self.corporate = attributes[:'corporate'] + else + self.corporate = false + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + email == o.email && + phone == o.phone && + corporate == o.corporate && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, email, phone, corporate, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_payment_method_request.rb b/lib/conekta/models/customer_payment_method_request.rb new file mode 100644 index 0000000..5e28a0a --- /dev/null +++ b/lib/conekta/models/customer_payment_method_request.rb @@ -0,0 +1,226 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Contains details of the payment methods that the customer has active or has used in Conekta + class CustomerPaymentMethodRequest + # Type of payment method + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerPaymentMethodRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerPaymentMethodRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_payment_methods.rb b/lib/conekta/models/customer_payment_methods.rb new file mode 100644 index 0000000..5877b81 --- /dev/null +++ b/lib/conekta/models/customer_payment_methods.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerPaymentMethods + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerPaymentMethods` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerPaymentMethods`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_payment_methods_data.rb b/lib/conekta/models/customer_payment_methods_data.rb new file mode 100644 index 0000000..d3bd1c6 --- /dev/null +++ b/lib/conekta/models/customer_payment_methods_data.rb @@ -0,0 +1,58 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + module CustomerPaymentMethodsData + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'PaymentMethodCardResponse', + :'PaymentMethodCashResponse', + :'PaymentMethodSpeiRecurrent' + ] + end + + # Discriminator's property name (OpenAPI v3) + def openapi_discriminator_name + :'type' + end + + # Discriminator's mapping (OpenAPI v3) + def openapi_discriminator_mapping + { + :'card' => :'PaymentMethodCardResponse', + :'cash' => :'PaymentMethodCashResponse', + :'oxxo_recurrent' => :'PaymentMethodCashResponse', + :'spei_recurrent' => :'PaymentMethodSpeiRecurrent' + } + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + discriminator_value = data[openapi_discriminator_name] + return nil if discriminator_value.nil? + + klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym] + return nil unless klass + + Conekta.const_get(klass).build_from_hash(data) + end + end + end + +end diff --git a/lib/conekta/models/customer_payment_methods_request.rb b/lib/conekta/models/customer_payment_methods_request.rb new file mode 100644 index 0000000..5518d74 --- /dev/null +++ b/lib/conekta/models/customer_payment_methods_request.rb @@ -0,0 +1,106 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + module CustomerPaymentMethodsRequest + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'PaymentMethodCardRequest', + :'PaymentMethodCashRequest', + :'PaymentMethodSpeiRequest' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Conekta.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/conekta/models/customer_payment_methods_response.rb b/lib/conekta/models/customer_payment_methods_response.rb new file mode 100644 index 0000000..50459ec --- /dev/null +++ b/lib/conekta/models/customer_payment_methods_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerPaymentMethodsResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerPaymentMethods', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerPaymentMethodsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerPaymentMethodsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_response.rb b/lib/conekta/models/customer_response.rb new file mode 100644 index 0000000..494def5 --- /dev/null +++ b/lib/conekta/models/customer_response.rb @@ -0,0 +1,387 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # customer response + class CustomerResponse + attr_accessor :antifraud_info + + attr_accessor :corporate + + attr_accessor :created_at + + attr_accessor :custom_reference + + attr_accessor :default_fiscal_entity_id + + attr_accessor :default_shipping_contact_id + + attr_accessor :default_payment_source_id + + attr_accessor :email + + attr_accessor :fiscal_entities + + attr_accessor :id + + attr_accessor :livemode + + attr_accessor :name + + attr_accessor :object + + attr_accessor :payment_sources + + attr_accessor :phone + + attr_accessor :shipping_contacts + + attr_accessor :subscription + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'antifraud_info' => :'antifraud_info', + :'corporate' => :'corporate', + :'created_at' => :'created_at', + :'custom_reference' => :'custom_reference', + :'default_fiscal_entity_id' => :'default_fiscal_entity_id', + :'default_shipping_contact_id' => :'default_shipping_contact_id', + :'default_payment_source_id' => :'default_payment_source_id', + :'email' => :'email', + :'fiscal_entities' => :'fiscal_entities', + :'id' => :'id', + :'livemode' => :'livemode', + :'name' => :'name', + :'object' => :'object', + :'payment_sources' => :'payment_sources', + :'phone' => :'phone', + :'shipping_contacts' => :'shipping_contacts', + :'subscription' => :'subscription' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'antifraud_info' => :'CustomerAntifraudInfoResponse', + :'corporate' => :'Boolean', + :'created_at' => :'Integer', + :'custom_reference' => :'String', + :'default_fiscal_entity_id' => :'String', + :'default_shipping_contact_id' => :'String', + :'default_payment_source_id' => :'String', + :'email' => :'String', + :'fiscal_entities' => :'CustomerFiscalEntitiesResponse', + :'id' => :'String', + :'livemode' => :'Boolean', + :'name' => :'String', + :'object' => :'String', + :'payment_sources' => :'CustomerPaymentMethodsResponse', + :'phone' => :'String', + :'shipping_contacts' => :'CustomerResponseShippingContacts', + :'subscription' => :'SubscriptionResponse' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'antifraud_info', + :'default_fiscal_entity_id', + :'default_payment_source_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'antifraud_info') + self.antifraud_info = attributes[:'antifraud_info'] + end + + if attributes.key?(:'corporate') + self.corporate = attributes[:'corporate'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'custom_reference') + self.custom_reference = attributes[:'custom_reference'] + end + + if attributes.key?(:'default_fiscal_entity_id') + self.default_fiscal_entity_id = attributes[:'default_fiscal_entity_id'] + end + + if attributes.key?(:'default_shipping_contact_id') + self.default_shipping_contact_id = attributes[:'default_shipping_contact_id'] + end + + if attributes.key?(:'default_payment_source_id') + self.default_payment_source_id = attributes[:'default_payment_source_id'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'fiscal_entities') + self.fiscal_entities = attributes[:'fiscal_entities'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'payment_sources') + self.payment_sources = attributes[:'payment_sources'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'shipping_contacts') + self.shipping_contacts = attributes[:'shipping_contacts'] + end + + if attributes.key?(:'subscription') + self.subscription = attributes[:'subscription'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @livemode.nil? + invalid_properties.push('invalid value for "livemode", livemode cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @created_at.nil? + return false if @id.nil? + return false if @livemode.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + antifraud_info == o.antifraud_info && + corporate == o.corporate && + created_at == o.created_at && + custom_reference == o.custom_reference && + default_fiscal_entity_id == o.default_fiscal_entity_id && + default_shipping_contact_id == o.default_shipping_contact_id && + default_payment_source_id == o.default_payment_source_id && + email == o.email && + fiscal_entities == o.fiscal_entities && + id == o.id && + livemode == o.livemode && + name == o.name && + object == o.object && + payment_sources == o.payment_sources && + phone == o.phone && + shipping_contacts == o.shipping_contacts && + subscription == o.subscription + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [antifraud_info, corporate, created_at, custom_reference, default_fiscal_entity_id, default_shipping_contact_id, default_payment_source_id, email, fiscal_entities, id, livemode, name, object, payment_sources, phone, shipping_contacts, subscription].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_response_shipping_contacts.rb b/lib/conekta/models/customer_response_shipping_contacts.rb new file mode 100644 index 0000000..3f218de --- /dev/null +++ b/lib/conekta/models/customer_response_shipping_contacts.rb @@ -0,0 +1,259 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerResponseShippingContacts + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerResponseShippingContactsAllOf', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerResponseShippingContacts` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerResponseShippingContacts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_response_shipping_contacts_all_of.rb b/lib/conekta/models/customer_response_shipping_contacts_all_of.rb new file mode 100644 index 0000000..e3bbeec --- /dev/null +++ b/lib/conekta/models/customer_response_shipping_contacts_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerResponseShippingContactsAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerResponseShippingContactsAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerResponseShippingContactsAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_shipping_contacts.rb b/lib/conekta/models/customer_shipping_contacts.rb new file mode 100644 index 0000000..5c79d1a --- /dev/null +++ b/lib/conekta/models/customer_shipping_contacts.rb @@ -0,0 +1,284 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # [Shipping](https://developers.conekta.com/v2.1.0/reference/createcustomershippingcontacts) details, required in case of sending a shipping. If we do not receive a shipping_contact on the order, the default shipping_contact of the customer will be used. + class CustomerShippingContacts + # Phone contact + attr_accessor :phone + + # Name of the person who will receive the order + attr_accessor :receiver + + # The street names between which the order will be delivered. + attr_accessor :between_streets + + attr_accessor :address + + attr_accessor :parent_id + + attr_accessor :default + + attr_accessor :deleted + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phone' => :'phone', + :'receiver' => :'receiver', + :'between_streets' => :'between_streets', + :'address' => :'address', + :'parent_id' => :'parent_id', + :'default' => :'default', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'phone' => :'String', + :'receiver' => :'String', + :'between_streets' => :'String', + :'address' => :'CustomerShippingContactsAddress', + :'parent_id' => :'String', + :'default' => :'Boolean', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'default', + :'deleted' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerShippingContacts` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerShippingContacts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'receiver') + self.receiver = attributes[:'receiver'] + end + + if attributes.key?(:'between_streets') + self.between_streets = attributes[:'between_streets'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @address.nil? + invalid_properties.push('invalid value for "address", address cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @address.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phone == o.phone && + receiver == o.receiver && + between_streets == o.between_streets && + address == o.address && + parent_id == o.parent_id && + default == o.default && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phone, receiver, between_streets, address, parent_id, default, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_shipping_contacts_address.rb b/lib/conekta/models/customer_shipping_contacts_address.rb new file mode 100644 index 0000000..fbde75e --- /dev/null +++ b/lib/conekta/models/customer_shipping_contacts_address.rb @@ -0,0 +1,276 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Address of the person who will receive the order + class CustomerShippingContactsAddress + attr_accessor :street1 + + attr_accessor :street2 + + attr_accessor :postal_code + + attr_accessor :city + + attr_accessor :state + + # this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + attr_accessor :country + + attr_accessor :residential + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'street1' => :'street1', + :'street2' => :'street2', + :'postal_code' => :'postal_code', + :'city' => :'city', + :'state' => :'state', + :'country' => :'country', + :'residential' => :'residential' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'street1' => :'String', + :'street2' => :'String', + :'postal_code' => :'String', + :'city' => :'String', + :'state' => :'String', + :'country' => :'String', + :'residential' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'residential' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerShippingContactsAddress` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerShippingContactsAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'street1') + self.street1 = attributes[:'street1'] + end + + if attributes.key?(:'street2') + self.street2 = attributes[:'street2'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'residential') + self.residential = attributes[:'residential'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + street1 == o.street1 && + street2 == o.street2 && + postal_code == o.postal_code && + city == o.city && + state == o.state && + country == o.country && + residential == o.residential + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [street1, street2, postal_code, city, state, country, residential].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_shipping_contacts_data_response.rb b/lib/conekta/models/customer_shipping_contacts_data_response.rb new file mode 100644 index 0000000..3cb8490 --- /dev/null +++ b/lib/conekta/models/customer_shipping_contacts_data_response.rb @@ -0,0 +1,333 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerShippingContactsDataResponse + # Phone contact + attr_accessor :phone + + # Name of the person who will receive the order + attr_accessor :receiver + + # The street names between which the order will be delivered. + attr_accessor :between_streets + + attr_accessor :address + + attr_accessor :parent_id + + attr_accessor :default + + attr_accessor :deleted + + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phone' => :'phone', + :'receiver' => :'receiver', + :'between_streets' => :'between_streets', + :'address' => :'address', + :'parent_id' => :'parent_id', + :'default' => :'default', + :'deleted' => :'deleted', + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'phone' => :'String', + :'receiver' => :'String', + :'between_streets' => :'String', + :'address' => :'CustomerShippingContactsAddress', + :'parent_id' => :'String', + :'default' => :'Boolean', + :'deleted' => :'Boolean', + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'default', + :'deleted', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerShippingContacts', + :'CustomerShippingContactsDataResponseAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerShippingContactsDataResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerShippingContactsDataResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'receiver') + self.receiver = attributes[:'receiver'] + end + + if attributes.key?(:'between_streets') + self.between_streets = attributes[:'between_streets'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @address.nil? + invalid_properties.push('invalid value for "address", address cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @address.nil? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phone == o.phone && + receiver == o.receiver && + between_streets == o.between_streets && + address == o.address && + parent_id == o.parent_id && + default == o.default && + deleted == o.deleted && + id == o.id && + object == o.object && + created_at == o.created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phone, receiver, between_streets, address, parent_id, default, deleted, id, object, created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_shipping_contacts_data_response_all_of.rb b/lib/conekta/models/customer_shipping_contacts_data_response_all_of.rb new file mode 100644 index 0000000..fde008e --- /dev/null +++ b/lib/conekta/models/customer_shipping_contacts_data_response_all_of.rb @@ -0,0 +1,252 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerShippingContactsDataResponseAllOf + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerShippingContactsDataResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerShippingContactsDataResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + created_at == o.created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_shipping_contacts_response.rb b/lib/conekta/models/customer_shipping_contacts_response.rb new file mode 100644 index 0000000..32c5e2f --- /dev/null +++ b/lib/conekta/models/customer_shipping_contacts_response.rb @@ -0,0 +1,302 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Contains the detail of the shipping addresses that the client has active or has used in Conekta + class CustomerShippingContactsResponse + attr_accessor :phone + + attr_accessor :receiver + + attr_accessor :between_streets + + attr_accessor :address + + attr_accessor :parent_id + + attr_accessor :default + + attr_accessor :id + + attr_accessor :created_at + + attr_accessor :object + + attr_accessor :deleted + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phone' => :'phone', + :'receiver' => :'receiver', + :'between_streets' => :'between_streets', + :'address' => :'address', + :'parent_id' => :'parent_id', + :'default' => :'default', + :'id' => :'id', + :'created_at' => :'created_at', + :'object' => :'object', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'phone' => :'String', + :'receiver' => :'String', + :'between_streets' => :'String', + :'address' => :'CustomerShippingContactsResponseAddress', + :'parent_id' => :'String', + :'default' => :'Boolean', + :'id' => :'String', + :'created_at' => :'Integer', + :'object' => :'String', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'between_streets', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerShippingContactsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerShippingContactsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'receiver') + self.receiver = attributes[:'receiver'] + end + + if attributes.key?(:'between_streets') + self.between_streets = attributes[:'between_streets'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phone == o.phone && + receiver == o.receiver && + between_streets == o.between_streets && + address == o.address && + parent_id == o.parent_id && + default == o.default && + id == o.id && + created_at == o.created_at && + object == o.object && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phone, receiver, between_streets, address, parent_id, default, id, created_at, object, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_shipping_contacts_response_address.rb b/lib/conekta/models/customer_shipping_contacts_response_address.rb new file mode 100644 index 0000000..d2de44b --- /dev/null +++ b/lib/conekta/models/customer_shipping_contacts_response_address.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerShippingContactsResponseAddress + attr_accessor :object + + attr_accessor :street1 + + attr_accessor :street2 + + attr_accessor :postal_code + + attr_accessor :city + + attr_accessor :state + + attr_accessor :country + + attr_accessor :residential + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'street1' => :'street1', + :'street2' => :'street2', + :'postal_code' => :'postal_code', + :'city' => :'city', + :'state' => :'state', + :'country' => :'country', + :'residential' => :'residential' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'street1' => :'String', + :'street2' => :'String', + :'postal_code' => :'String', + :'city' => :'String', + :'state' => :'String', + :'country' => :'String', + :'residential' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerShippingContactsResponseAddress` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerShippingContactsResponseAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'street1') + self.street1 = attributes[:'street1'] + end + + if attributes.key?(:'street2') + self.street2 = attributes[:'street2'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'residential') + self.residential = attributes[:'residential'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + street1 == o.street1 && + street2 == o.street2 && + postal_code == o.postal_code && + city == o.city && + state == o.state && + country == o.country && + residential == o.residential + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, street1, street2, postal_code, city, state, country, residential].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_update_fiscal_entities_request.rb b/lib/conekta/models/customer_update_fiscal_entities_request.rb new file mode 100644 index 0000000..9e54639 --- /dev/null +++ b/lib/conekta/models/customer_update_fiscal_entities_request.rb @@ -0,0 +1,266 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomerUpdateFiscalEntitiesRequest + attr_accessor :address + + attr_accessor :tax_id + + attr_accessor :email + + attr_accessor :phone + + attr_accessor :metadata + + attr_accessor :company_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'tax_id' => :'tax_id', + :'email' => :'email', + :'phone' => :'phone', + :'metadata' => :'metadata', + :'company_name' => :'company_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'address' => :'CustomerFiscalEntitiesRequestAddress', + :'tax_id' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'metadata' => :'Hash', + :'company_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerUpdateFiscalEntitiesRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerUpdateFiscalEntitiesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'tax_id') + self.tax_id = attributes[:'tax_id'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'company_name') + self.company_name = attributes[:'company_name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + address == o.address && + tax_id == o.tax_id && + email == o.email && + phone == o.phone && + metadata == o.metadata && + company_name == o.company_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [address, tax_id, email, phone, metadata, company_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customer_update_shipping_contacts.rb b/lib/conekta/models/customer_update_shipping_contacts.rb new file mode 100644 index 0000000..3700651 --- /dev/null +++ b/lib/conekta/models/customer_update_shipping_contacts.rb @@ -0,0 +1,279 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # [Shipping](https://developers.conekta.com/v2.1.0/reference/createcustomershippingcontacts) details, required in case of sending a shipping. If we do not receive a shipping_contact on the order, the default shipping_contact of the customer will be used. + class CustomerUpdateShippingContacts + # Phone contact + attr_accessor :phone + + # Name of the person who will receive the order + attr_accessor :receiver + + # The street names between which the order will be delivered. + attr_accessor :between_streets + + attr_accessor :address + + attr_accessor :parent_id + + attr_accessor :default + + attr_accessor :deleted + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phone' => :'phone', + :'receiver' => :'receiver', + :'between_streets' => :'between_streets', + :'address' => :'address', + :'parent_id' => :'parent_id', + :'default' => :'default', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'phone' => :'String', + :'receiver' => :'String', + :'between_streets' => :'String', + :'address' => :'CustomerShippingContactsAddress', + :'parent_id' => :'String', + :'default' => :'Boolean', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'default', + :'deleted' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomerUpdateShippingContacts` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomerUpdateShippingContacts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'receiver') + self.receiver = attributes[:'receiver'] + end + + if attributes.key?(:'between_streets') + self.between_streets = attributes[:'between_streets'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phone == o.phone && + receiver == o.receiver && + between_streets == o.between_streets && + address == o.address && + parent_id == o.parent_id && + default == o.default && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phone, receiver, between_streets, address, parent_id, default, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customers_response.rb b/lib/conekta/models/customers_response.rb new file mode 100644 index 0000000..2b88d4f --- /dev/null +++ b/lib/conekta/models/customers_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomersResponse + attr_accessor :data + + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array', + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url' + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomersResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomersResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomersResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, has_more, object, next_page_url, previous_page_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/customers_response_all_of.rb b/lib/conekta/models/customers_response_all_of.rb new file mode 100644 index 0000000..6fc2461 --- /dev/null +++ b/lib/conekta/models/customers_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class CustomersResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::CustomersResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::CustomersResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/delete_api_keys_response.rb b/lib/conekta/models/delete_api_keys_response.rb new file mode 100644 index 0000000..9ff2110 --- /dev/null +++ b/lib/conekta/models/delete_api_keys_response.rb @@ -0,0 +1,307 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class DeleteApiKeysResponse + # Indicates if the api key is active + attr_accessor :active + + # Unix timestamp in seconds of when the api key was created + attr_accessor :created_at + + # A name or brief explanation of what this api key is used for + attr_accessor :description + + # Indicates if the api key is in production + attr_accessor :livemode + + # The first few characters of the authentication_token + attr_accessor :prefix + + # Unique identifier of the api key + attr_accessor :id + + # Object name, value is 'api_key' + attr_accessor :object + + attr_accessor :deleted + + # Indicates if the api key is private or public + attr_accessor :role + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'active' => :'active', + :'created_at' => :'created_at', + :'description' => :'description', + :'livemode' => :'livemode', + :'prefix' => :'prefix', + :'id' => :'id', + :'object' => :'object', + :'deleted' => :'deleted', + :'role' => :'role' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'active' => :'Boolean', + :'created_at' => :'Integer', + :'description' => :'String', + :'livemode' => :'Boolean', + :'prefix' => :'String', + :'id' => :'String', + :'object' => :'String', + :'deleted' => :'Boolean', + :'role' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ApiKeyResponseOnDelete', + :'DeleteApiKeysResponseAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::DeleteApiKeysResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::DeleteApiKeysResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'prefix') + self.prefix = attributes[:'prefix'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active && + created_at == o.created_at && + description == o.description && + livemode == o.livemode && + prefix == o.prefix && + id == o.id && + object == o.object && + deleted == o.deleted && + role == o.role + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [active, created_at, description, livemode, prefix, id, object, deleted, role].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/delete_api_keys_response_all_of.rb b/lib/conekta/models/delete_api_keys_response_all_of.rb new file mode 100644 index 0000000..7e7d8f8 --- /dev/null +++ b/lib/conekta/models/delete_api_keys_response_all_of.rb @@ -0,0 +1,219 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class DeleteApiKeysResponseAllOf + attr_accessor :deleted + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::DeleteApiKeysResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::DeleteApiKeysResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/deleted_blacklist_rule_response.rb b/lib/conekta/models/deleted_blacklist_rule_response.rb new file mode 100644 index 0000000..216fd2d --- /dev/null +++ b/lib/conekta/models/deleted_blacklist_rule_response.rb @@ -0,0 +1,250 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class DeletedBlacklistRuleResponse + # Blacklist rule id + attr_accessor :id + + # field used for blacklists rule deleted + attr_accessor :field + + # value used for blacklists rule deleted + attr_accessor :value + + # use an description for blacklisted rule + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'field' => :'field', + :'value' => :'value', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'field' => :'String', + :'value' => :'String', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::DeletedBlacklistRuleResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::DeletedBlacklistRuleResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + field == o.field && + value == o.value && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, field, value, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/deleted_whitelist_rule_response.rb b/lib/conekta/models/deleted_whitelist_rule_response.rb new file mode 100644 index 0000000..d2b81c5 --- /dev/null +++ b/lib/conekta/models/deleted_whitelist_rule_response.rb @@ -0,0 +1,250 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class DeletedWhitelistRuleResponse + # Whitelist rule id + attr_accessor :id + + # field used for whitelists rule deleted + attr_accessor :field + + # value used for whitelists rule deleted + attr_accessor :value + + # use an description for whitelisted rule + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'field' => :'field', + :'value' => :'value', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'field' => :'String', + :'value' => :'String', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::DeletedWhitelistRuleResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::DeletedWhitelistRuleResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + field == o.field && + value == o.value && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, field, value, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/details.rb b/lib/conekta/models/details.rb new file mode 100644 index 0000000..7e5e953 --- /dev/null +++ b/lib/conekta/models/details.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class Details + attr_accessor :details + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'details' => :'details' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'details' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::Details` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::Details`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'details') + if (value = attributes[:'details']).is_a?(Array) + self.details = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + details == o.details + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [details].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/details_error.rb b/lib/conekta/models/details_error.rb new file mode 100644 index 0000000..7ea90ec --- /dev/null +++ b/lib/conekta/models/details_error.rb @@ -0,0 +1,247 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class DetailsError + attr_accessor :code + + attr_accessor :param + + attr_accessor :message + + attr_accessor :debug_message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'code' => :'code', + :'param' => :'param', + :'message' => :'message', + :'debug_message' => :'debug_message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'code' => :'String', + :'param' => :'String', + :'message' => :'String', + :'debug_message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'param', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::DetailsError` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::DetailsError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'param') + self.param = attributes[:'param'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'debug_message') + self.debug_message = attributes[:'debug_message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code && + param == o.param && + message == o.message && + debug_message == o.debug_message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [code, param, message, debug_message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/discount_lines_data_response.rb b/lib/conekta/models/discount_lines_data_response.rb new file mode 100644 index 0000000..7e69dc1 --- /dev/null +++ b/lib/conekta/models/discount_lines_data_response.rb @@ -0,0 +1,326 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class DiscountLinesDataResponse + # The amount to be deducted from the total sum of all payments, in cents. + attr_accessor :amount + + # Discount code. + attr_accessor :code + + # It can be 'loyalty', 'campaign', 'coupon' o 'sign' + attr_accessor :type + + # The discount line id + attr_accessor :id + + # The object name + attr_accessor :object + + # The order id + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'code' => :'code', + :'type' => :'type', + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'code' => :'String', + :'type' => :'String', + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DiscountLinesResponse' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::DiscountLinesDataResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::DiscountLinesDataResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @amount < 0 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') + end + + if @code.nil? + invalid_properties.push('invalid value for "code", code cannot be nil.') + end + + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @parent_id.nil? + invalid_properties.push('invalid value for "parent_id", parent_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @amount < 0 + return false if @code.nil? + return false if @type.nil? + return false if @id.nil? + return false if @object.nil? + return false if @parent_id.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + if amount < 0 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.' + end + + @amount = amount + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + code == o.code && + type == o.type && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, code, type, id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/discount_lines_response.rb b/lib/conekta/models/discount_lines_response.rb new file mode 100644 index 0000000..af5bdc9 --- /dev/null +++ b/lib/conekta/models/discount_lines_response.rb @@ -0,0 +1,327 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class DiscountLinesResponse + # The amount to be deducted from the total sum of all payments, in cents. + attr_accessor :amount + + # Discount code. + attr_accessor :code + + # It can be 'loyalty', 'campaign', 'coupon' o 'sign' + attr_accessor :type + + # The discount line id + attr_accessor :id + + # The object name + attr_accessor :object + + # The order id + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'code' => :'code', + :'type' => :'type', + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'code' => :'String', + :'type' => :'String', + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DiscountLinesResponseAllOf', + :'OrderDiscountLinesRequest' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::DiscountLinesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::DiscountLinesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @amount < 0 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') + end + + if @code.nil? + invalid_properties.push('invalid value for "code", code cannot be nil.') + end + + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @parent_id.nil? + invalid_properties.push('invalid value for "parent_id", parent_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @amount < 0 + return false if @code.nil? + return false if @type.nil? + return false if @id.nil? + return false if @object.nil? + return false if @parent_id.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + if amount < 0 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.' + end + + @amount = amount + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + code == o.code && + type == o.type && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, code, type, id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/discount_lines_response_all_of.rb b/lib/conekta/models/discount_lines_response_all_of.rb new file mode 100644 index 0000000..affde3c --- /dev/null +++ b/lib/conekta/models/discount_lines_response_all_of.rb @@ -0,0 +1,255 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class DiscountLinesResponseAllOf + # The discount line id + attr_accessor :id + + # The object name + attr_accessor :object + + # The order id + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::DiscountLinesResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::DiscountLinesResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @parent_id.nil? + invalid_properties.push('invalid value for "parent_id", parent_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @object.nil? + return false if @parent_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/email_checkout_request.rb b/lib/conekta/models/email_checkout_request.rb new file mode 100644 index 0000000..e74239c --- /dev/null +++ b/lib/conekta/models/email_checkout_request.rb @@ -0,0 +1,224 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class EmailCheckoutRequest + attr_accessor :email + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'email' => :'email' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'email' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::EmailCheckoutRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::EmailCheckoutRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @email.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [email].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/error.rb b/lib/conekta/models/error.rb new file mode 100644 index 0000000..23f65cf --- /dev/null +++ b/lib/conekta/models/error.rb @@ -0,0 +1,259 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # err model + class Error + attr_accessor :details + + # log id + attr_accessor :log_id + + attr_accessor :type + + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'details' => :'details', + :'log_id' => :'log_id', + :'type' => :'type', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'details' => :'Array', + :'log_id' => :'String', + :'type' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'log_id', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Details', + :'ErrorAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::Error` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'details') + if (value = attributes[:'details']).is_a?(Array) + self.details = value + end + end + + if attributes.key?(:'log_id') + self.log_id = attributes[:'log_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + details == o.details && + log_id == o.log_id && + type == o.type && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [details, log_id, type, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/error_all_of.rb b/lib/conekta/models/error_all_of.rb new file mode 100644 index 0000000..08740ef --- /dev/null +++ b/lib/conekta/models/error_all_of.rb @@ -0,0 +1,239 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ErrorAllOf + # log id + attr_accessor :log_id + + attr_accessor :type + + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'log_id' => :'log_id', + :'type' => :'type', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'log_id' => :'String', + :'type' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'log_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ErrorAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ErrorAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'log_id') + self.log_id = attributes[:'log_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + log_id == o.log_id && + type == o.type && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [log_id, type, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/event_response.rb b/lib/conekta/models/event_response.rb new file mode 100644 index 0000000..0f49471 --- /dev/null +++ b/lib/conekta/models/event_response.rb @@ -0,0 +1,302 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # event model + class EventResponse + attr_accessor :created_at + + attr_accessor :data + + attr_accessor :id + + attr_accessor :livemode + + attr_accessor :object + + attr_accessor :type + + attr_accessor :webhook_logs + + attr_accessor :webhook_status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'created_at' => :'created_at', + :'data' => :'data', + :'id' => :'id', + :'livemode' => :'livemode', + :'object' => :'object', + :'type' => :'type', + :'webhook_logs' => :'webhook_logs', + :'webhook_status' => :'webhook_status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'created_at' => :'Integer', + :'data' => :'Hash', + :'id' => :'String', + :'livemode' => :'Boolean', + :'object' => :'String', + :'type' => :'String', + :'webhook_logs' => :'Array', + :'webhook_status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::EventResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::EventResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Hash) + self.data = value + end + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'webhook_logs') + if (value = attributes[:'webhook_logs']).is_a?(Array) + self.webhook_logs = value + end + end + + if attributes.key?(:'webhook_status') + self.webhook_status = attributes[:'webhook_status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@data.nil? && @data.length > 100 + invalid_properties.push('invalid value for "data", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@data.nil? && @data.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] data Value to be assigned + def data=(data) + if !data.nil? && data.length > 100 + fail ArgumentError, 'invalid value for "data", number of items must be less than or equal to 100.' + end + + @data = data + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + data == o.data && + id == o.id && + livemode == o.livemode && + object == o.object && + type == o.type && + webhook_logs == o.webhook_logs && + webhook_status == o.webhook_status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [created_at, data, id, livemode, object, type, webhook_logs, webhook_status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/events_resend_response.rb b/lib/conekta/models/events_resend_response.rb new file mode 100644 index 0000000..379be92 --- /dev/null +++ b/lib/conekta/models/events_resend_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # event model + class EventsResendResponse + attr_accessor :failed_attempts + + attr_accessor :id + + attr_accessor :last_attempted_at + + attr_accessor :last_http_response_status + + attr_accessor :response_data + + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'failed_attempts' => :'failed_attempts', + :'id' => :'id', + :'last_attempted_at' => :'last_attempted_at', + :'last_http_response_status' => :'last_http_response_status', + :'response_data' => :'response_data', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'failed_attempts' => :'Integer', + :'id' => :'String', + :'last_attempted_at' => :'Integer', + :'last_http_response_status' => :'Integer', + :'response_data' => :'Hash', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::EventsResendResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::EventsResendResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'failed_attempts') + self.failed_attempts = attributes[:'failed_attempts'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'last_attempted_at') + self.last_attempted_at = attributes[:'last_attempted_at'] + end + + if attributes.key?(:'last_http_response_status') + self.last_http_response_status = attributes[:'last_http_response_status'] + end + + if attributes.key?(:'response_data') + if (value = attributes[:'response_data']).is_a?(Hash) + self.response_data = value + end + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@response_data.nil? && @response_data.length > 100 + invalid_properties.push('invalid value for "response_data", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@response_data.nil? && @response_data.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] response_data Value to be assigned + def response_data=(response_data) + if !response_data.nil? && response_data.length > 100 + fail ArgumentError, 'invalid value for "response_data", number of items must be less than or equal to 100.' + end + + @response_data = response_data + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + failed_attempts == o.failed_attempts && + id == o.id && + last_attempted_at == o.last_attempted_at && + last_http_response_status == o.last_http_response_status && + response_data == o.response_data && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [failed_attempts, id, last_attempted_at, last_http_response_status, response_data, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_api_keys_response.rb b/lib/conekta/models/get_api_keys_response.rb new file mode 100644 index 0000000..4eb95ff --- /dev/null +++ b/lib/conekta/models/get_api_keys_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetApiKeysResponse + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'has_more' => :'has_more', + :'object' => :'object', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'has_more' => :'Boolean', + :'object' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetApiKeysResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetApiKeysResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetApiKeysResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + has_more == o.has_more && + object == o.object && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [next_page_url, previous_page_url, has_more, object, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_api_keys_response_all_of.rb b/lib/conekta/models/get_api_keys_response_all_of.rb new file mode 100644 index 0000000..4872520 --- /dev/null +++ b/lib/conekta/models/get_api_keys_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetApiKeysResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetApiKeysResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetApiKeysResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_charges_response.rb b/lib/conekta/models/get_charges_response.rb new file mode 100644 index 0000000..2c3368d --- /dev/null +++ b/lib/conekta/models/get_charges_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetChargesResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetChargesResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetChargesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetChargesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_charges_response_all_of.rb b/lib/conekta/models/get_charges_response_all_of.rb new file mode 100644 index 0000000..5df7414 --- /dev/null +++ b/lib/conekta/models/get_charges_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetChargesResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetChargesResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetChargesResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_companies_response.rb b/lib/conekta/models/get_companies_response.rb new file mode 100644 index 0000000..f53b300 --- /dev/null +++ b/lib/conekta/models/get_companies_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetCompaniesResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetCompaniesResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetCompaniesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetCompaniesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_companies_response_all_of.rb b/lib/conekta/models/get_companies_response_all_of.rb new file mode 100644 index 0000000..5d5a649 --- /dev/null +++ b/lib/conekta/models/get_companies_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetCompaniesResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetCompaniesResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetCompaniesResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_customer_payment_method_data_response.rb b/lib/conekta/models/get_customer_payment_method_data_response.rb new file mode 100644 index 0000000..bb166bb --- /dev/null +++ b/lib/conekta/models/get_customer_payment_method_data_response.rb @@ -0,0 +1,58 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + module GetCustomerPaymentMethodDataResponse + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'PaymentMethodCardResponse', + :'PaymentMethodCashResponse', + :'PaymentMethodSpeiRecurrent' + ] + end + + # Discriminator's property name (OpenAPI v3) + def openapi_discriminator_name + :'type' + end + + # Discriminator's mapping (OpenAPI v3) + def openapi_discriminator_mapping + { + :'card' => :'PaymentMethodCardResponse', + :'cash' => :'PaymentMethodCashResponse', + :'oxxo_recurrent' => :'PaymentMethodCashResponse', + :'spei_recurrent' => :'PaymentMethodSpeiRecurrent' + } + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + discriminator_value = data[openapi_discriminator_name] + return nil if discriminator_value.nil? + + klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym] + return nil unless klass + + Conekta.const_get(klass).build_from_hash(data) + end + end + end + +end diff --git a/lib/conekta/models/get_events_response.rb b/lib/conekta/models/get_events_response.rb new file mode 100644 index 0000000..b77d23a --- /dev/null +++ b/lib/conekta/models/get_events_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetEventsResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetEventsResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetEventsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetEventsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_events_response_all_of.rb b/lib/conekta/models/get_events_response_all_of.rb new file mode 100644 index 0000000..8fdd63d --- /dev/null +++ b/lib/conekta/models/get_events_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetEventsResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetEventsResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetEventsResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_order_discount_lines_response.rb b/lib/conekta/models/get_order_discount_lines_response.rb new file mode 100644 index 0000000..0814b5c --- /dev/null +++ b/lib/conekta/models/get_order_discount_lines_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetOrderDiscountLinesResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetOrderDiscountLinesResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetOrderDiscountLinesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetOrderDiscountLinesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_order_discount_lines_response_all_of.rb b/lib/conekta/models/get_order_discount_lines_response_all_of.rb new file mode 100644 index 0000000..55a1cf4 --- /dev/null +++ b/lib/conekta/models/get_order_discount_lines_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetOrderDiscountLinesResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetOrderDiscountLinesResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetOrderDiscountLinesResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_orders_response.rb b/lib/conekta/models/get_orders_response.rb new file mode 100644 index 0000000..32f2d78 --- /dev/null +++ b/lib/conekta/models/get_orders_response.rb @@ -0,0 +1,287 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetOrdersResponse + attr_accessor :data + + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array', + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url' + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'OrdersResponse', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetOrdersResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetOrdersResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push('invalid value for "data", data cannot be nil.') + end + + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, has_more, object, next_page_url, previous_page_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_payment_method_response.rb b/lib/conekta/models/get_payment_method_response.rb new file mode 100644 index 0000000..4720ba2 --- /dev/null +++ b/lib/conekta/models/get_payment_method_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetPaymentMethodResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetPaymentMethodResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetPaymentMethodResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetPaymentMethodResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_payment_method_response_all_of.rb b/lib/conekta/models/get_payment_method_response_all_of.rb new file mode 100644 index 0000000..fbeff6a --- /dev/null +++ b/lib/conekta/models/get_payment_method_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetPaymentMethodResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetPaymentMethodResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetPaymentMethodResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_plans_response.rb b/lib/conekta/models/get_plans_response.rb new file mode 100644 index 0000000..866310f --- /dev/null +++ b/lib/conekta/models/get_plans_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetPlansResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetPlansResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetPlansResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetPlansResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_plans_response_all_of.rb b/lib/conekta/models/get_plans_response_all_of.rb new file mode 100644 index 0000000..8a1677e --- /dev/null +++ b/lib/conekta/models/get_plans_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetPlansResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetPlansResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetPlansResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_transactions_response.rb b/lib/conekta/models/get_transactions_response.rb new file mode 100644 index 0000000..a169343 --- /dev/null +++ b/lib/conekta/models/get_transactions_response.rb @@ -0,0 +1,283 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetTransactionsResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + # Transactions + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetTransactionsResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetTransactionsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetTransactionsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_transactions_response_all_of.rb b/lib/conekta/models/get_transactions_response_all_of.rb new file mode 100644 index 0000000..99368e4 --- /dev/null +++ b/lib/conekta/models/get_transactions_response_all_of.rb @@ -0,0 +1,222 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetTransactionsResponseAllOf + # Transactions + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetTransactionsResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetTransactionsResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_transfers_response.rb b/lib/conekta/models/get_transfers_response.rb new file mode 100644 index 0000000..dc46ab9 --- /dev/null +++ b/lib/conekta/models/get_transfers_response.rb @@ -0,0 +1,283 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetTransfersResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + # Transfers + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetTransfersResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetTransfersResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetTransfersResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_transfers_response_all_of.rb b/lib/conekta/models/get_transfers_response_all_of.rb new file mode 100644 index 0000000..a1766c4 --- /dev/null +++ b/lib/conekta/models/get_transfers_response_all_of.rb @@ -0,0 +1,222 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetTransfersResponseAllOf + # Transfers + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetTransfersResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetTransfersResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_webhook_keys_response.rb b/lib/conekta/models/get_webhook_keys_response.rb new file mode 100644 index 0000000..02f03b4 --- /dev/null +++ b/lib/conekta/models/get_webhook_keys_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetWebhookKeysResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetWebhookKeysResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetWebhookKeysResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetWebhookKeysResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_webhook_keys_response_all_of.rb b/lib/conekta/models/get_webhook_keys_response_all_of.rb new file mode 100644 index 0000000..f075daa --- /dev/null +++ b/lib/conekta/models/get_webhook_keys_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetWebhookKeysResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetWebhookKeysResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetWebhookKeysResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_webhooks_response.rb b/lib/conekta/models/get_webhooks_response.rb new file mode 100644 index 0000000..8f9b0ab --- /dev/null +++ b/lib/conekta/models/get_webhooks_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetWebhooksResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetWebhooksResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetWebhooksResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetWebhooksResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/get_webhooks_response_all_of.rb b/lib/conekta/models/get_webhooks_response_all_of.rb new file mode 100644 index 0000000..ab0215f --- /dev/null +++ b/lib/conekta/models/get_webhooks_response_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class GetWebhooksResponseAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::GetWebhooksResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::GetWebhooksResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/log_response.rb b/lib/conekta/models/log_response.rb new file mode 100644 index 0000000..fbe7857 --- /dev/null +++ b/lib/conekta/models/log_response.rb @@ -0,0 +1,417 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # log model + class LogResponse + attr_accessor :created_at + + attr_accessor :id + + attr_accessor :ip_address + + attr_accessor :livemode + + attr_accessor :loggable_id + + attr_accessor :loggable_type + + attr_accessor :method + + attr_accessor :oauth_token_id + + attr_accessor :query_string + + attr_accessor :related + + attr_accessor :request_body + + attr_accessor :request_headers + + attr_accessor :response_body + + attr_accessor :response_headers + + attr_accessor :searchable_tags + + attr_accessor :status + + attr_accessor :updated_at + + attr_accessor :url + + attr_accessor :user_account_id + + attr_accessor :version + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'created_at' => :'created_at', + :'id' => :'id', + :'ip_address' => :'ip_address', + :'livemode' => :'livemode', + :'loggable_id' => :'loggable_id', + :'loggable_type' => :'loggable_type', + :'method' => :'method', + :'oauth_token_id' => :'oauth_token_id', + :'query_string' => :'query_string', + :'related' => :'related', + :'request_body' => :'request_body', + :'request_headers' => :'request_headers', + :'response_body' => :'response_body', + :'response_headers' => :'response_headers', + :'searchable_tags' => :'searchable_tags', + :'status' => :'status', + :'updated_at' => :'updated_at', + :'url' => :'url', + :'user_account_id' => :'user_account_id', + :'version' => :'version' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'created_at' => :'Integer', + :'id' => :'String', + :'ip_address' => :'String', + :'livemode' => :'Boolean', + :'loggable_id' => :'String', + :'loggable_type' => :'String', + :'method' => :'String', + :'oauth_token_id' => :'String', + :'query_string' => :'Hash', + :'related' => :'String', + :'request_body' => :'Object', + :'request_headers' => :'Hash', + :'response_body' => :'Object', + :'response_headers' => :'Hash', + :'searchable_tags' => :'Array', + :'status' => :'String', + :'updated_at' => :'String', + :'url' => :'String', + :'user_account_id' => :'String', + :'version' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loggable_id', + :'loggable_type', + :'oauth_token_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::LogResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::LogResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'ip_address') + self.ip_address = attributes[:'ip_address'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'loggable_id') + self.loggable_id = attributes[:'loggable_id'] + end + + if attributes.key?(:'loggable_type') + self.loggable_type = attributes[:'loggable_type'] + end + + if attributes.key?(:'method') + self.method = attributes[:'method'] + end + + if attributes.key?(:'oauth_token_id') + self.oauth_token_id = attributes[:'oauth_token_id'] + end + + if attributes.key?(:'query_string') + if (value = attributes[:'query_string']).is_a?(Hash) + self.query_string = value + end + end + + if attributes.key?(:'related') + self.related = attributes[:'related'] + end + + if attributes.key?(:'request_body') + self.request_body = attributes[:'request_body'] + end + + if attributes.key?(:'request_headers') + if (value = attributes[:'request_headers']).is_a?(Hash) + self.request_headers = value + end + end + + if attributes.key?(:'response_body') + self.response_body = attributes[:'response_body'] + end + + if attributes.key?(:'response_headers') + if (value = attributes[:'response_headers']).is_a?(Hash) + self.response_headers = value + end + end + + if attributes.key?(:'searchable_tags') + if (value = attributes[:'searchable_tags']).is_a?(Array) + self.searchable_tags = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'user_account_id') + self.user_account_id = attributes[:'user_account_id'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @livemode.nil? + invalid_properties.push('invalid value for "livemode", livemode cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @created_at.nil? + return false if @id.nil? + return false if @livemode.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + id == o.id && + ip_address == o.ip_address && + livemode == o.livemode && + loggable_id == o.loggable_id && + loggable_type == o.loggable_type && + method == o.method && + oauth_token_id == o.oauth_token_id && + query_string == o.query_string && + related == o.related && + request_body == o.request_body && + request_headers == o.request_headers && + response_body == o.response_body && + response_headers == o.response_headers && + searchable_tags == o.searchable_tags && + status == o.status && + updated_at == o.updated_at && + url == o.url && + user_account_id == o.user_account_id && + version == o.version + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [created_at, id, ip_address, livemode, loggable_id, loggable_type, method, oauth_token_id, query_string, related, request_body, request_headers, response_body, response_headers, searchable_tags, status, updated_at, url, user_account_id, version].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/logs_response.rb b/lib/conekta/models/logs_response.rb new file mode 100644 index 0000000..53c8aeb --- /dev/null +++ b/lib/conekta/models/logs_response.rb @@ -0,0 +1,266 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # logs model + class LogsResponse + # True, if there are more pages. + attr_accessor :has_more + + # The object type + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + # set to page results. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + :'data' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::LogsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::LogsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/logs_response_data.rb b/lib/conekta/models/logs_response_data.rb new file mode 100644 index 0000000..863e350 --- /dev/null +++ b/lib/conekta/models/logs_response_data.rb @@ -0,0 +1,401 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class LogsResponseData + attr_accessor :created_at + + attr_accessor :id + + attr_accessor :ip_address + + attr_accessor :livemode + + attr_accessor :loggable_id + + attr_accessor :loggable_type + + attr_accessor :method + + attr_accessor :oauth_token_id + + attr_accessor :query_string + + attr_accessor :related + + attr_accessor :request_body + + attr_accessor :request_headers + + attr_accessor :response_body + + attr_accessor :response_headers + + attr_accessor :searchable_tags + + attr_accessor :status + + attr_accessor :updated_at + + attr_accessor :url + + attr_accessor :user_account_id + + attr_accessor :version + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'created_at' => :'created_at', + :'id' => :'id', + :'ip_address' => :'ip_address', + :'livemode' => :'livemode', + :'loggable_id' => :'loggable_id', + :'loggable_type' => :'loggable_type', + :'method' => :'method', + :'oauth_token_id' => :'oauth_token_id', + :'query_string' => :'query_string', + :'related' => :'related', + :'request_body' => :'request_body', + :'request_headers' => :'request_headers', + :'response_body' => :'response_body', + :'response_headers' => :'response_headers', + :'searchable_tags' => :'searchable_tags', + :'status' => :'status', + :'updated_at' => :'updated_at', + :'url' => :'url', + :'user_account_id' => :'user_account_id', + :'version' => :'version' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'created_at' => :'Integer', + :'id' => :'String', + :'ip_address' => :'String', + :'livemode' => :'Boolean', + :'loggable_id' => :'String', + :'loggable_type' => :'String', + :'method' => :'String', + :'oauth_token_id' => :'String', + :'query_string' => :'Hash', + :'related' => :'String', + :'request_body' => :'Object', + :'request_headers' => :'Hash', + :'response_body' => :'Object', + :'response_headers' => :'Hash', + :'searchable_tags' => :'Array', + :'status' => :'String', + :'updated_at' => :'String', + :'url' => :'String', + :'user_account_id' => :'String', + :'version' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'loggable_id', + :'loggable_type', + :'oauth_token_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::LogsResponseData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::LogsResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'ip_address') + self.ip_address = attributes[:'ip_address'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'loggable_id') + self.loggable_id = attributes[:'loggable_id'] + end + + if attributes.key?(:'loggable_type') + self.loggable_type = attributes[:'loggable_type'] + end + + if attributes.key?(:'method') + self.method = attributes[:'method'] + end + + if attributes.key?(:'oauth_token_id') + self.oauth_token_id = attributes[:'oauth_token_id'] + end + + if attributes.key?(:'query_string') + if (value = attributes[:'query_string']).is_a?(Hash) + self.query_string = value + end + end + + if attributes.key?(:'related') + self.related = attributes[:'related'] + end + + if attributes.key?(:'request_body') + self.request_body = attributes[:'request_body'] + end + + if attributes.key?(:'request_headers') + if (value = attributes[:'request_headers']).is_a?(Hash) + self.request_headers = value + end + end + + if attributes.key?(:'response_body') + self.response_body = attributes[:'response_body'] + end + + if attributes.key?(:'response_headers') + if (value = attributes[:'response_headers']).is_a?(Hash) + self.response_headers = value + end + end + + if attributes.key?(:'searchable_tags') + if (value = attributes[:'searchable_tags']).is_a?(Array) + self.searchable_tags = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'user_account_id') + self.user_account_id = attributes[:'user_account_id'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + id == o.id && + ip_address == o.ip_address && + livemode == o.livemode && + loggable_id == o.loggable_id && + loggable_type == o.loggable_type && + method == o.method && + oauth_token_id == o.oauth_token_id && + query_string == o.query_string && + related == o.related && + request_body == o.request_body && + request_headers == o.request_headers && + response_body == o.response_body && + response_headers == o.response_headers && + searchable_tags == o.searchable_tags && + status == o.status && + updated_at == o.updated_at && + url == o.url && + user_account_id == o.user_account_id && + version == o.version + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [created_at, id, ip_address, livemode, loggable_id, loggable_type, method, oauth_token_id, query_string, related, request_body, request_headers, response_body, response_headers, searchable_tags, status, updated_at, url, user_account_id, version].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_capture_request.rb b/lib/conekta/models/order_capture_request.rb new file mode 100644 index 0000000..308b335 --- /dev/null +++ b/lib/conekta/models/order_capture_request.rb @@ -0,0 +1,244 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderCaptureRequest + # Amount to capture + attr_accessor :amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderCaptureRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderCaptureRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @amount < 1 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @amount < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + if amount < 1 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 1.' + end + + @amount = amount + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_discount_lines_request.rb b/lib/conekta/models/order_discount_lines_request.rb new file mode 100644 index 0000000..ba6d23f --- /dev/null +++ b/lib/conekta/models/order_discount_lines_request.rb @@ -0,0 +1,275 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # List of discounts that apply to the order. + class OrderDiscountLinesRequest + # The amount to be deducted from the total sum of all payments, in cents. + attr_accessor :amount + + # Discount code. + attr_accessor :code + + # It can be 'loyalty', 'campaign', 'coupon' o 'sign' + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'code' => :'code', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'code' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderDiscountLinesRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderDiscountLinesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @amount < 0 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') + end + + if @code.nil? + invalid_properties.push('invalid value for "code", code cannot be nil.') + end + + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @amount < 0 + return false if @code.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + if amount < 0 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.' + end + + @amount = amount + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + code == o.code && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, code, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_refund_request.rb b/lib/conekta/models/order_refund_request.rb new file mode 100644 index 0000000..dec12af --- /dev/null +++ b/lib/conekta/models/order_refund_request.rb @@ -0,0 +1,248 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderRefundRequest + attr_accessor :amount + + attr_accessor :expires_at + + attr_accessor :reason + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'expires_at' => :'expires_at', + :'reason' => :'reason' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'expires_at' => :'Integer', + :'reason' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'expires_at', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderRefundRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderRefundRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @reason.nil? + invalid_properties.push('invalid value for "reason", reason cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @reason.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + expires_at == o.expires_at && + reason == o.reason + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, expires_at, reason].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_request.rb b/lib/conekta/models/order_request.rb new file mode 100644 index 0000000..37961da --- /dev/null +++ b/lib/conekta/models/order_request.rb @@ -0,0 +1,401 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # a order + class OrderRequest + # List of [charges](https://developers.conekta.com/v2.1.0/reference/orderscreatecharge) that are applied to the order + attr_accessor :charges + + attr_accessor :checkout + + # Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) + attr_accessor :currency + + attr_accessor :customer_info + + # List of [discounts](https://developers.conekta.com/v2.1.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount. + attr_accessor :discount_lines + + # List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product. + attr_accessor :line_items + + # Metadata associated with the order + attr_accessor :metadata + + # Allows you to fill out the shipping information at checkout + attr_accessor :needs_shipping_contact + + # Indicates whether the order charges must be preauthorized + attr_accessor :pre_authorize + + # Indicates the processing mode for the order, either ecommerce, recurrent or validation. + attr_accessor :processing_mode + + attr_accessor :shipping_contact + + # List of [shipping costs](https://developers.conekta.com/v2.1.0/reference/orderscreateshipping). If the online store offers digital products. + attr_accessor :shipping_lines + + # List of [taxes](https://developers.conekta.com/v2.1.0/reference/orderscreatetaxes) that are applied to the order. + attr_accessor :tax_lines + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'charges' => :'charges', + :'checkout' => :'checkout', + :'currency' => :'currency', + :'customer_info' => :'customer_info', + :'discount_lines' => :'discount_lines', + :'line_items' => :'line_items', + :'metadata' => :'metadata', + :'needs_shipping_contact' => :'needs_shipping_contact', + :'pre_authorize' => :'pre_authorize', + :'processing_mode' => :'processing_mode', + :'shipping_contact' => :'shipping_contact', + :'shipping_lines' => :'shipping_lines', + :'tax_lines' => :'tax_lines' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'charges' => :'Array', + :'checkout' => :'CheckoutRequest', + :'currency' => :'String', + :'customer_info' => :'OrderRequestCustomerInfo', + :'discount_lines' => :'Array', + :'line_items' => :'Array', + :'metadata' => :'Hash', + :'needs_shipping_contact' => :'Boolean', + :'pre_authorize' => :'Boolean', + :'processing_mode' => :'String', + :'shipping_contact' => :'CustomerShippingContacts', + :'shipping_lines' => :'Array', + :'tax_lines' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'charges') + if (value = attributes[:'charges']).is_a?(Array) + self.charges = value + end + end + + if attributes.key?(:'checkout') + self.checkout = attributes[:'checkout'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'customer_info') + self.customer_info = attributes[:'customer_info'] + end + + if attributes.key?(:'discount_lines') + if (value = attributes[:'discount_lines']).is_a?(Array) + self.discount_lines = value + end + end + + if attributes.key?(:'line_items') + if (value = attributes[:'line_items']).is_a?(Array) + self.line_items = value + end + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'needs_shipping_contact') + self.needs_shipping_contact = attributes[:'needs_shipping_contact'] + end + + if attributes.key?(:'pre_authorize') + self.pre_authorize = attributes[:'pre_authorize'] + else + self.pre_authorize = false + end + + if attributes.key?(:'processing_mode') + self.processing_mode = attributes[:'processing_mode'] + end + + if attributes.key?(:'shipping_contact') + self.shipping_contact = attributes[:'shipping_contact'] + end + + if attributes.key?(:'shipping_lines') + if (value = attributes[:'shipping_lines']).is_a?(Array) + self.shipping_lines = value + end + end + + if attributes.key?(:'tax_lines') + if (value = attributes[:'tax_lines']).is_a?(Array) + self.tax_lines = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @currency.nil? + invalid_properties.push('invalid value for "currency", currency cannot be nil.') + end + + if @currency.to_s.length > 3 + invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') + end + + if @customer_info.nil? + invalid_properties.push('invalid value for "customer_info", customer_info cannot be nil.') + end + + if @line_items.nil? + invalid_properties.push('invalid value for "line_items", line_items cannot be nil.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @currency.nil? + return false if @currency.to_s.length > 3 + return false if @customer_info.nil? + return false if @line_items.nil? + return false if !@metadata.nil? && @metadata.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if currency.nil? + fail ArgumentError, 'currency cannot be nil' + end + + if currency.to_s.length > 3 + fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.' + end + + @currency = currency + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + charges == o.charges && + checkout == o.checkout && + currency == o.currency && + customer_info == o.customer_info && + discount_lines == o.discount_lines && + line_items == o.line_items && + metadata == o.metadata && + needs_shipping_contact == o.needs_shipping_contact && + pre_authorize == o.pre_authorize && + processing_mode == o.processing_mode && + shipping_contact == o.shipping_contact && + shipping_lines == o.shipping_lines && + tax_lines == o.tax_lines + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [charges, checkout, currency, customer_info, discount_lines, line_items, metadata, needs_shipping_contact, pre_authorize, processing_mode, shipping_contact, shipping_lines, tax_lines].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_request_customer_info.rb b/lib/conekta/models/order_request_customer_info.rb new file mode 100644 index 0000000..4604f26 --- /dev/null +++ b/lib/conekta/models/order_request_customer_info.rb @@ -0,0 +1,106 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Customer information + module OrderRequestCustomerInfo + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'CustomerInfo', + :'CustomerInfoJustCustomerId' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Conekta.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/conekta/models/order_response.rb b/lib/conekta/models/order_response.rb new file mode 100644 index 0000000..4de363e --- /dev/null +++ b/lib/conekta/models/order_response.rb @@ -0,0 +1,418 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # order response + class OrderResponse + # The total amount to be collected in cents + attr_accessor :amount + + # The total amount refunded in cents + attr_accessor :amount_refunded + + attr_accessor :channel + + attr_accessor :charges + + attr_accessor :checkout + + # The time at which the object was created in seconds since the Unix epoch + attr_accessor :created_at + + # The three-letter ISO 4217 currency code. The currency of the order. + attr_accessor :currency + + attr_accessor :customer_info + + attr_accessor :discount_lines + + attr_accessor :fiscal_entity + + attr_accessor :id + + attr_accessor :is_refundable + + attr_accessor :line_items + + # Whether the object exists in live mode or test mode + attr_accessor :livemode + + # Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + attr_accessor :metadata + + # String representing the object’s type. Objects of the same type share the same value. + attr_accessor :object + + # The payment status of the order. + attr_accessor :payment_status + + # Indicates the processing mode for the order, either ecommerce, recurrent or validation. + attr_accessor :processing_mode + + attr_accessor :shipping_contact + + # The time at which the object was last updated in seconds since the Unix epoch + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'amount_refunded' => :'amount_refunded', + :'channel' => :'channel', + :'charges' => :'charges', + :'checkout' => :'checkout', + :'created_at' => :'created_at', + :'currency' => :'currency', + :'customer_info' => :'customer_info', + :'discount_lines' => :'discount_lines', + :'fiscal_entity' => :'fiscal_entity', + :'id' => :'id', + :'is_refundable' => :'is_refundable', + :'line_items' => :'line_items', + :'livemode' => :'livemode', + :'metadata' => :'metadata', + :'object' => :'object', + :'payment_status' => :'payment_status', + :'processing_mode' => :'processing_mode', + :'shipping_contact' => :'shipping_contact', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'amount_refunded' => :'Integer', + :'channel' => :'ChargeResponseChannel', + :'charges' => :'OrderResponseCharges', + :'checkout' => :'OrderResponseCheckout', + :'created_at' => :'Integer', + :'currency' => :'String', + :'customer_info' => :'OrderResponseCustomerInfo', + :'discount_lines' => :'OrderResponseDiscountLines', + :'fiscal_entity' => :'OrderResponseFiscalEntity', + :'id' => :'String', + :'is_refundable' => :'Boolean', + :'line_items' => :'OrderResponseProducts', + :'livemode' => :'Boolean', + :'metadata' => :'Hash', + :'object' => :'String', + :'payment_status' => :'String', + :'processing_mode' => :'String', + :'shipping_contact' => :'OrderResponseShippingContact', + :'updated_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'amount_refunded') + self.amount_refunded = attributes[:'amount_refunded'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'charges') + self.charges = attributes[:'charges'] + end + + if attributes.key?(:'checkout') + self.checkout = attributes[:'checkout'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'customer_info') + self.customer_info = attributes[:'customer_info'] + end + + if attributes.key?(:'discount_lines') + self.discount_lines = attributes[:'discount_lines'] + end + + if attributes.key?(:'fiscal_entity') + self.fiscal_entity = attributes[:'fiscal_entity'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'is_refundable') + self.is_refundable = attributes[:'is_refundable'] + end + + if attributes.key?(:'line_items') + self.line_items = attributes[:'line_items'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'payment_status') + self.payment_status = attributes[:'payment_status'] + end + + if attributes.key?(:'processing_mode') + self.processing_mode = attributes[:'processing_mode'] + end + + if attributes.key?(:'shipping_contact') + self.shipping_contact = attributes[:'shipping_contact'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@metadata.nil? && @metadata.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + amount_refunded == o.amount_refunded && + channel == o.channel && + charges == o.charges && + checkout == o.checkout && + created_at == o.created_at && + currency == o.currency && + customer_info == o.customer_info && + discount_lines == o.discount_lines && + fiscal_entity == o.fiscal_entity && + id == o.id && + is_refundable == o.is_refundable && + line_items == o.line_items && + livemode == o.livemode && + metadata == o.metadata && + object == o.object && + payment_status == o.payment_status && + processing_mode == o.processing_mode && + shipping_contact == o.shipping_contact && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, amount_refunded, channel, charges, checkout, created_at, currency, customer_info, discount_lines, fiscal_entity, id, is_refundable, line_items, livemode, metadata, object, payment_status, processing_mode, shipping_contact, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_charges.rb b/lib/conekta/models/order_response_charges.rb new file mode 100644 index 0000000..63d2f40 --- /dev/null +++ b/lib/conekta/models/order_response_charges.rb @@ -0,0 +1,260 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # The charges associated with the order + class OrderResponseCharges + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'OrderResponseChargesAllOf', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseCharges` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseCharges`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_charges_all_of.rb b/lib/conekta/models/order_response_charges_all_of.rb new file mode 100644 index 0000000..f4156ca --- /dev/null +++ b/lib/conekta/models/order_response_charges_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseChargesAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseChargesAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseChargesAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_checkout.rb b/lib/conekta/models/order_response_checkout.rb new file mode 100644 index 0000000..8be9516 --- /dev/null +++ b/lib/conekta/models/order_response_checkout.rb @@ -0,0 +1,468 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseCheckout + attr_accessor :allowed_payment_methods + + attr_accessor :can_not_expire + + attr_accessor :emails_sent + + attr_accessor :exclude_card_networks + + attr_accessor :expires_at + + attr_accessor :failure_url + + attr_accessor :force_3ds_flow + + attr_accessor :id + + attr_accessor :is_redirect_on_failure + + attr_accessor :livemode + + attr_accessor :metadata + + attr_accessor :monthly_installments_enabled + + attr_accessor :monthly_installments_options + + attr_accessor :name + + attr_accessor :needs_shipping_contact + + attr_accessor :object + + attr_accessor :on_demand_enabled + + attr_accessor :paid_payments_count + + attr_accessor :recurrent + + attr_accessor :slug + + attr_accessor :sms_sent + + attr_accessor :success_url + + attr_accessor :starts_at + + attr_accessor :status + + attr_accessor :type + + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'allowed_payment_methods' => :'allowed_payment_methods', + :'can_not_expire' => :'can_not_expire', + :'emails_sent' => :'emails_sent', + :'exclude_card_networks' => :'exclude_card_networks', + :'expires_at' => :'expires_at', + :'failure_url' => :'failure_url', + :'force_3ds_flow' => :'force_3ds_flow', + :'id' => :'id', + :'is_redirect_on_failure' => :'is_redirect_on_failure', + :'livemode' => :'livemode', + :'metadata' => :'metadata', + :'monthly_installments_enabled' => :'monthly_installments_enabled', + :'monthly_installments_options' => :'monthly_installments_options', + :'name' => :'name', + :'needs_shipping_contact' => :'needs_shipping_contact', + :'object' => :'object', + :'on_demand_enabled' => :'on_demand_enabled', + :'paid_payments_count' => :'paid_payments_count', + :'recurrent' => :'recurrent', + :'slug' => :'slug', + :'sms_sent' => :'sms_sent', + :'success_url' => :'success_url', + :'starts_at' => :'starts_at', + :'status' => :'status', + :'type' => :'type', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'allowed_payment_methods' => :'Array', + :'can_not_expire' => :'Boolean', + :'emails_sent' => :'Integer', + :'exclude_card_networks' => :'Array', + :'expires_at' => :'Integer', + :'failure_url' => :'String', + :'force_3ds_flow' => :'Boolean', + :'id' => :'String', + :'is_redirect_on_failure' => :'Boolean', + :'livemode' => :'Boolean', + :'metadata' => :'Hash', + :'monthly_installments_enabled' => :'Boolean', + :'monthly_installments_options' => :'Array', + :'name' => :'String', + :'needs_shipping_contact' => :'Boolean', + :'object' => :'String', + :'on_demand_enabled' => :'Boolean', + :'paid_payments_count' => :'Integer', + :'recurrent' => :'Boolean', + :'slug' => :'String', + :'sms_sent' => :'Integer', + :'success_url' => :'String', + :'starts_at' => :'Integer', + :'status' => :'String', + :'type' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'on_demand_enabled', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseCheckout` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseCheckout`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'allowed_payment_methods') + if (value = attributes[:'allowed_payment_methods']).is_a?(Array) + self.allowed_payment_methods = value + end + end + + if attributes.key?(:'can_not_expire') + self.can_not_expire = attributes[:'can_not_expire'] + end + + if attributes.key?(:'emails_sent') + self.emails_sent = attributes[:'emails_sent'] + end + + if attributes.key?(:'exclude_card_networks') + if (value = attributes[:'exclude_card_networks']).is_a?(Array) + self.exclude_card_networks = value + end + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'failure_url') + self.failure_url = attributes[:'failure_url'] + end + + if attributes.key?(:'force_3ds_flow') + self.force_3ds_flow = attributes[:'force_3ds_flow'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'is_redirect_on_failure') + self.is_redirect_on_failure = attributes[:'is_redirect_on_failure'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'monthly_installments_enabled') + self.monthly_installments_enabled = attributes[:'monthly_installments_enabled'] + end + + if attributes.key?(:'monthly_installments_options') + if (value = attributes[:'monthly_installments_options']).is_a?(Array) + self.monthly_installments_options = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'needs_shipping_contact') + self.needs_shipping_contact = attributes[:'needs_shipping_contact'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'on_demand_enabled') + self.on_demand_enabled = attributes[:'on_demand_enabled'] + end + + if attributes.key?(:'paid_payments_count') + self.paid_payments_count = attributes[:'paid_payments_count'] + end + + if attributes.key?(:'recurrent') + self.recurrent = attributes[:'recurrent'] + end + + if attributes.key?(:'slug') + self.slug = attributes[:'slug'] + end + + if attributes.key?(:'sms_sent') + self.sms_sent = attributes[:'sms_sent'] + end + + if attributes.key?(:'success_url') + self.success_url = attributes[:'success_url'] + end + + if attributes.key?(:'starts_at') + self.starts_at = attributes[:'starts_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@metadata.nil? && @metadata.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + allowed_payment_methods == o.allowed_payment_methods && + can_not_expire == o.can_not_expire && + emails_sent == o.emails_sent && + exclude_card_networks == o.exclude_card_networks && + expires_at == o.expires_at && + failure_url == o.failure_url && + force_3ds_flow == o.force_3ds_flow && + id == o.id && + is_redirect_on_failure == o.is_redirect_on_failure && + livemode == o.livemode && + metadata == o.metadata && + monthly_installments_enabled == o.monthly_installments_enabled && + monthly_installments_options == o.monthly_installments_options && + name == o.name && + needs_shipping_contact == o.needs_shipping_contact && + object == o.object && + on_demand_enabled == o.on_demand_enabled && + paid_payments_count == o.paid_payments_count && + recurrent == o.recurrent && + slug == o.slug && + sms_sent == o.sms_sent && + success_url == o.success_url && + starts_at == o.starts_at && + status == o.status && + type == o.type && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [allowed_payment_methods, can_not_expire, emails_sent, exclude_card_networks, expires_at, failure_url, force_3ds_flow, id, is_redirect_on_failure, livemode, metadata, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, object, on_demand_enabled, paid_payments_count, recurrent, slug, sms_sent, success_url, starts_at, status, type, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_customer_info.rb b/lib/conekta/models/order_response_customer_info.rb new file mode 100644 index 0000000..acc5de6 --- /dev/null +++ b/lib/conekta/models/order_response_customer_info.rb @@ -0,0 +1,275 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseCustomerInfo + attr_accessor :object + + attr_accessor :name + + attr_accessor :email + + attr_accessor :phone + + attr_accessor :corporate + + attr_accessor :customer_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object', + :'name' => :'name', + :'email' => :'email', + :'phone' => :'phone', + :'corporate' => :'corporate', + :'customer_id' => :'customer_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String', + :'name' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'corporate' => :'Boolean', + :'customer_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerInfoJustCustomerIdResponse', + :'CustomerInfoResponse', + :'OrderResponseCustomerInfoAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseCustomerInfo` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseCustomerInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'corporate') + self.corporate = attributes[:'corporate'] + else + self.corporate = false + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object && + name == o.name && + email == o.email && + phone == o.phone && + corporate == o.corporate && + customer_id == o.customer_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object, name, email, phone, corporate, customer_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_customer_info_all_of.rb b/lib/conekta/models/order_response_customer_info_all_of.rb new file mode 100644 index 0000000..5a95e16 --- /dev/null +++ b/lib/conekta/models/order_response_customer_info_all_of.rb @@ -0,0 +1,219 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseCustomerInfoAllOf + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseCustomerInfoAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseCustomerInfoAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_discount_lines.rb b/lib/conekta/models/order_response_discount_lines.rb new file mode 100644 index 0000000..760d990 --- /dev/null +++ b/lib/conekta/models/order_response_discount_lines.rb @@ -0,0 +1,259 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseDiscountLines + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'OrderResponseDiscountLinesAllOf', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseDiscountLines` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseDiscountLines`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_discount_lines_all_of.rb b/lib/conekta/models/order_response_discount_lines_all_of.rb new file mode 100644 index 0000000..0e06eb2 --- /dev/null +++ b/lib/conekta/models/order_response_discount_lines_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseDiscountLinesAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseDiscountLinesAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseDiscountLinesAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_fiscal_entity.rb b/lib/conekta/models/order_response_fiscal_entity.rb new file mode 100644 index 0000000..b5e51e9 --- /dev/null +++ b/lib/conekta/models/order_response_fiscal_entity.rb @@ -0,0 +1,246 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseFiscalEntity + attr_accessor :address + + attr_accessor :tax_id + + attr_accessor :id + + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'tax_id' => :'tax_id', + :'id' => :'id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'address' => :'OrderResponseFiscalEntityAddress', + :'tax_id' => :'String', + :'id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseFiscalEntity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseFiscalEntity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'tax_id') + self.tax_id = attributes[:'tax_id'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + address == o.address && + tax_id == o.tax_id && + id == o.id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [address, tax_id, id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_fiscal_entity_address.rb b/lib/conekta/models/order_response_fiscal_entity_address.rb new file mode 100644 index 0000000..0a58d42 --- /dev/null +++ b/lib/conekta/models/order_response_fiscal_entity_address.rb @@ -0,0 +1,315 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseFiscalEntityAddress + attr_accessor :street1 + + attr_accessor :street2 + + attr_accessor :postal_code + + attr_accessor :city + + attr_accessor :state + + # this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + attr_accessor :country + + attr_accessor :residential + + attr_accessor :external_number + + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'street1' => :'street1', + :'street2' => :'street2', + :'postal_code' => :'postal_code', + :'city' => :'city', + :'state' => :'state', + :'country' => :'country', + :'residential' => :'residential', + :'external_number' => :'external_number', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'street1' => :'String', + :'street2' => :'String', + :'postal_code' => :'String', + :'city' => :'String', + :'state' => :'String', + :'country' => :'String', + :'residential' => :'Boolean', + :'external_number' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerAddress', + :'OrderResponseFiscalEntityAddressAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseFiscalEntityAddress` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseFiscalEntityAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'street1') + self.street1 = attributes[:'street1'] + end + + if attributes.key?(:'street2') + self.street2 = attributes[:'street2'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'residential') + self.residential = attributes[:'residential'] + end + + if attributes.key?(:'external_number') + self.external_number = attributes[:'external_number'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @street1.nil? + invalid_properties.push('invalid value for "street1", street1 cannot be nil.') + end + + if @postal_code.nil? + invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.') + end + + if @city.nil? + invalid_properties.push('invalid value for "city", city cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @street1.nil? + return false if @postal_code.nil? + return false if @city.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + street1 == o.street1 && + street2 == o.street2 && + postal_code == o.postal_code && + city == o.city && + state == o.state && + country == o.country && + residential == o.residential && + external_number == o.external_number && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [street1, street2, postal_code, city, state, country, residential, external_number, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_fiscal_entity_address_all_of.rb b/lib/conekta/models/order_response_fiscal_entity_address_all_of.rb new file mode 100644 index 0000000..f4e5e2c --- /dev/null +++ b/lib/conekta/models/order_response_fiscal_entity_address_all_of.rb @@ -0,0 +1,219 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseFiscalEntityAddressAllOf + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseFiscalEntityAddressAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseFiscalEntityAddressAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_products.rb b/lib/conekta/models/order_response_products.rb new file mode 100644 index 0000000..91c1596 --- /dev/null +++ b/lib/conekta/models/order_response_products.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseProducts + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'OrderResponseProductsAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseProducts` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseProducts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_products_all_of.rb b/lib/conekta/models/order_response_products_all_of.rb new file mode 100644 index 0000000..a45fd9b --- /dev/null +++ b/lib/conekta/models/order_response_products_all_of.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseProductsAllOf + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseProductsAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseProductsAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_shipping_contact.rb b/lib/conekta/models/order_response_shipping_contact.rb new file mode 100644 index 0000000..47e8462 --- /dev/null +++ b/lib/conekta/models/order_response_shipping_contact.rb @@ -0,0 +1,309 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseShippingContact + attr_accessor :created_at + + attr_accessor :id + + attr_accessor :object + + attr_accessor :phone + + attr_accessor :receiver + + attr_accessor :between_streets + + attr_accessor :address + + attr_accessor :parent_id + + attr_accessor :default + + attr_accessor :deleted + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'created_at' => :'created_at', + :'id' => :'id', + :'object' => :'object', + :'phone' => :'phone', + :'receiver' => :'receiver', + :'between_streets' => :'between_streets', + :'address' => :'address', + :'parent_id' => :'parent_id', + :'default' => :'default', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'created_at' => :'Integer', + :'id' => :'String', + :'object' => :'String', + :'phone' => :'String', + :'receiver' => :'String', + :'between_streets' => :'String', + :'address' => :'CustomerShippingContactsResponseAddress', + :'parent_id' => :'String', + :'default' => :'Boolean', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'between_streets', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerShippingContactsResponse', + :'OrderResponseShippingContactAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseShippingContact` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseShippingContact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'receiver') + self.receiver = attributes[:'receiver'] + end + + if attributes.key?(:'between_streets') + self.between_streets = attributes[:'between_streets'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + id == o.id && + object == o.object && + phone == o.phone && + receiver == o.receiver && + between_streets == o.between_streets && + address == o.address && + parent_id == o.parent_id && + default == o.default && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [created_at, id, object, phone, receiver, between_streets, address, parent_id, default, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_response_shipping_contact_all_of.rb b/lib/conekta/models/order_response_shipping_contact_all_of.rb new file mode 100644 index 0000000..f8cc262 --- /dev/null +++ b/lib/conekta/models/order_response_shipping_contact_all_of.rb @@ -0,0 +1,237 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrderResponseShippingContactAllOf + attr_accessor :created_at + + attr_accessor :id + + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'created_at' => :'created_at', + :'id' => :'id', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'created_at' => :'Integer', + :'id' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderResponseShippingContactAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderResponseShippingContactAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + id == o.id && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [created_at, id, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_tax_request.rb b/lib/conekta/models/order_tax_request.rb new file mode 100644 index 0000000..12a2712 --- /dev/null +++ b/lib/conekta/models/order_tax_request.rb @@ -0,0 +1,305 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # create new taxes for an existing order + class OrderTaxRequest + # The amount to be collected for tax in cents + attr_accessor :amount + + # description or tax's name + attr_accessor :description + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'description' => :'description', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'description' => :'String', + :'metadata' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderTaxRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderTaxRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @amount < 0 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') + end + + if @description.nil? + invalid_properties.push('invalid value for "description", description cannot be nil.') + end + + if @description.to_s.length < 2 + invalid_properties.push('invalid value for "description", the character length must be great than or equal to 2.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @amount < 0 + return false if @description.nil? + return false if @description.to_s.length < 2 + return false if !@metadata.nil? && @metadata.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + if amount < 0 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.' + end + + @amount = amount + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if description.nil? + fail ArgumentError, 'description cannot be nil' + end + + if description.to_s.length < 2 + fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 2.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + description == o.description && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, description, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_update_request.rb b/lib/conekta/models/order_update_request.rb new file mode 100644 index 0000000..000907c --- /dev/null +++ b/lib/conekta/models/order_update_request.rb @@ -0,0 +1,344 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # a order + class OrderUpdateRequest + attr_accessor :charges + + attr_accessor :checkout + + # Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) + attr_accessor :currency + + attr_accessor :customer_info + + # List of [discounts](https://developers.conekta.com/v2.1.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount. + attr_accessor :discount_lines + + # List of [products](https://developers.conekta.com/v2.1.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product. + attr_accessor :line_items + + attr_accessor :metadata + + # Indicates whether the order charges must be preauthorized + attr_accessor :pre_authorize + + attr_accessor :shipping_contact + + # List of [shipping costs](https://developers.conekta.com/v2.1.0/reference/orderscreateshipping). If the online store offers digital products. + attr_accessor :shipping_lines + + attr_accessor :tax_lines + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'charges' => :'charges', + :'checkout' => :'checkout', + :'currency' => :'currency', + :'customer_info' => :'customer_info', + :'discount_lines' => :'discount_lines', + :'line_items' => :'line_items', + :'metadata' => :'metadata', + :'pre_authorize' => :'pre_authorize', + :'shipping_contact' => :'shipping_contact', + :'shipping_lines' => :'shipping_lines', + :'tax_lines' => :'tax_lines' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'charges' => :'Array', + :'checkout' => :'CheckoutRequest', + :'currency' => :'String', + :'customer_info' => :'OrderUpdateRequestCustomerInfo', + :'discount_lines' => :'Array', + :'line_items' => :'Array', + :'metadata' => :'Hash', + :'pre_authorize' => :'Boolean', + :'shipping_contact' => :'CustomerShippingContacts', + :'shipping_lines' => :'Array', + :'tax_lines' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrderUpdateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrderUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'charges') + if (value = attributes[:'charges']).is_a?(Array) + self.charges = value + end + end + + if attributes.key?(:'checkout') + self.checkout = attributes[:'checkout'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'customer_info') + self.customer_info = attributes[:'customer_info'] + end + + if attributes.key?(:'discount_lines') + if (value = attributes[:'discount_lines']).is_a?(Array) + self.discount_lines = value + end + end + + if attributes.key?(:'line_items') + if (value = attributes[:'line_items']).is_a?(Array) + self.line_items = value + end + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'pre_authorize') + self.pre_authorize = attributes[:'pre_authorize'] + else + self.pre_authorize = false + end + + if attributes.key?(:'shipping_contact') + self.shipping_contact = attributes[:'shipping_contact'] + end + + if attributes.key?(:'shipping_lines') + if (value = attributes[:'shipping_lines']).is_a?(Array) + self.shipping_lines = value + end + end + + if attributes.key?(:'tax_lines') + if (value = attributes[:'tax_lines']).is_a?(Array) + self.tax_lines = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@currency.nil? && @currency.to_s.length > 3 + invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@currency.nil? && @currency.to_s.length > 3 + true + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if !currency.nil? && currency.to_s.length > 3 + fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.' + end + + @currency = currency + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + charges == o.charges && + checkout == o.checkout && + currency == o.currency && + customer_info == o.customer_info && + discount_lines == o.discount_lines && + line_items == o.line_items && + metadata == o.metadata && + pre_authorize == o.pre_authorize && + shipping_contact == o.shipping_contact && + shipping_lines == o.shipping_lines && + tax_lines == o.tax_lines + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [charges, checkout, currency, customer_info, discount_lines, line_items, metadata, pre_authorize, shipping_contact, shipping_lines, tax_lines].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/order_update_request_customer_info.rb b/lib/conekta/models/order_update_request_customer_info.rb new file mode 100644 index 0000000..126ed6e --- /dev/null +++ b/lib/conekta/models/order_update_request_customer_info.rb @@ -0,0 +1,105 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + module OrderUpdateRequestCustomerInfo + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'CustomerInfo', + :'CustomerInfoJustCustomerId' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Conekta.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/conekta/models/orders_response.rb b/lib/conekta/models/orders_response.rb new file mode 100644 index 0000000..3717d08 --- /dev/null +++ b/lib/conekta/models/orders_response.rb @@ -0,0 +1,226 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class OrdersResponse + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::OrdersResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::OrdersResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push('invalid value for "data", data cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/page.rb b/lib/conekta/models/page.rb new file mode 100644 index 0000000..c83e04e --- /dev/null +++ b/lib/conekta/models/page.rb @@ -0,0 +1,233 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # page metadata + class Page + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'next_page_url' => :'String', + :'previous_page_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::Page` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::Page`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [next_page_url, previous_page_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/pagination.rb b/lib/conekta/models/pagination.rb new file mode 100644 index 0000000..1d48127 --- /dev/null +++ b/lib/conekta/models/pagination.rb @@ -0,0 +1,241 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # pagination metadata + class Pagination + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::Pagination` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::Pagination`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method.rb b/lib/conekta/models/payment_method.rb new file mode 100644 index 0000000..8f1f3c9 --- /dev/null +++ b/lib/conekta/models/payment_method.rb @@ -0,0 +1,233 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethod + attr_accessor :type + + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethod` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_bank_transfer.rb b/lib/conekta/models/payment_method_bank_transfer.rb new file mode 100644 index 0000000..e02ad1f --- /dev/null +++ b/lib/conekta/models/payment_method_bank_transfer.rb @@ -0,0 +1,397 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodBankTransfer + attr_accessor :type + + attr_accessor :object + + attr_accessor :bank + + attr_accessor :clabe + + attr_accessor :description + + attr_accessor :executed_at + + attr_accessor :expires_at + + attr_accessor :issuing_account_bank + + attr_accessor :issuing_account_number + + attr_accessor :issuing_account_holder_name + + attr_accessor :issuing_account_tax_id + + attr_accessor :payment_attempts + + attr_accessor :receiving_account_holder_name + + attr_accessor :receiving_account_number + + attr_accessor :receiving_account_bank + + attr_accessor :receiving_account_tax_id + + attr_accessor :reference_number + + attr_accessor :tracking_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'object' => :'object', + :'bank' => :'bank', + :'clabe' => :'clabe', + :'description' => :'description', + :'executed_at' => :'executed_at', + :'expires_at' => :'expires_at', + :'issuing_account_bank' => :'issuing_account_bank', + :'issuing_account_number' => :'issuing_account_number', + :'issuing_account_holder_name' => :'issuing_account_holder_name', + :'issuing_account_tax_id' => :'issuing_account_tax_id', + :'payment_attempts' => :'payment_attempts', + :'receiving_account_holder_name' => :'receiving_account_holder_name', + :'receiving_account_number' => :'receiving_account_number', + :'receiving_account_bank' => :'receiving_account_bank', + :'receiving_account_tax_id' => :'receiving_account_tax_id', + :'reference_number' => :'reference_number', + :'tracking_code' => :'tracking_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'object' => :'String', + :'bank' => :'String', + :'clabe' => :'String', + :'description' => :'String', + :'executed_at' => :'Integer', + :'expires_at' => :'Integer', + :'issuing_account_bank' => :'String', + :'issuing_account_number' => :'String', + :'issuing_account_holder_name' => :'String', + :'issuing_account_tax_id' => :'String', + :'payment_attempts' => :'Array', + :'receiving_account_holder_name' => :'String', + :'receiving_account_number' => :'String', + :'receiving_account_bank' => :'String', + :'receiving_account_tax_id' => :'String', + :'reference_number' => :'String', + :'tracking_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'description', + :'executed_at', + :'issuing_account_bank', + :'issuing_account_number', + :'issuing_account_holder_name', + :'issuing_account_tax_id', + :'receiving_account_holder_name', + :'receiving_account_tax_id', + :'reference_number', + :'tracking_code' + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ChargeDataPaymentMethodBankTransferResponse', + :'PaymentMethod' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodBankTransfer` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodBankTransfer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'bank') + self.bank = attributes[:'bank'] + end + + if attributes.key?(:'clabe') + self.clabe = attributes[:'clabe'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'executed_at') + self.executed_at = attributes[:'executed_at'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'issuing_account_bank') + self.issuing_account_bank = attributes[:'issuing_account_bank'] + end + + if attributes.key?(:'issuing_account_number') + self.issuing_account_number = attributes[:'issuing_account_number'] + end + + if attributes.key?(:'issuing_account_holder_name') + self.issuing_account_holder_name = attributes[:'issuing_account_holder_name'] + end + + if attributes.key?(:'issuing_account_tax_id') + self.issuing_account_tax_id = attributes[:'issuing_account_tax_id'] + end + + if attributes.key?(:'payment_attempts') + if (value = attributes[:'payment_attempts']).is_a?(Array) + self.payment_attempts = value + end + end + + if attributes.key?(:'receiving_account_holder_name') + self.receiving_account_holder_name = attributes[:'receiving_account_holder_name'] + end + + if attributes.key?(:'receiving_account_number') + self.receiving_account_number = attributes[:'receiving_account_number'] + end + + if attributes.key?(:'receiving_account_bank') + self.receiving_account_bank = attributes[:'receiving_account_bank'] + end + + if attributes.key?(:'receiving_account_tax_id') + self.receiving_account_tax_id = attributes[:'receiving_account_tax_id'] + end + + if attributes.key?(:'reference_number') + self.reference_number = attributes[:'reference_number'] + end + + if attributes.key?(:'tracking_code') + self.tracking_code = attributes[:'tracking_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + object == o.object && + bank == o.bank && + clabe == o.clabe && + description == o.description && + executed_at == o.executed_at && + expires_at == o.expires_at && + issuing_account_bank == o.issuing_account_bank && + issuing_account_number == o.issuing_account_number && + issuing_account_holder_name == o.issuing_account_holder_name && + issuing_account_tax_id == o.issuing_account_tax_id && + payment_attempts == o.payment_attempts && + receiving_account_holder_name == o.receiving_account_holder_name && + receiving_account_number == o.receiving_account_number && + receiving_account_bank == o.receiving_account_bank && + receiving_account_tax_id == o.receiving_account_tax_id && + reference_number == o.reference_number && + tracking_code == o.tracking_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, object, bank, clabe, description, executed_at, expires_at, issuing_account_bank, issuing_account_number, issuing_account_holder_name, issuing_account_tax_id, payment_attempts, receiving_account_holder_name, receiving_account_number, receiving_account_bank, receiving_account_tax_id, reference_number, tracking_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_card.rb b/lib/conekta/models/payment_method_card.rb new file mode 100644 index 0000000..fb577bc --- /dev/null +++ b/lib/conekta/models/payment_method_card.rb @@ -0,0 +1,367 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodCard + attr_accessor :type + + attr_accessor :object + + attr_accessor :account_type + + attr_accessor :auth_code + + attr_accessor :brand + + # Id sent for recurrent charges. + attr_accessor :contract_id + + attr_accessor :country + + attr_accessor :exp_month + + attr_accessor :exp_year + + attr_accessor :fraud_indicators + + attr_accessor :issuer + + attr_accessor :last4 + + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'object' => :'object', + :'account_type' => :'account_type', + :'auth_code' => :'auth_code', + :'brand' => :'brand', + :'contract_id' => :'contract_id', + :'country' => :'country', + :'exp_month' => :'exp_month', + :'exp_year' => :'exp_year', + :'fraud_indicators' => :'fraud_indicators', + :'issuer' => :'issuer', + :'last4' => :'last4', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'object' => :'String', + :'account_type' => :'String', + :'auth_code' => :'String', + :'brand' => :'String', + :'contract_id' => :'String', + :'country' => :'String', + :'exp_month' => :'String', + :'exp_year' => :'String', + :'fraud_indicators' => :'Array', + :'issuer' => :'String', + :'last4' => :'String', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ChargeDataPaymentMethodCardResponse', + :'PaymentMethod' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCard` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'account_type') + self.account_type = attributes[:'account_type'] + end + + if attributes.key?(:'auth_code') + self.auth_code = attributes[:'auth_code'] + end + + if attributes.key?(:'brand') + self.brand = attributes[:'brand'] + end + + if attributes.key?(:'contract_id') + self.contract_id = attributes[:'contract_id'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'exp_month') + self.exp_month = attributes[:'exp_month'] + end + + if attributes.key?(:'exp_year') + self.exp_year = attributes[:'exp_year'] + end + + if attributes.key?(:'fraud_indicators') + if (value = attributes[:'fraud_indicators']).is_a?(Array) + self.fraud_indicators = value + end + end + + if attributes.key?(:'issuer') + self.issuer = attributes[:'issuer'] + end + + if attributes.key?(:'last4') + self.last4 = attributes[:'last4'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if !@contract_id.nil? && @contract_id.to_s.length > 10 + invalid_properties.push('invalid value for "contract_id", the character length must be smaller than or equal to 10.') + end + + if !@contract_id.nil? && @contract_id.to_s.length < 10 + invalid_properties.push('invalid value for "contract_id", the character length must be great than or equal to 10.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @object.nil? + return false if !@contract_id.nil? && @contract_id.to_s.length > 10 + return false if !@contract_id.nil? && @contract_id.to_s.length < 10 + true + end + + # Custom attribute writer method with validation + # @param [Object] contract_id Value to be assigned + def contract_id=(contract_id) + if !contract_id.nil? && contract_id.to_s.length > 10 + fail ArgumentError, 'invalid value for "contract_id", the character length must be smaller than or equal to 10.' + end + + if !contract_id.nil? && contract_id.to_s.length < 10 + fail ArgumentError, 'invalid value for "contract_id", the character length must be great than or equal to 10.' + end + + @contract_id = contract_id + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + object == o.object && + account_type == o.account_type && + auth_code == o.auth_code && + brand == o.brand && + contract_id == o.contract_id && + country == o.country && + exp_month == o.exp_month && + exp_year == o.exp_year && + fraud_indicators == o.fraud_indicators && + issuer == o.issuer && + last4 == o.last4 && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, object, account_type, auth_code, brand, contract_id, country, exp_month, exp_year, fraud_indicators, issuer, last4, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_card_request.rb b/lib/conekta/models/payment_method_card_request.rb new file mode 100644 index 0000000..9e15044 --- /dev/null +++ b/lib/conekta/models/payment_method_card_request.rb @@ -0,0 +1,248 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodCardRequest + # Type of payment method + attr_accessor :type + + # 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. + attr_accessor :token_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'token_id' => :'token_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'token_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerPaymentMethodRequest', + :'PaymentMethodCardRequestAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCardRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCardRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'token_id') + self.token_id = attributes[:'token_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @token_id.nil? + invalid_properties.push('invalid value for "token_id", token_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + return false if @token_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + token_id == o.token_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, token_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_card_request_all_of.rb b/lib/conekta/models/payment_method_card_request_all_of.rb new file mode 100644 index 0000000..5a1cb60 --- /dev/null +++ b/lib/conekta/models/payment_method_card_request_all_of.rb @@ -0,0 +1,220 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodCardRequestAllOf + # 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. + attr_accessor :token_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'token_id' => :'token_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'token_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCardRequestAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCardRequestAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'token_id') + self.token_id = attributes[:'token_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + token_id == o.token_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [token_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_card_response.rb b/lib/conekta/models/payment_method_card_response.rb new file mode 100644 index 0000000..061c993 --- /dev/null +++ b/lib/conekta/models/payment_method_card_response.rb @@ -0,0 +1,373 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodCardResponse + attr_accessor :type + + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + attr_accessor :parent_id + + attr_accessor :last4 + + attr_accessor :bin + + attr_accessor :card_type + + attr_accessor :exp_month + + attr_accessor :exp_year + + attr_accessor :brand + + attr_accessor :name + + attr_accessor :default + + attr_accessor :visible_on_checkout + + attr_accessor :payment_source_status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'parent_id' => :'parent_id', + :'last4' => :'last4', + :'bin' => :'bin', + :'card_type' => :'card_type', + :'exp_month' => :'exp_month', + :'exp_year' => :'exp_year', + :'brand' => :'brand', + :'name' => :'name', + :'default' => :'default', + :'visible_on_checkout' => :'visible_on_checkout', + :'payment_source_status' => :'payment_source_status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer', + :'parent_id' => :'String', + :'last4' => :'String', + :'bin' => :'String', + :'card_type' => :'String', + :'exp_month' => :'String', + :'exp_year' => :'String', + :'brand' => :'String', + :'name' => :'String', + :'default' => :'Boolean', + :'visible_on_checkout' => :'Boolean', + :'payment_source_status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'PaymentMethodCardResponseAllOf', + :'PaymentMethodResponse' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCardResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCardResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'last4') + self.last4 = attributes[:'last4'] + end + + if attributes.key?(:'bin') + self.bin = attributes[:'bin'] + end + + if attributes.key?(:'card_type') + self.card_type = attributes[:'card_type'] + end + + if attributes.key?(:'exp_month') + self.exp_month = attributes[:'exp_month'] + end + + if attributes.key?(:'exp_year') + self.exp_year = attributes[:'exp_year'] + end + + if attributes.key?(:'brand') + self.brand = attributes[:'brand'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'visible_on_checkout') + self.visible_on_checkout = attributes[:'visible_on_checkout'] + end + + if attributes.key?(:'payment_source_status') + self.payment_source_status = attributes[:'payment_source_status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + id == o.id && + object == o.object && + created_at == o.created_at && + parent_id == o.parent_id && + last4 == o.last4 && + bin == o.bin && + card_type == o.card_type && + exp_month == o.exp_month && + exp_year == o.exp_year && + brand == o.brand && + name == o.name && + default == o.default && + visible_on_checkout == o.visible_on_checkout && + payment_source_status == o.payment_source_status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, id, object, created_at, parent_id, last4, bin, card_type, exp_month, exp_year, brand, name, default, visible_on_checkout, payment_source_status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_card_response_all_of.rb b/lib/conekta/models/payment_method_card_response_all_of.rb new file mode 100644 index 0000000..ebe2229 --- /dev/null +++ b/lib/conekta/models/payment_method_card_response_all_of.rb @@ -0,0 +1,301 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # use for card responses + class PaymentMethodCardResponseAllOf + attr_accessor :last4 + + attr_accessor :bin + + attr_accessor :card_type + + attr_accessor :exp_month + + attr_accessor :exp_year + + attr_accessor :brand + + attr_accessor :name + + attr_accessor :default + + attr_accessor :visible_on_checkout + + attr_accessor :payment_source_status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'last4' => :'last4', + :'bin' => :'bin', + :'card_type' => :'card_type', + :'exp_month' => :'exp_month', + :'exp_year' => :'exp_year', + :'brand' => :'brand', + :'name' => :'name', + :'default' => :'default', + :'visible_on_checkout' => :'visible_on_checkout', + :'payment_source_status' => :'payment_source_status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'last4' => :'String', + :'bin' => :'String', + :'card_type' => :'String', + :'exp_month' => :'String', + :'exp_year' => :'String', + :'brand' => :'String', + :'name' => :'String', + :'default' => :'Boolean', + :'visible_on_checkout' => :'Boolean', + :'payment_source_status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCardResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCardResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'last4') + self.last4 = attributes[:'last4'] + end + + if attributes.key?(:'bin') + self.bin = attributes[:'bin'] + end + + if attributes.key?(:'card_type') + self.card_type = attributes[:'card_type'] + end + + if attributes.key?(:'exp_month') + self.exp_month = attributes[:'exp_month'] + end + + if attributes.key?(:'exp_year') + self.exp_year = attributes[:'exp_year'] + end + + if attributes.key?(:'brand') + self.brand = attributes[:'brand'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'visible_on_checkout') + self.visible_on_checkout = attributes[:'visible_on_checkout'] + end + + if attributes.key?(:'payment_source_status') + self.payment_source_status = attributes[:'payment_source_status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + last4 == o.last4 && + bin == o.bin && + card_type == o.card_type && + exp_month == o.exp_month && + exp_year == o.exp_year && + brand == o.brand && + name == o.name && + default == o.default && + visible_on_checkout == o.visible_on_checkout && + payment_source_status == o.payment_source_status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [last4, bin, card_type, exp_month, exp_year, brand, name, default, visible_on_checkout, payment_source_status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_cash.rb b/lib/conekta/models/payment_method_cash.rb new file mode 100644 index 0000000..e2e9a6a --- /dev/null +++ b/lib/conekta/models/payment_method_cash.rb @@ -0,0 +1,316 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodCash + attr_accessor :type + + attr_accessor :object + + attr_accessor :auth_code + + attr_accessor :cashier_id + + attr_accessor :reference + + attr_accessor :barcode_url + + attr_accessor :expires_at + + attr_accessor :service_name + + attr_accessor :store + + attr_accessor :store_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'object' => :'object', + :'auth_code' => :'auth_code', + :'cashier_id' => :'cashier_id', + :'reference' => :'reference', + :'barcode_url' => :'barcode_url', + :'expires_at' => :'expires_at', + :'service_name' => :'service_name', + :'store' => :'store', + :'store_name' => :'store_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'object' => :'String', + :'auth_code' => :'Integer', + :'cashier_id' => :'String', + :'reference' => :'String', + :'barcode_url' => :'String', + :'expires_at' => :'Integer', + :'service_name' => :'String', + :'store' => :'String', + :'store_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'auth_code', + :'cashier_id', + :'store', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ChargeDataPaymentMethodCashResponse', + :'PaymentMethod' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCash` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCash`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'auth_code') + self.auth_code = attributes[:'auth_code'] + end + + if attributes.key?(:'cashier_id') + self.cashier_id = attributes[:'cashier_id'] + end + + if attributes.key?(:'reference') + self.reference = attributes[:'reference'] + end + + if attributes.key?(:'barcode_url') + self.barcode_url = attributes[:'barcode_url'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'service_name') + self.service_name = attributes[:'service_name'] + end + + if attributes.key?(:'store') + self.store = attributes[:'store'] + end + + if attributes.key?(:'store_name') + self.store_name = attributes[:'store_name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + object == o.object && + auth_code == o.auth_code && + cashier_id == o.cashier_id && + reference == o.reference && + barcode_url == o.barcode_url && + expires_at == o.expires_at && + service_name == o.service_name && + store == o.store && + store_name == o.store_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, object, auth_code, cashier_id, reference, barcode_url, expires_at, service_name, store, store_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_cash_request.rb b/lib/conekta/models/payment_method_cash_request.rb new file mode 100644 index 0000000..853350f --- /dev/null +++ b/lib/conekta/models/payment_method_cash_request.rb @@ -0,0 +1,242 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodCashRequest + # Type of payment method + attr_accessor :type + + attr_accessor :expires_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'expires_at' => :'expires_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'expires_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerPaymentMethodRequest', + :'PaymentMethodCashRequestAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCashRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCashRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + expires_at == o.expires_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, expires_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_cash_request_all_of.rb b/lib/conekta/models/payment_method_cash_request_all_of.rb new file mode 100644 index 0000000..126431f --- /dev/null +++ b/lib/conekta/models/payment_method_cash_request_all_of.rb @@ -0,0 +1,219 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodCashRequestAllOf + attr_accessor :expires_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expires_at' => :'expires_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'expires_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCashRequestAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCashRequestAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expires_at == o.expires_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [expires_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_cash_response.rb b/lib/conekta/models/payment_method_cash_response.rb new file mode 100644 index 0000000..5a44ee4 --- /dev/null +++ b/lib/conekta/models/payment_method_cash_response.rb @@ -0,0 +1,328 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodCashResponse + attr_accessor :type + + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + attr_accessor :parent_id + + attr_accessor :reference + + attr_accessor :barcode + + attr_accessor :barcode_url + + attr_accessor :expires_at + + attr_accessor :provider + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'parent_id' => :'parent_id', + :'reference' => :'reference', + :'barcode' => :'barcode', + :'barcode_url' => :'barcode_url', + :'expires_at' => :'expires_at', + :'provider' => :'provider' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer', + :'parent_id' => :'String', + :'reference' => :'String', + :'barcode' => :'String', + :'barcode_url' => :'String', + :'expires_at' => :'Integer', + :'provider' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'PaymentMethodCashResponseAllOf', + :'PaymentMethodResponse' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCashResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCashResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'reference') + self.reference = attributes[:'reference'] + end + + if attributes.key?(:'barcode') + self.barcode = attributes[:'barcode'] + end + + if attributes.key?(:'barcode_url') + self.barcode_url = attributes[:'barcode_url'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'provider') + self.provider = attributes[:'provider'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + id == o.id && + object == o.object && + created_at == o.created_at && + parent_id == o.parent_id && + reference == o.reference && + barcode == o.barcode && + barcode_url == o.barcode_url && + expires_at == o.expires_at && + provider == o.provider + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, id, object, created_at, parent_id, reference, barcode, barcode_url, expires_at, provider].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_cash_response_all_of.rb b/lib/conekta/models/payment_method_cash_response_all_of.rb new file mode 100644 index 0000000..9f055a2 --- /dev/null +++ b/lib/conekta/models/payment_method_cash_response_all_of.rb @@ -0,0 +1,256 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # use for cash responses + class PaymentMethodCashResponseAllOf + attr_accessor :reference + + attr_accessor :barcode + + attr_accessor :barcode_url + + attr_accessor :expires_at + + attr_accessor :provider + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reference' => :'reference', + :'barcode' => :'barcode', + :'barcode_url' => :'barcode_url', + :'expires_at' => :'expires_at', + :'provider' => :'provider' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reference' => :'String', + :'barcode' => :'String', + :'barcode_url' => :'String', + :'expires_at' => :'Integer', + :'provider' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodCashResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodCashResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reference') + self.reference = attributes[:'reference'] + end + + if attributes.key?(:'barcode') + self.barcode = attributes[:'barcode'] + end + + if attributes.key?(:'barcode_url') + self.barcode_url = attributes[:'barcode_url'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'provider') + self.provider = attributes[:'provider'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reference == o.reference && + barcode == o.barcode && + barcode_url == o.barcode_url && + expires_at == o.expires_at && + provider == o.provider + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reference, barcode, barcode_url, expires_at, provider].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_response.rb b/lib/conekta/models/payment_method_response.rb new file mode 100644 index 0000000..640ee37 --- /dev/null +++ b/lib/conekta/models/payment_method_response.rb @@ -0,0 +1,275 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodResponse + attr_accessor :type + + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + id == o.id && + object == o.object && + created_at == o.created_at && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, id, object, created_at, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_spei_recurrent.rb b/lib/conekta/models/payment_method_spei_recurrent.rb new file mode 100644 index 0000000..b8bd1b0 --- /dev/null +++ b/lib/conekta/models/payment_method_spei_recurrent.rb @@ -0,0 +1,301 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodSpeiRecurrent + attr_accessor :type + + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + attr_accessor :parent_id + + attr_accessor :reference + + attr_accessor :expires_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'parent_id' => :'parent_id', + :'reference' => :'reference', + :'expires_at' => :'expires_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer', + :'parent_id' => :'String', + :'reference' => :'String', + :'expires_at' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'PaymentMethodResponse', + :'PaymentMethodSpeiRecurrentAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodSpeiRecurrent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodSpeiRecurrent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'reference') + self.reference = attributes[:'reference'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + id == o.id && + object == o.object && + created_at == o.created_at && + parent_id == o.parent_id && + reference == o.reference && + expires_at == o.expires_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, id, object, created_at, parent_id, reference, expires_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_spei_recurrent_all_of.rb b/lib/conekta/models/payment_method_spei_recurrent_all_of.rb new file mode 100644 index 0000000..7814bb6 --- /dev/null +++ b/lib/conekta/models/payment_method_spei_recurrent_all_of.rb @@ -0,0 +1,229 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # use for spei responses + class PaymentMethodSpeiRecurrentAllOf + attr_accessor :reference + + attr_accessor :expires_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reference' => :'reference', + :'expires_at' => :'expires_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reference' => :'String', + :'expires_at' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodSpeiRecurrentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodSpeiRecurrentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reference') + self.reference = attributes[:'reference'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reference == o.reference && + expires_at == o.expires_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reference, expires_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/payment_method_spei_request.rb b/lib/conekta/models/payment_method_spei_request.rb new file mode 100644 index 0000000..a0a169c --- /dev/null +++ b/lib/conekta/models/payment_method_spei_request.rb @@ -0,0 +1,242 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class PaymentMethodSpeiRequest + # Type of payment method + attr_accessor :type + + attr_accessor :expires_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'expires_at' => :'expires_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'expires_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerPaymentMethodRequest', + :'PaymentMethodCashRequestAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PaymentMethodSpeiRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PaymentMethodSpeiRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + expires_at == o.expires_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, expires_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/plan_request.rb b/lib/conekta/models/plan_request.rb new file mode 100644 index 0000000..f23f080 --- /dev/null +++ b/lib/conekta/models/plan_request.rb @@ -0,0 +1,398 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # a plan + class PlanRequest + # The amount in cents that will be charged on the interval specified. + attr_accessor :amount + + # ISO 4217 for currencies, for the Mexican peso it is MXN/USD + attr_accessor :currency + + # Number of repetitions of the frequency NUMBER OF CHARGES TO BE MADE, considering the interval and frequency, this evolves over time, but is subject to the expiration count. + attr_accessor :expiry_count + + # Frequency of the charge, which together with the interval, can be every 3 weeks, every 4 months, every 2 years, every 5 fortnights + attr_accessor :frequency + + # internal reference id + attr_accessor :id + + # The interval of time between each charge. + attr_accessor :interval + + # The name of the plan. + attr_accessor :name + + # The number of days the customer will have a free trial. + attr_accessor :trial_period_days + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'currency' => :'currency', + :'expiry_count' => :'expiry_count', + :'frequency' => :'frequency', + :'id' => :'id', + :'interval' => :'interval', + :'name' => :'name', + :'trial_period_days' => :'trial_period_days' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'currency' => :'String', + :'expiry_count' => :'Integer', + :'frequency' => :'Integer', + :'id' => :'String', + :'interval' => :'String', + :'name' => :'String', + :'trial_period_days' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PlanRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PlanRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'expiry_count') + self.expiry_count = attributes[:'expiry_count'] + end + + if attributes.key?(:'frequency') + self.frequency = attributes[:'frequency'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'interval') + self.interval = attributes[:'interval'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'trial_period_days') + self.trial_period_days = attributes[:'trial_period_days'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @amount < 1 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 1.') + end + + if !@currency.nil? && @currency.to_s.length > 3 + invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') + end + + if @frequency.nil? + invalid_properties.push('invalid value for "frequency", frequency cannot be nil.') + end + + if @frequency < 1 + invalid_properties.push('invalid value for "frequency", must be greater than or equal to 1.') + end + + if @interval.nil? + invalid_properties.push('invalid value for "interval", interval cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @amount < 1 + return false if !@currency.nil? && @currency.to_s.length > 3 + return false if @frequency.nil? + return false if @frequency < 1 + return false if @interval.nil? + interval_validator = EnumAttributeValidator.new('String', ["week", "half_month", "month", "year"]) + return false unless interval_validator.valid?(@interval) + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + if amount < 1 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 1.' + end + + @amount = amount + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if !currency.nil? && currency.to_s.length > 3 + fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.' + end + + @currency = currency + end + + # Custom attribute writer method with validation + # @param [Object] frequency Value to be assigned + def frequency=(frequency) + if frequency.nil? + fail ArgumentError, 'frequency cannot be nil' + end + + if frequency < 1 + fail ArgumentError, 'invalid value for "frequency", must be greater than or equal to 1.' + end + + @frequency = frequency + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] interval Object to be assigned + def interval=(interval) + validator = EnumAttributeValidator.new('String', ["week", "half_month", "month", "year"]) + unless validator.valid?(interval) + fail ArgumentError, "invalid value for \"interval\", must be one of #{validator.allowable_values}." + end + @interval = interval + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + currency == o.currency && + expiry_count == o.expiry_count && + frequency == o.frequency && + id == o.id && + interval == o.interval && + name == o.name && + trial_period_days == o.trial_period_days + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, currency, expiry_count, frequency, id, interval, name, trial_period_days].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/plan_response.rb b/lib/conekta/models/plan_response.rb new file mode 100644 index 0000000..2155735 --- /dev/null +++ b/lib/conekta/models/plan_response.rb @@ -0,0 +1,327 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # plans model + class PlanResponse + attr_accessor :amount + + attr_accessor :created_at + + attr_accessor :currency + + attr_accessor :expiry_count + + attr_accessor :frequency + + attr_accessor :id + + attr_accessor :interval + + attr_accessor :livemode + + attr_accessor :name + + attr_accessor :object + + attr_accessor :trial_period_days + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'created_at' => :'created_at', + :'currency' => :'currency', + :'expiry_count' => :'expiry_count', + :'frequency' => :'frequency', + :'id' => :'id', + :'interval' => :'interval', + :'livemode' => :'livemode', + :'name' => :'name', + :'object' => :'object', + :'trial_period_days' => :'trial_period_days' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'created_at' => :'Integer', + :'currency' => :'String', + :'expiry_count' => :'Integer', + :'frequency' => :'Integer', + :'id' => :'String', + :'interval' => :'String', + :'livemode' => :'Boolean', + :'name' => :'String', + :'object' => :'String', + :'trial_period_days' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'expiry_count', + :'trial_period_days' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PlanResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PlanResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'expiry_count') + self.expiry_count = attributes[:'expiry_count'] + end + + if attributes.key?(:'frequency') + self.frequency = attributes[:'frequency'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'interval') + self.interval = attributes[:'interval'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'trial_period_days') + self.trial_period_days = attributes[:'trial_period_days'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@currency.nil? && @currency.to_s.length > 3 + invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@currency.nil? && @currency.to_s.length > 3 + true + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if !currency.nil? && currency.to_s.length > 3 + fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.' + end + + @currency = currency + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + created_at == o.created_at && + currency == o.currency && + expiry_count == o.expiry_count && + frequency == o.frequency && + id == o.id && + interval == o.interval && + livemode == o.livemode && + name == o.name && + object == o.object && + trial_period_days == o.trial_period_days + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, created_at, currency, expiry_count, frequency, id, interval, livemode, name, object, trial_period_days].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/plan_update_request.rb b/lib/conekta/models/plan_update_request.rb new file mode 100644 index 0000000..965c3a8 --- /dev/null +++ b/lib/conekta/models/plan_update_request.rb @@ -0,0 +1,281 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # a plan + class PlanUpdateRequest + # The amount in cents that will be charged on the interval specified. + attr_accessor :amount + + # ISO 4217 for currencies, for the Mexican peso it is MXN/USD + attr_accessor :currency + + # Number of repetitions of the frequency NUMBER OF CHARGES TO BE MADE, considering the interval and frequency, this evolves over time, but is subject to the expiration count. + attr_accessor :expiry_count + + # The name of the plan. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'currency' => :'currency', + :'expiry_count' => :'expiry_count', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'currency' => :'String', + :'expiry_count' => :'Integer', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PlanUpdateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PlanUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'expiry_count') + self.expiry_count = attributes[:'expiry_count'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@amount.nil? && @amount < 1 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 1.') + end + + if !@currency.nil? && @currency.to_s.length > 3 + invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@amount.nil? && @amount < 1 + return false if !@currency.nil? && @currency.to_s.length > 3 + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if !amount.nil? && amount < 1 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 1.' + end + + @amount = amount + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if !currency.nil? && currency.to_s.length > 3 + fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.' + end + + @currency = currency + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + currency == o.currency && + expiry_count == o.expiry_count && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, currency, expiry_count, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/product.rb b/lib/conekta/models/product.rb new file mode 100644 index 0000000..ceccb40 --- /dev/null +++ b/lib/conekta/models/product.rb @@ -0,0 +1,388 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class Product + attr_accessor :antifraud_info + + # The brand of the item. + attr_accessor :brand + + # Short description of the item + attr_accessor :description + + # It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters. + attr_accessor :metadata + + # The name of the item. It will be displayed in the order. + attr_accessor :name + + # The quantity of the item in the order. + attr_accessor :quantity + + # The stock keeping unit for the item. It is used to identify the item in the order. + attr_accessor :sku + + # List of tags for the item. It is used to identify the item in the order. + attr_accessor :tags + + # The price of the item in cents. + attr_accessor :unit_price + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'antifraud_info' => :'antifraud_info', + :'brand' => :'brand', + :'description' => :'description', + :'metadata' => :'metadata', + :'name' => :'name', + :'quantity' => :'quantity', + :'sku' => :'sku', + :'tags' => :'tags', + :'unit_price' => :'unit_price' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'antifraud_info' => :'Hash', + :'brand' => :'String', + :'description' => :'String', + :'metadata' => :'Hash', + :'name' => :'String', + :'quantity' => :'Integer', + :'sku' => :'String', + :'tags' => :'Array', + :'unit_price' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::Product` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::Product`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'antifraud_info') + if (value = attributes[:'antifraud_info']).is_a?(Hash) + self.antifraud_info = value + end + end + + if attributes.key?(:'brand') + self.brand = attributes[:'brand'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'unit_price') + self.unit_price = attributes[:'unit_price'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@description.nil? && @description.to_s.length > 250 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @quantity.nil? + invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') + end + + if @quantity < 1 + invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.') + end + + if @unit_price.nil? + invalid_properties.push('invalid value for "unit_price", unit_price cannot be nil.') + end + + if @unit_price < 0 + invalid_properties.push('invalid value for "unit_price", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@description.nil? && @description.to_s.length > 250 + return false if !@metadata.nil? && @metadata.length > 100 + return false if @name.nil? + return false if @quantity.nil? + return false if @quantity < 1 + return false if @unit_price.nil? + return false if @unit_price < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if !description.nil? && description.to_s.length > 250 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + if quantity < 1 + fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if unit_price.nil? + fail ArgumentError, 'unit_price cannot be nil' + end + + if unit_price < 0 + fail ArgumentError, 'invalid value for "unit_price", must be greater than or equal to 0.' + end + + @unit_price = unit_price + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + antifraud_info == o.antifraud_info && + brand == o.brand && + description == o.description && + metadata == o.metadata && + name == o.name && + quantity == o.quantity && + sku == o.sku && + tags == o.tags && + unit_price == o.unit_price + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [antifraud_info, brand, description, metadata, name, quantity, sku, tags, unit_price].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/product_data_response.rb b/lib/conekta/models/product_data_response.rb new file mode 100644 index 0000000..ebeee22 --- /dev/null +++ b/lib/conekta/models/product_data_response.rb @@ -0,0 +1,423 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ProductDataResponse + attr_accessor :antifraud_info + + # The brand of the item. + attr_accessor :brand + + # Short description of the item + attr_accessor :description + + # It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters. + attr_accessor :metadata + + # The name of the item. It will be displayed in the order. + attr_accessor :name + + # The quantity of the item in the order. + attr_accessor :quantity + + # The stock keeping unit for the item. It is used to identify the item in the order. + attr_accessor :sku + + # List of tags for the item. It is used to identify the item in the order. + attr_accessor :tags + + # The price of the item in cents. + attr_accessor :unit_price + + attr_accessor :id + + attr_accessor :object + + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'antifraud_info' => :'antifraud_info', + :'brand' => :'brand', + :'description' => :'description', + :'metadata' => :'metadata', + :'name' => :'name', + :'quantity' => :'quantity', + :'sku' => :'sku', + :'tags' => :'tags', + :'unit_price' => :'unit_price', + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'antifraud_info' => :'Hash', + :'brand' => :'String', + :'description' => :'String', + :'metadata' => :'Hash', + :'name' => :'String', + :'quantity' => :'Integer', + :'sku' => :'String', + :'tags' => :'Array', + :'unit_price' => :'Integer', + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Product', + :'ProductDataResponseAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ProductDataResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ProductDataResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'antifraud_info') + if (value = attributes[:'antifraud_info']).is_a?(Hash) + self.antifraud_info = value + end + end + + if attributes.key?(:'brand') + self.brand = attributes[:'brand'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'unit_price') + self.unit_price = attributes[:'unit_price'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@description.nil? && @description.to_s.length > 250 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @quantity.nil? + invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') + end + + if @quantity < 1 + invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.') + end + + if @unit_price.nil? + invalid_properties.push('invalid value for "unit_price", unit_price cannot be nil.') + end + + if @unit_price < 0 + invalid_properties.push('invalid value for "unit_price", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@description.nil? && @description.to_s.length > 250 + return false if !@metadata.nil? && @metadata.length > 100 + return false if @name.nil? + return false if @quantity.nil? + return false if @quantity < 1 + return false if @unit_price.nil? + return false if @unit_price < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if !description.nil? && description.to_s.length > 250 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + if quantity < 1 + fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if unit_price.nil? + fail ArgumentError, 'unit_price cannot be nil' + end + + if unit_price < 0 + fail ArgumentError, 'invalid value for "unit_price", must be greater than or equal to 0.' + end + + @unit_price = unit_price + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + antifraud_info == o.antifraud_info && + brand == o.brand && + description == o.description && + metadata == o.metadata && + name == o.name && + quantity == o.quantity && + sku == o.sku && + tags == o.tags && + unit_price == o.unit_price && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [antifraud_info, brand, description, metadata, name, quantity, sku, tags, unit_price, id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/product_data_response_all_of.rb b/lib/conekta/models/product_data_response_all_of.rb new file mode 100644 index 0000000..e176335 --- /dev/null +++ b/lib/conekta/models/product_data_response_all_of.rb @@ -0,0 +1,237 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ProductDataResponseAllOf + attr_accessor :id + + attr_accessor :object + + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ProductDataResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ProductDataResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/product_order_response.rb b/lib/conekta/models/product_order_response.rb new file mode 100644 index 0000000..4a17c01 --- /dev/null +++ b/lib/conekta/models/product_order_response.rb @@ -0,0 +1,423 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ProductOrderResponse + attr_accessor :antifraud_info + + # The brand of the item. + attr_accessor :brand + + # Short description of the item + attr_accessor :description + + # It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters. + attr_accessor :metadata + + # The name of the item. It will be displayed in the order. + attr_accessor :name + + # The quantity of the item in the order. + attr_accessor :quantity + + # The stock keeping unit for the item. It is used to identify the item in the order. + attr_accessor :sku + + # List of tags for the item. It is used to identify the item in the order. + attr_accessor :tags + + # The price of the item in cents. + attr_accessor :unit_price + + attr_accessor :id + + attr_accessor :object + + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'antifraud_info' => :'antifraud_info', + :'brand' => :'brand', + :'description' => :'description', + :'metadata' => :'metadata', + :'name' => :'name', + :'quantity' => :'quantity', + :'sku' => :'sku', + :'tags' => :'tags', + :'unit_price' => :'unit_price', + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'antifraud_info' => :'Hash', + :'brand' => :'String', + :'description' => :'String', + :'metadata' => :'Hash', + :'name' => :'String', + :'quantity' => :'Integer', + :'sku' => :'String', + :'tags' => :'Array', + :'unit_price' => :'Integer', + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Product', + :'ProductOrderResponseAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ProductOrderResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ProductOrderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'antifraud_info') + if (value = attributes[:'antifraud_info']).is_a?(Hash) + self.antifraud_info = value + end + end + + if attributes.key?(:'brand') + self.brand = attributes[:'brand'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'unit_price') + self.unit_price = attributes[:'unit_price'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@description.nil? && @description.to_s.length > 250 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @quantity.nil? + invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') + end + + if @quantity < 1 + invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.') + end + + if @unit_price.nil? + invalid_properties.push('invalid value for "unit_price", unit_price cannot be nil.') + end + + if @unit_price < 0 + invalid_properties.push('invalid value for "unit_price", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@description.nil? && @description.to_s.length > 250 + return false if !@metadata.nil? && @metadata.length > 100 + return false if @name.nil? + return false if @quantity.nil? + return false if @quantity < 1 + return false if @unit_price.nil? + return false if @unit_price < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if !description.nil? && description.to_s.length > 250 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + if quantity < 1 + fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if unit_price.nil? + fail ArgumentError, 'unit_price cannot be nil' + end + + if unit_price < 0 + fail ArgumentError, 'invalid value for "unit_price", must be greater than or equal to 0.' + end + + @unit_price = unit_price + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + antifraud_info == o.antifraud_info && + brand == o.brand && + description == o.description && + metadata == o.metadata && + name == o.name && + quantity == o.quantity && + sku == o.sku && + tags == o.tags && + unit_price == o.unit_price && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [antifraud_info, brand, description, metadata, name, quantity, sku, tags, unit_price, id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/product_order_response_all_of.rb b/lib/conekta/models/product_order_response_all_of.rb new file mode 100644 index 0000000..199bddb --- /dev/null +++ b/lib/conekta/models/product_order_response_all_of.rb @@ -0,0 +1,237 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ProductOrderResponseAllOf + attr_accessor :id + + attr_accessor :object + + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ProductOrderResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ProductOrderResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/risk_rules.rb b/lib/conekta/models/risk_rules.rb new file mode 100644 index 0000000..82dee5b --- /dev/null +++ b/lib/conekta/models/risk_rules.rb @@ -0,0 +1,221 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class RiskRules + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::RiskRules` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::RiskRules`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/risk_rules_data.rb b/lib/conekta/models/risk_rules_data.rb new file mode 100644 index 0000000..3dfebc4 --- /dev/null +++ b/lib/conekta/models/risk_rules_data.rb @@ -0,0 +1,280 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class RiskRulesData + # rule id + attr_accessor :id + + # field to be used for the rule + attr_accessor :field + + # rule creation date + attr_accessor :created_at + + # value to be used for the rule + attr_accessor :value + + # if the rule is global + attr_accessor :is_global + + # if the rule is test + attr_accessor :is_test + + # description of the rule + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'field' => :'field', + :'created_at' => :'created_at', + :'value' => :'value', + :'is_global' => :'is_global', + :'is_test' => :'is_test', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'field' => :'String', + :'created_at' => :'String', + :'value' => :'String', + :'is_global' => :'Boolean', + :'is_test' => :'Boolean', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::RiskRulesData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::RiskRulesData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'is_global') + self.is_global = attributes[:'is_global'] + end + + if attributes.key?(:'is_test') + self.is_test = attributes[:'is_test'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + field == o.field && + created_at == o.created_at && + value == o.value && + is_global == o.is_global && + is_test == o.is_test && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, field, created_at, value, is_global, is_test, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/risk_rules_list.rb b/lib/conekta/models/risk_rules_list.rb new file mode 100644 index 0000000..69516a6 --- /dev/null +++ b/lib/conekta/models/risk_rules_list.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class RiskRulesList + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Page', + :'Pagination', + :'RiskRules' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::RiskRulesList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::RiskRulesList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/shipping_order_response.rb b/lib/conekta/models/shipping_order_response.rb new file mode 100644 index 0000000..6f9d37f --- /dev/null +++ b/lib/conekta/models/shipping_order_response.rb @@ -0,0 +1,336 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ShippingOrderResponse + # Shipping amount in cents + attr_accessor :amount + + # Carrier name for the shipment + attr_accessor :carrier + + # Tracking number can be used to track the shipment + attr_accessor :tracking_number + + # Method of shipment + attr_accessor :method + + # Hash where the user can send additional information for each 'shipping'. + attr_accessor :metadata + + attr_accessor :id + + attr_accessor :object + + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'carrier' => :'carrier', + :'tracking_number' => :'tracking_number', + :'method' => :'method', + :'metadata' => :'metadata', + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'carrier' => :'String', + :'tracking_number' => :'String', + :'method' => :'String', + :'metadata' => :'Hash', + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ProductOrderResponseAllOf', + :'ShippingRequest' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ShippingOrderResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ShippingOrderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'carrier') + self.carrier = attributes[:'carrier'] + end + + if attributes.key?(:'tracking_number') + self.tracking_number = attributes[:'tracking_number'] + end + + if attributes.key?(:'method') + self.method = attributes[:'method'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @amount < 0 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @amount < 0 + return false if !@metadata.nil? && @metadata.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + if amount < 0 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.' + end + + @amount = amount + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + carrier == o.carrier && + tracking_number == o.tracking_number && + method == o.method && + metadata == o.metadata && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, carrier, tracking_number, method, metadata, id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/shipping_request.rb b/lib/conekta/models/shipping_request.rb new file mode 100644 index 0000000..d05337e --- /dev/null +++ b/lib/conekta/models/shipping_request.rb @@ -0,0 +1,301 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ShippingRequest + # Shipping amount in cents + attr_accessor :amount + + # Carrier name for the shipment + attr_accessor :carrier + + # Tracking number can be used to track the shipment + attr_accessor :tracking_number + + # Method of shipment + attr_accessor :method + + # Hash where the user can send additional information for each 'shipping'. + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'carrier' => :'carrier', + :'tracking_number' => :'tracking_number', + :'method' => :'method', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'carrier' => :'String', + :'tracking_number' => :'String', + :'method' => :'String', + :'metadata' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ShippingRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ShippingRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'carrier') + self.carrier = attributes[:'carrier'] + end + + if attributes.key?(:'tracking_number') + self.tracking_number = attributes[:'tracking_number'] + end + + if attributes.key?(:'method') + self.method = attributes[:'method'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @amount < 0 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @amount < 0 + return false if !@metadata.nil? && @metadata.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + if amount < 0 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.' + end + + @amount = amount + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + carrier == o.carrier && + tracking_number == o.tracking_number && + method == o.method && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, carrier, tracking_number, method, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/sms_checkout_request.rb b/lib/conekta/models/sms_checkout_request.rb new file mode 100644 index 0000000..2da8823 --- /dev/null +++ b/lib/conekta/models/sms_checkout_request.rb @@ -0,0 +1,224 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class SmsCheckoutRequest + attr_accessor :phonenumber + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phonenumber' => :'phonenumber' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'phonenumber' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::SmsCheckoutRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::SmsCheckoutRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phonenumber') + self.phonenumber = attributes[:'phonenumber'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @phonenumber.nil? + invalid_properties.push('invalid value for "phonenumber", phonenumber cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @phonenumber.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phonenumber == o.phonenumber + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phonenumber].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/subscription_events_response.rb b/lib/conekta/models/subscription_events_response.rb new file mode 100644 index 0000000..66a68d3 --- /dev/null +++ b/lib/conekta/models/subscription_events_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class SubscriptionEventsResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + # URL of the next page. + attr_accessor :next_page_url + + # Url of the previous page. + attr_accessor :previous_page_url + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'next_page_url' => :'next_page_url', + :'previous_page_url' => :'previous_page_url', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'next_page_url' => :'String', + :'previous_page_url' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_page_url', + :'previous_page_url', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'GetEventsResponseAllOf', + :'Page', + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::SubscriptionEventsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::SubscriptionEventsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'next_page_url') + self.next_page_url = attributes[:'next_page_url'] + end + + if attributes.key?(:'previous_page_url') + self.previous_page_url = attributes[:'previous_page_url'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + next_page_url == o.next_page_url && + previous_page_url == o.previous_page_url && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, next_page_url, previous_page_url, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/subscription_request.rb b/lib/conekta/models/subscription_request.rb new file mode 100644 index 0000000..b4fc18a --- /dev/null +++ b/lib/conekta/models/subscription_request.rb @@ -0,0 +1,243 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # It is a parameter that allows to identify in the response, the detailed content of the plans to which the client has subscribed + class SubscriptionRequest + attr_accessor :plan_id + + attr_accessor :card_id + + attr_accessor :trial_end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'plan_id' => :'plan_id', + :'card_id' => :'card_id', + :'trial_end' => :'trial_end' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'plan_id' => :'String', + :'card_id' => :'String', + :'trial_end' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::SubscriptionRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::SubscriptionRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'plan_id') + self.plan_id = attributes[:'plan_id'] + end + + if attributes.key?(:'card_id') + self.card_id = attributes[:'card_id'] + end + + if attributes.key?(:'trial_end') + self.trial_end = attributes[:'trial_end'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @plan_id.nil? + invalid_properties.push('invalid value for "plan_id", plan_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @plan_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + plan_id == o.plan_id && + card_id == o.card_id && + trial_end == o.trial_end + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [plan_id, card_id, trial_end].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/subscription_response.rb b/lib/conekta/models/subscription_response.rb new file mode 100644 index 0000000..6686852 --- /dev/null +++ b/lib/conekta/models/subscription_response.rb @@ -0,0 +1,371 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # subscription model + class SubscriptionResponse + attr_accessor :billing_cycle_start + + attr_accessor :billing_cycle_end + + attr_accessor :canceled_at + + attr_accessor :card_id + + attr_accessor :charge_id + + attr_accessor :created_at + + attr_accessor :customer_custom_reference + + attr_accessor :customer_id + + attr_accessor :id + + attr_accessor :last_billing_cycle_order_id + + attr_accessor :object + + attr_accessor :paused_at + + attr_accessor :plan_id + + attr_accessor :status + + attr_accessor :subscription_start + + attr_accessor :trial_start + + attr_accessor :trial_end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'billing_cycle_start' => :'billing_cycle_start', + :'billing_cycle_end' => :'billing_cycle_end', + :'canceled_at' => :'canceled_at', + :'card_id' => :'card_id', + :'charge_id' => :'charge_id', + :'created_at' => :'created_at', + :'customer_custom_reference' => :'customer_custom_reference', + :'customer_id' => :'customer_id', + :'id' => :'id', + :'last_billing_cycle_order_id' => :'last_billing_cycle_order_id', + :'object' => :'object', + :'paused_at' => :'paused_at', + :'plan_id' => :'plan_id', + :'status' => :'status', + :'subscription_start' => :'subscription_start', + :'trial_start' => :'trial_start', + :'trial_end' => :'trial_end' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'billing_cycle_start' => :'Integer', + :'billing_cycle_end' => :'Integer', + :'canceled_at' => :'Integer', + :'card_id' => :'String', + :'charge_id' => :'String', + :'created_at' => :'Integer', + :'customer_custom_reference' => :'String', + :'customer_id' => :'String', + :'id' => :'String', + :'last_billing_cycle_order_id' => :'String', + :'object' => :'String', + :'paused_at' => :'Integer', + :'plan_id' => :'String', + :'status' => :'String', + :'subscription_start' => :'Integer', + :'trial_start' => :'Integer', + :'trial_end' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'billing_cycle_start', + :'billing_cycle_end', + :'canceled_at', + :'charge_id', + :'paused_at', + :'trial_start', + :'trial_end' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::SubscriptionResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::SubscriptionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'billing_cycle_start') + self.billing_cycle_start = attributes[:'billing_cycle_start'] + end + + if attributes.key?(:'billing_cycle_end') + self.billing_cycle_end = attributes[:'billing_cycle_end'] + end + + if attributes.key?(:'canceled_at') + self.canceled_at = attributes[:'canceled_at'] + end + + if attributes.key?(:'card_id') + self.card_id = attributes[:'card_id'] + end + + if attributes.key?(:'charge_id') + self.charge_id = attributes[:'charge_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'customer_custom_reference') + self.customer_custom_reference = attributes[:'customer_custom_reference'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'last_billing_cycle_order_id') + self.last_billing_cycle_order_id = attributes[:'last_billing_cycle_order_id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'paused_at') + self.paused_at = attributes[:'paused_at'] + end + + if attributes.key?(:'plan_id') + self.plan_id = attributes[:'plan_id'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'subscription_start') + self.subscription_start = attributes[:'subscription_start'] + end + + if attributes.key?(:'trial_start') + self.trial_start = attributes[:'trial_start'] + end + + if attributes.key?(:'trial_end') + self.trial_end = attributes[:'trial_end'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + billing_cycle_start == o.billing_cycle_start && + billing_cycle_end == o.billing_cycle_end && + canceled_at == o.canceled_at && + card_id == o.card_id && + charge_id == o.charge_id && + created_at == o.created_at && + customer_custom_reference == o.customer_custom_reference && + customer_id == o.customer_id && + id == o.id && + last_billing_cycle_order_id == o.last_billing_cycle_order_id && + object == o.object && + paused_at == o.paused_at && + plan_id == o.plan_id && + status == o.status && + subscription_start == o.subscription_start && + trial_start == o.trial_start && + trial_end == o.trial_end + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [billing_cycle_start, billing_cycle_end, canceled_at, card_id, charge_id, created_at, customer_custom_reference, customer_id, id, last_billing_cycle_order_id, object, paused_at, plan_id, status, subscription_start, trial_start, trial_end].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/subscription_update_request.rb b/lib/conekta/models/subscription_update_request.rb new file mode 100644 index 0000000..d6dd84c --- /dev/null +++ b/lib/conekta/models/subscription_update_request.rb @@ -0,0 +1,238 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # You can modify the subscription to change the plan used by your customers. + class SubscriptionUpdateRequest + attr_accessor :plan_id + + attr_accessor :card_id + + attr_accessor :trial_end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'plan_id' => :'plan_id', + :'card_id' => :'card_id', + :'trial_end' => :'trial_end' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'plan_id' => :'String', + :'card_id' => :'String', + :'trial_end' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::SubscriptionUpdateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::SubscriptionUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'plan_id') + self.plan_id = attributes[:'plan_id'] + end + + if attributes.key?(:'card_id') + self.card_id = attributes[:'card_id'] + end + + if attributes.key?(:'trial_end') + self.trial_end = attributes[:'trial_end'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + plan_id == o.plan_id && + card_id == o.card_id && + trial_end == o.trial_end + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [plan_id, card_id, trial_end].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/token.rb b/lib/conekta/models/token.rb new file mode 100644 index 0000000..7621ae0 --- /dev/null +++ b/lib/conekta/models/token.rb @@ -0,0 +1,231 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # a token + class Token + attr_accessor :card + + attr_accessor :checkout + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'card' => :'card', + :'checkout' => :'checkout' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'card' => :'TokenCard', + :'checkout' => :'TokenCheckout' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'card', + :'checkout' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::Token` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::Token`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'card') + self.card = attributes[:'card'] + end + + if attributes.key?(:'checkout') + self.checkout = attributes[:'checkout'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + card == o.card && + checkout == o.checkout + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [card, checkout].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/token_card.rb b/lib/conekta/models/token_card.rb new file mode 100644 index 0000000..380abce --- /dev/null +++ b/lib/conekta/models/token_card.rb @@ -0,0 +1,352 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class TokenCard + # It is a value that allows identifying the security code of the card. + attr_accessor :cvc + + # It is a value that allows identifying the device fingerprint. + attr_accessor :device_fingerprint + + # It is a value that allows identifying the expiration month of the card. + attr_accessor :exp_month + + # It is a value that allows identifying the expiration year of the card. + attr_accessor :exp_year + + # It is a value that allows identifying the name of the cardholder. + attr_accessor :name + + # It is a value that allows identifying the number of the card. + attr_accessor :number + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'cvc' => :'cvc', + :'device_fingerprint' => :'device_fingerprint', + :'exp_month' => :'exp_month', + :'exp_year' => :'exp_year', + :'name' => :'name', + :'number' => :'number' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'cvc' => :'String', + :'device_fingerprint' => :'String', + :'exp_month' => :'String', + :'exp_year' => :'String', + :'name' => :'String', + :'number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::TokenCard` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::TokenCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'cvc') + self.cvc = attributes[:'cvc'] + end + + if attributes.key?(:'device_fingerprint') + self.device_fingerprint = attributes[:'device_fingerprint'] + end + + if attributes.key?(:'exp_month') + self.exp_month = attributes[:'exp_month'] + end + + if attributes.key?(:'exp_year') + self.exp_year = attributes[:'exp_year'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'number') + self.number = attributes[:'number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @cvc.nil? + invalid_properties.push('invalid value for "cvc", cvc cannot be nil.') + end + + if @cvc.to_s.length > 4 + invalid_properties.push('invalid value for "cvc", the character length must be smaller than or equal to 4.') + end + + if @exp_month.nil? + invalid_properties.push('invalid value for "exp_month", exp_month cannot be nil.') + end + + if @exp_month.to_s.length > 2 + invalid_properties.push('invalid value for "exp_month", the character length must be smaller than or equal to 2.') + end + + if @exp_year.nil? + invalid_properties.push('invalid value for "exp_year", exp_year cannot be nil.') + end + + if @exp_year.to_s.length > 2 + invalid_properties.push('invalid value for "exp_year", the character length must be smaller than or equal to 2.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @number.nil? + invalid_properties.push('invalid value for "number", number cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @cvc.nil? + return false if @cvc.to_s.length > 4 + return false if @exp_month.nil? + return false if @exp_month.to_s.length > 2 + return false if @exp_year.nil? + return false if @exp_year.to_s.length > 2 + return false if @name.nil? + return false if @number.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] cvc Value to be assigned + def cvc=(cvc) + if cvc.nil? + fail ArgumentError, 'cvc cannot be nil' + end + + if cvc.to_s.length > 4 + fail ArgumentError, 'invalid value for "cvc", the character length must be smaller than or equal to 4.' + end + + @cvc = cvc + end + + # Custom attribute writer method with validation + # @param [Object] exp_month Value to be assigned + def exp_month=(exp_month) + if exp_month.nil? + fail ArgumentError, 'exp_month cannot be nil' + end + + if exp_month.to_s.length > 2 + fail ArgumentError, 'invalid value for "exp_month", the character length must be smaller than or equal to 2.' + end + + @exp_month = exp_month + end + + # Custom attribute writer method with validation + # @param [Object] exp_year Value to be assigned + def exp_year=(exp_year) + if exp_year.nil? + fail ArgumentError, 'exp_year cannot be nil' + end + + if exp_year.to_s.length > 2 + fail ArgumentError, 'invalid value for "exp_year", the character length must be smaller than or equal to 2.' + end + + @exp_year = exp_year + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + cvc == o.cvc && + device_fingerprint == o.device_fingerprint && + exp_month == o.exp_month && + exp_year == o.exp_year && + name == o.name && + number == o.number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [cvc, device_fingerprint, exp_month, exp_year, name, number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/token_checkout.rb b/lib/conekta/models/token_checkout.rb new file mode 100644 index 0000000..ba89f49 --- /dev/null +++ b/lib/conekta/models/token_checkout.rb @@ -0,0 +1,220 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class TokenCheckout + # It is a value that allows identifying the returns control on. + attr_accessor :returns_control_on + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'returns_control_on' => :'returns_control_on' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'returns_control_on' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::TokenCheckout` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::TokenCheckout`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'returns_control_on') + self.returns_control_on = attributes[:'returns_control_on'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + returns_control_on == o.returns_control_on + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [returns_control_on].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/token_response.rb b/lib/conekta/models/token_response.rb new file mode 100644 index 0000000..9f440f5 --- /dev/null +++ b/lib/conekta/models/token_response.rb @@ -0,0 +1,281 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # token response + class TokenResponse + attr_accessor :checkout + + # Unique identifier for the token generated by Conekta. + attr_accessor :id + + # Indicates whether the token is in live mode or test mode. + attr_accessor :livemode + + # Indicates the type of object, in this case token + attr_accessor :object + + # Indicates if the token has been used + attr_accessor :used + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'checkout' => :'checkout', + :'id' => :'id', + :'livemode' => :'livemode', + :'object' => :'object', + :'used' => :'used' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'checkout' => :'TokenResponseCheckout', + :'id' => :'String', + :'livemode' => :'Boolean', + :'object' => :'String', + :'used' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'checkout', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::TokenResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::TokenResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'checkout') + self.checkout = attributes[:'checkout'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'used') + self.used = attributes[:'used'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @livemode.nil? + invalid_properties.push('invalid value for "livemode", livemode cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @used.nil? + invalid_properties.push('invalid value for "used", used cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @livemode.nil? + return false if @object.nil? + return false if @used.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + checkout == o.checkout && + id == o.id && + livemode == o.livemode && + object == o.object && + used == o.used + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [checkout, id, livemode, object, used].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/token_response_checkout.rb b/lib/conekta/models/token_response_checkout.rb new file mode 100644 index 0000000..6356034 --- /dev/null +++ b/lib/conekta/models/token_response_checkout.rb @@ -0,0 +1,439 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class TokenResponseCheckout + attr_accessor :allowed_payment_methods + + # Indicates if the checkout can not expire. + attr_accessor :can_not_expire + + attr_accessor :emails_sent + + attr_accessor :exclude_card_networks + + # Date and time when the checkout expires. + attr_accessor :expires_at + + # URL to redirect the customer to if the payment process fails. + attr_accessor :failure_url + + # Indicates if the checkout forces the 3DS flow. + attr_accessor :force_3ds_flow + + attr_accessor :id + + attr_accessor :livemode + + attr_accessor :metadata + + # Indicates if the checkout allows monthly installments. + attr_accessor :monthly_installments_enabled + + # List of monthly installments options. + attr_accessor :monthly_installments_options + + attr_accessor :name + + attr_accessor :needs_shipping_contact + + # Indicates the type of object, in this case checkout. + attr_accessor :object + + # Indicates if the checkout allows on demand payments. + attr_accessor :on_demand_enabled + + # Number of payments that have been paid. + attr_accessor :paid_payments_count + + # Indicates if the checkout is recurrent. + attr_accessor :recurrent + + attr_accessor :sms_sent + + # Date and time when the checkout starts. + attr_accessor :starts_at + + # Status of the checkout. + attr_accessor :status + + # URL to redirect the customer to after the payment process is completed. + attr_accessor :success_url + + # Type of checkout. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'allowed_payment_methods' => :'allowed_payment_methods', + :'can_not_expire' => :'can_not_expire', + :'emails_sent' => :'emails_sent', + :'exclude_card_networks' => :'exclude_card_networks', + :'expires_at' => :'expires_at', + :'failure_url' => :'failure_url', + :'force_3ds_flow' => :'force_3ds_flow', + :'id' => :'id', + :'livemode' => :'livemode', + :'metadata' => :'metadata', + :'monthly_installments_enabled' => :'monthly_installments_enabled', + :'monthly_installments_options' => :'monthly_installments_options', + :'name' => :'name', + :'needs_shipping_contact' => :'needs_shipping_contact', + :'object' => :'object', + :'on_demand_enabled' => :'on_demand_enabled', + :'paid_payments_count' => :'paid_payments_count', + :'recurrent' => :'recurrent', + :'sms_sent' => :'sms_sent', + :'starts_at' => :'starts_at', + :'status' => :'status', + :'success_url' => :'success_url', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'allowed_payment_methods' => :'Array', + :'can_not_expire' => :'Boolean', + :'emails_sent' => :'Integer', + :'exclude_card_networks' => :'Array', + :'expires_at' => :'Integer', + :'failure_url' => :'String', + :'force_3ds_flow' => :'Boolean', + :'id' => :'String', + :'livemode' => :'Boolean', + :'metadata' => :'Hash', + :'monthly_installments_enabled' => :'Boolean', + :'monthly_installments_options' => :'Array', + :'name' => :'String', + :'needs_shipping_contact' => :'Boolean', + :'object' => :'String', + :'on_demand_enabled' => :'Boolean', + :'paid_payments_count' => :'Integer', + :'recurrent' => :'Boolean', + :'sms_sent' => :'Integer', + :'starts_at' => :'Integer', + :'status' => :'String', + :'success_url' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::TokenResponseCheckout` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::TokenResponseCheckout`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'allowed_payment_methods') + if (value = attributes[:'allowed_payment_methods']).is_a?(Array) + self.allowed_payment_methods = value + end + end + + if attributes.key?(:'can_not_expire') + self.can_not_expire = attributes[:'can_not_expire'] + end + + if attributes.key?(:'emails_sent') + self.emails_sent = attributes[:'emails_sent'] + end + + if attributes.key?(:'exclude_card_networks') + if (value = attributes[:'exclude_card_networks']).is_a?(Array) + self.exclude_card_networks = value + end + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'failure_url') + self.failure_url = attributes[:'failure_url'] + end + + if attributes.key?(:'force_3ds_flow') + self.force_3ds_flow = attributes[:'force_3ds_flow'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'monthly_installments_enabled') + self.monthly_installments_enabled = attributes[:'monthly_installments_enabled'] + end + + if attributes.key?(:'monthly_installments_options') + if (value = attributes[:'monthly_installments_options']).is_a?(Array) + self.monthly_installments_options = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'needs_shipping_contact') + self.needs_shipping_contact = attributes[:'needs_shipping_contact'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'on_demand_enabled') + self.on_demand_enabled = attributes[:'on_demand_enabled'] + end + + if attributes.key?(:'paid_payments_count') + self.paid_payments_count = attributes[:'paid_payments_count'] + end + + if attributes.key?(:'recurrent') + self.recurrent = attributes[:'recurrent'] + end + + if attributes.key?(:'sms_sent') + self.sms_sent = attributes[:'sms_sent'] + end + + if attributes.key?(:'starts_at') + self.starts_at = attributes[:'starts_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'success_url') + self.success_url = attributes[:'success_url'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + allowed_payment_methods == o.allowed_payment_methods && + can_not_expire == o.can_not_expire && + emails_sent == o.emails_sent && + exclude_card_networks == o.exclude_card_networks && + expires_at == o.expires_at && + failure_url == o.failure_url && + force_3ds_flow == o.force_3ds_flow && + id == o.id && + livemode == o.livemode && + metadata == o.metadata && + monthly_installments_enabled == o.monthly_installments_enabled && + monthly_installments_options == o.monthly_installments_options && + name == o.name && + needs_shipping_contact == o.needs_shipping_contact && + object == o.object && + on_demand_enabled == o.on_demand_enabled && + paid_payments_count == o.paid_payments_count && + recurrent == o.recurrent && + sms_sent == o.sms_sent && + starts_at == o.starts_at && + status == o.status && + success_url == o.success_url && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [allowed_payment_methods, can_not_expire, emails_sent, exclude_card_networks, expires_at, failure_url, force_3ds_flow, id, livemode, metadata, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, object, on_demand_enabled, paid_payments_count, recurrent, sms_sent, starts_at, status, success_url, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/transaction_response.rb b/lib/conekta/models/transaction_response.rb new file mode 100644 index 0000000..64bd0d7 --- /dev/null +++ b/lib/conekta/models/transaction_response.rb @@ -0,0 +1,395 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # The Transaction object represents the actions or steps of an order. Statuses can be: unprocessed, pending, available, owen, paid_out, voided, capture, capture_reversal, liquidation, liquidation_reversal, payout, payout_reversal, refund, refund_reversal, chargeback, chargeback_reversal, rounding_adjustment, won_chargeback, transferred, and transferred. + class TransactionResponse + # The amount of the transaction. + attr_accessor :amount + + # Randomly assigned unique order identifier associated with the charge. + attr_accessor :charge + + # Date and time of creation of the transaction in Unix format. + attr_accessor :created_at + + # The currency of the transaction. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) + attr_accessor :currency + + # The amount to be deducted for taxes and commissions. + attr_accessor :fee + + # Unique identifier of the transaction. + attr_accessor :id + + # Indicates whether the transaction was created in live mode or test mode. + attr_accessor :livemode + + # The net amount after deducting commissions and taxes. + attr_accessor :net + + # Object name, which is transaction. + attr_accessor :object + + # Code indicating transaction status. + attr_accessor :status + + # Transaction Type + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'charge' => :'charge', + :'created_at' => :'created_at', + :'currency' => :'currency', + :'fee' => :'fee', + :'id' => :'id', + :'livemode' => :'livemode', + :'net' => :'net', + :'object' => :'object', + :'status' => :'status', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'charge' => :'String', + :'created_at' => :'Integer', + :'currency' => :'String', + :'fee' => :'Integer', + :'id' => :'String', + :'livemode' => :'Boolean', + :'net' => :'Integer', + :'object' => :'String', + :'status' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::TransactionResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::TransactionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'charge') + self.charge = attributes[:'charge'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'fee') + self.fee = attributes[:'fee'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'net') + self.net = attributes[:'net'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @charge.nil? + invalid_properties.push('invalid value for "charge", charge cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @currency.nil? + invalid_properties.push('invalid value for "currency", currency cannot be nil.') + end + + if @currency.to_s.length > 3 + invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') + end + + if @fee.nil? + invalid_properties.push('invalid value for "fee", fee cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @livemode.nil? + invalid_properties.push('invalid value for "livemode", livemode cannot be nil.') + end + + if @net.nil? + invalid_properties.push('invalid value for "net", net cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @charge.nil? + return false if @created_at.nil? + return false if @currency.nil? + return false if @currency.to_s.length > 3 + return false if @fee.nil? + return false if @id.nil? + return false if @livemode.nil? + return false if @net.nil? + return false if @object.nil? + return false if @status.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if currency.nil? + fail ArgumentError, 'currency cannot be nil' + end + + if currency.to_s.length > 3 + fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.' + end + + @currency = currency + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + charge == o.charge && + created_at == o.created_at && + currency == o.currency && + fee == o.fee && + id == o.id && + livemode == o.livemode && + net == o.net && + object == o.object && + status == o.status && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, charge, created_at, currency, fee, id, livemode, net, object, status, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/transfer_destination_response.rb b/lib/conekta/models/transfer_destination_response.rb new file mode 100644 index 0000000..aad2795 --- /dev/null +++ b/lib/conekta/models/transfer_destination_response.rb @@ -0,0 +1,291 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Method used to make the transfer. + class TransferDestinationResponse + # Name of the account holder. + attr_accessor :account_holder + + # Account number of the bank account. + attr_accessor :account_number + + # Name of the bank. + attr_accessor :bank + + # Date and time of creation of the transfer. + attr_accessor :created_at + + # Unique identifier of the transfer. + attr_accessor :id + + # Object name, which is bank_transfer_payout_method. + attr_accessor :object + + # Unique identifier of the payee. + attr_accessor :payee_id + + # Type of the payee. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_holder' => :'account_holder', + :'account_number' => :'account_number', + :'bank' => :'bank', + :'created_at' => :'created_at', + :'id' => :'id', + :'object' => :'object', + :'payee_id' => :'payee_id', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_holder' => :'String', + :'account_number' => :'String', + :'bank' => :'String', + :'created_at' => :'Integer', + :'id' => :'String', + :'object' => :'String', + :'payee_id' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::TransferDestinationResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::TransferDestinationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_holder') + self.account_holder = attributes[:'account_holder'] + end + + if attributes.key?(:'account_number') + self.account_number = attributes[:'account_number'] + end + + if attributes.key?(:'bank') + self.bank = attributes[:'bank'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'payee_id') + self.payee_id = attributes[:'payee_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_holder == o.account_holder && + account_number == o.account_number && + bank == o.bank && + created_at == o.created_at && + id == o.id && + object == o.object && + payee_id == o.payee_id && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_holder, account_number, bank, created_at, id, object, payee_id, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/transfer_method_response.rb b/lib/conekta/models/transfer_method_response.rb new file mode 100644 index 0000000..d2104ea --- /dev/null +++ b/lib/conekta/models/transfer_method_response.rb @@ -0,0 +1,291 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # Method used to make the transfer. + class TransferMethodResponse + # Name of the account holder. + attr_accessor :account_holder + + # Account number of the bank account. + attr_accessor :account_number + + # Name of the bank. + attr_accessor :bank + + # Date and time of creation of the transfer. + attr_accessor :created_at + + # Unique identifier of the transfer. + attr_accessor :id + + # Object name, which is bank_transfer_payout_method. + attr_accessor :object + + # Unique identifier of the payee. + attr_accessor :payee_id + + # Type of the payee. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_holder' => :'account_holder', + :'account_number' => :'account_number', + :'bank' => :'bank', + :'created_at' => :'created_at', + :'id' => :'id', + :'object' => :'object', + :'payee_id' => :'payee_id', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_holder' => :'String', + :'account_number' => :'String', + :'bank' => :'String', + :'created_at' => :'Integer', + :'id' => :'String', + :'object' => :'String', + :'payee_id' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::TransferMethodResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::TransferMethodResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_holder') + self.account_holder = attributes[:'account_holder'] + end + + if attributes.key?(:'account_number') + self.account_number = attributes[:'account_number'] + end + + if attributes.key?(:'bank') + self.bank = attributes[:'bank'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'payee_id') + self.payee_id = attributes[:'payee_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_holder == o.account_holder && + account_number == o.account_number && + bank == o.bank && + created_at == o.created_at && + id == o.id && + object == o.object && + payee_id == o.payee_id && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_holder, account_number, bank, created_at, id, object, payee_id, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/transfer_response.rb b/lib/conekta/models/transfer_response.rb new file mode 100644 index 0000000..2b56d1b --- /dev/null +++ b/lib/conekta/models/transfer_response.rb @@ -0,0 +1,325 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # A transfer represents the action of sending an amount to a business bank account including the status, amount and method used to make the transfer. + class TransferResponse + # Amount in cents of the transfer. + attr_accessor :amount + + # Date and time of creation of the transfer in Unix format. + attr_accessor :created_at + + # The currency of the transfer. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) + attr_accessor :currency + + # Unique identifier of the transfer. + attr_accessor :id + + # Indicates whether the transfer was created in live mode or test mode. + attr_accessor :livemode + + attr_accessor :destination + + # Object name, which is transfer. + attr_accessor :object + + # Description of the transfer. + attr_accessor :statement_description + + # Reference number of the transfer. + attr_accessor :statement_reference + + # Code indicating transfer status. + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'created_at' => :'created_at', + :'currency' => :'currency', + :'id' => :'id', + :'livemode' => :'livemode', + :'destination' => :'destination', + :'object' => :'object', + :'statement_description' => :'statement_description', + :'statement_reference' => :'statement_reference', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'created_at' => :'Integer', + :'currency' => :'String', + :'id' => :'String', + :'livemode' => :'Boolean', + :'destination' => :'TransferDestinationResponse', + :'object' => :'String', + :'statement_description' => :'String', + :'statement_reference' => :'String', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::TransferResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::TransferResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'destination') + self.destination = attributes[:'destination'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'statement_description') + self.statement_description = attributes[:'statement_description'] + end + + if attributes.key?(:'statement_reference') + self.statement_reference = attributes[:'statement_reference'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@currency.nil? && @currency.to_s.length > 3 + invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@currency.nil? && @currency.to_s.length > 3 + true + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if !currency.nil? && currency.to_s.length > 3 + fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.' + end + + @currency = currency + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + created_at == o.created_at && + currency == o.currency && + id == o.id && + livemode == o.livemode && + destination == o.destination && + object == o.object && + statement_description == o.statement_description && + statement_reference == o.statement_reference && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, created_at, currency, id, livemode, destination, object, statement_description, statement_reference, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/transfers_response.rb b/lib/conekta/models/transfers_response.rb new file mode 100644 index 0000000..b92e367 --- /dev/null +++ b/lib/conekta/models/transfers_response.rb @@ -0,0 +1,325 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # A transfer represents the action of sending an amount to a business bank account including the status, amount and method used to make the transfer. + class TransfersResponse + # Amount in cents of the transfer. + attr_accessor :amount + + # Date and time of creation of the transfer. + attr_accessor :created_at + + # The currency of the transfer. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) + attr_accessor :currency + + # Unique identifier of the transfer. + attr_accessor :id + + # Indicates whether the transfer was created in live mode or test mode. + attr_accessor :livemode + + attr_accessor :method + + # Object name, which is transfer. + attr_accessor :object + + # Description of the transfer. + attr_accessor :statement_description + + # Reference number of the transfer. + attr_accessor :statement_reference + + # Code indicating transfer status. + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'created_at' => :'created_at', + :'currency' => :'currency', + :'id' => :'id', + :'livemode' => :'livemode', + :'method' => :'method', + :'object' => :'object', + :'statement_description' => :'statement_description', + :'statement_reference' => :'statement_reference', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'created_at' => :'Integer', + :'currency' => :'String', + :'id' => :'String', + :'livemode' => :'Boolean', + :'method' => :'TransferMethodResponse', + :'object' => :'String', + :'statement_description' => :'String', + :'statement_reference' => :'String', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::TransfersResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::TransfersResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'method') + self.method = attributes[:'method'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'statement_description') + self.statement_description = attributes[:'statement_description'] + end + + if attributes.key?(:'statement_reference') + self.statement_reference = attributes[:'statement_reference'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@currency.nil? && @currency.to_s.length > 3 + invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@currency.nil? && @currency.to_s.length > 3 + true + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if !currency.nil? && currency.to_s.length > 3 + fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.' + end + + @currency = currency + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + created_at == o.created_at && + currency == o.currency && + id == o.id && + livemode == o.livemode && + method == o.method && + object == o.object && + statement_description == o.statement_description && + statement_reference == o.statement_reference && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, created_at, currency, id, livemode, method, object, statement_description, statement_reference, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_customer.rb b/lib/conekta/models/update_customer.rb new file mode 100644 index 0000000..7aa8ca7 --- /dev/null +++ b/lib/conekta/models/update_customer.rb @@ -0,0 +1,373 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # update customer + class UpdateCustomer + attr_accessor :antifraud_info + + # It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id) + attr_accessor :default_payment_source_id + + # An email address is a series of customizable characters followed by a universal Internet symbol, the at symbol (@), the name of a host server, and a web domain ending (.mx, .com, .org, . net, etc). + attr_accessor :email + + # Client's name + attr_accessor :name + + # Is the customer's phone number + attr_accessor :phone + + # Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription + attr_accessor :plan_id + + # It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact) + attr_accessor :default_shipping_contact_id + + # It is a value that allows identifying if the email is corporate or not. + attr_accessor :corporate + + # It is an undefined value. + attr_accessor :custom_reference + + attr_accessor :fiscal_entities + + attr_accessor :metadata + + # Contains details of the payment methods that the customer has active or has used in Conekta + attr_accessor :payment_sources + + # Contains the detail of the shipping addresses that the client has active or has used in Conekta + attr_accessor :shipping_contacts + + attr_accessor :subscription + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'antifraud_info' => :'antifraud_info', + :'default_payment_source_id' => :'default_payment_source_id', + :'email' => :'email', + :'name' => :'name', + :'phone' => :'phone', + :'plan_id' => :'plan_id', + :'default_shipping_contact_id' => :'default_shipping_contact_id', + :'corporate' => :'corporate', + :'custom_reference' => :'custom_reference', + :'fiscal_entities' => :'fiscal_entities', + :'metadata' => :'metadata', + :'payment_sources' => :'payment_sources', + :'shipping_contacts' => :'shipping_contacts', + :'subscription' => :'subscription' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'antifraud_info' => :'UpdateCustomerAntifraudInfo', + :'default_payment_source_id' => :'String', + :'email' => :'String', + :'name' => :'String', + :'phone' => :'String', + :'plan_id' => :'String', + :'default_shipping_contact_id' => :'String', + :'corporate' => :'Boolean', + :'custom_reference' => :'String', + :'fiscal_entities' => :'Array', + :'metadata' => :'Hash', + :'payment_sources' => :'Array', + :'shipping_contacts' => :'Array', + :'subscription' => :'SubscriptionRequest' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'antifraud_info', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdateCustomer` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdateCustomer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'antifraud_info') + self.antifraud_info = attributes[:'antifraud_info'] + end + + if attributes.key?(:'default_payment_source_id') + self.default_payment_source_id = attributes[:'default_payment_source_id'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'plan_id') + self.plan_id = attributes[:'plan_id'] + end + + if attributes.key?(:'default_shipping_contact_id') + self.default_shipping_contact_id = attributes[:'default_shipping_contact_id'] + end + + if attributes.key?(:'corporate') + self.corporate = attributes[:'corporate'] + else + self.corporate = false + end + + if attributes.key?(:'custom_reference') + self.custom_reference = attributes[:'custom_reference'] + end + + if attributes.key?(:'fiscal_entities') + if (value = attributes[:'fiscal_entities']).is_a?(Array) + self.fiscal_entities = value + end + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'payment_sources') + if (value = attributes[:'payment_sources']).is_a?(Array) + self.payment_sources = value + end + end + + if attributes.key?(:'shipping_contacts') + if (value = attributes[:'shipping_contacts']).is_a?(Array) + self.shipping_contacts = value + end + end + + if attributes.key?(:'subscription') + self.subscription = attributes[:'subscription'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@metadata.nil? && @metadata.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + antifraud_info == o.antifraud_info && + default_payment_source_id == o.default_payment_source_id && + email == o.email && + name == o.name && + phone == o.phone && + plan_id == o.plan_id && + default_shipping_contact_id == o.default_shipping_contact_id && + corporate == o.corporate && + custom_reference == o.custom_reference && + fiscal_entities == o.fiscal_entities && + metadata == o.metadata && + payment_sources == o.payment_sources && + shipping_contacts == o.shipping_contacts && + subscription == o.subscription + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [antifraud_info, default_payment_source_id, email, name, phone, plan_id, default_shipping_contact_id, corporate, custom_reference, fiscal_entities, metadata, payment_sources, shipping_contacts, subscription].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_customer_antifraud_info.rb b/lib/conekta/models/update_customer_antifraud_info.rb new file mode 100644 index 0000000..51cdf49 --- /dev/null +++ b/lib/conekta/models/update_customer_antifraud_info.rb @@ -0,0 +1,228 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class UpdateCustomerAntifraudInfo + attr_accessor :account_created_at + + attr_accessor :first_paid_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_created_at' => :'account_created_at', + :'first_paid_at' => :'first_paid_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_created_at' => :'Integer', + :'first_paid_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdateCustomerAntifraudInfo` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdateCustomerAntifraudInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_created_at') + self.account_created_at = attributes[:'account_created_at'] + end + + if attributes.key?(:'first_paid_at') + self.first_paid_at = attributes[:'first_paid_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_created_at == o.account_created_at && + first_paid_at == o.first_paid_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_created_at, first_paid_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_customer_fiscal_entities_response.rb b/lib/conekta/models/update_customer_fiscal_entities_response.rb new file mode 100644 index 0000000..28a19db --- /dev/null +++ b/lib/conekta/models/update_customer_fiscal_entities_response.rb @@ -0,0 +1,339 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class UpdateCustomerFiscalEntitiesResponse + attr_accessor :address + + attr_accessor :tax_id + + attr_accessor :email + + attr_accessor :phone + + attr_accessor :metadata + + attr_accessor :company_name + + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + attr_accessor :parent_id + + attr_accessor :default + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'tax_id' => :'tax_id', + :'email' => :'email', + :'phone' => :'phone', + :'metadata' => :'metadata', + :'company_name' => :'company_name', + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'parent_id' => :'parent_id', + :'default' => :'default' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'address' => :'CustomerFiscalEntitiesRequestAddress', + :'tax_id' => :'String', + :'email' => :'String', + :'phone' => :'String', + :'metadata' => :'Hash', + :'company_name' => :'String', + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer', + :'parent_id' => :'String', + :'default' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CustomerFiscalEntitiesRequest', + :'UpdateCustomerFiscalEntitiesResponseAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdateCustomerFiscalEntitiesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdateCustomerFiscalEntitiesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'tax_id') + self.tax_id = attributes[:'tax_id'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'phone'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'company_name') + self.company_name = attributes[:'company_name'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @address.nil? + invalid_properties.push('invalid value for "address", address cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @address.nil? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + address == o.address && + tax_id == o.tax_id && + email == o.email && + phone == o.phone && + metadata == o.metadata && + company_name == o.company_name && + id == o.id && + object == o.object && + created_at == o.created_at && + parent_id == o.parent_id && + default == o.default + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [address, tax_id, email, phone, metadata, company_name, id, object, created_at, parent_id, default].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_customer_fiscal_entities_response_all_of.rb b/lib/conekta/models/update_customer_fiscal_entities_response_all_of.rb new file mode 100644 index 0000000..10270a2 --- /dev/null +++ b/lib/conekta/models/update_customer_fiscal_entities_response_all_of.rb @@ -0,0 +1,270 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class UpdateCustomerFiscalEntitiesResponseAllOf + attr_accessor :id + + attr_accessor :object + + attr_accessor :created_at + + attr_accessor :parent_id + + attr_accessor :default + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'created_at' => :'created_at', + :'parent_id' => :'parent_id', + :'default' => :'default' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'created_at' => :'Integer', + :'parent_id' => :'String', + :'default' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdateCustomerFiscalEntitiesResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdateCustomerFiscalEntitiesResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @object.nil? + return false if @created_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + created_at == o.created_at && + parent_id == o.parent_id && + default == o.default + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, created_at, parent_id, default].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_customer_payment_methods_response.rb b/lib/conekta/models/update_customer_payment_methods_response.rb new file mode 100644 index 0000000..d790794 --- /dev/null +++ b/lib/conekta/models/update_customer_payment_methods_response.rb @@ -0,0 +1,58 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + module UpdateCustomerPaymentMethodsResponse + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'PaymentMethodCardResponse', + :'PaymentMethodCashResponse', + :'PaymentMethodSpeiRecurrent' + ] + end + + # Discriminator's property name (OpenAPI v3) + def openapi_discriminator_name + :'type' + end + + # Discriminator's mapping (OpenAPI v3) + def openapi_discriminator_mapping + { + :'card' => :'PaymentMethodCardResponse', + :'cash' => :'PaymentMethodCashResponse', + :'oxxo_recurrent' => :'PaymentMethodCashResponse', + :'spei_recurrent' => :'PaymentMethodSpeiRecurrent' + } + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + discriminator_value = data[openapi_discriminator_name] + return nil if discriminator_value.nil? + + klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym] + return nil unless klass + + Conekta.const_get(klass).build_from_hash(data) + end + end + end + +end diff --git a/lib/conekta/models/update_order_discount_lines_request.rb b/lib/conekta/models/update_order_discount_lines_request.rb new file mode 100644 index 0000000..3f7b063 --- /dev/null +++ b/lib/conekta/models/update_order_discount_lines_request.rb @@ -0,0 +1,254 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # List of discounts that apply to the order. + class UpdateOrderDiscountLinesRequest + attr_accessor :amount + + # Discount code. + attr_accessor :code + + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'code' => :'code', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'code' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdateOrderDiscountLinesRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdateOrderDiscountLinesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@amount.nil? && @amount < 0 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@amount.nil? && @amount < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if !amount.nil? && amount < 0 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.' + end + + @amount = amount + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + code == o.code && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, code, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_order_tax_request.rb b/lib/conekta/models/update_order_tax_request.rb new file mode 100644 index 0000000..2954a80 --- /dev/null +++ b/lib/conekta/models/update_order_tax_request.rb @@ -0,0 +1,287 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # create new taxes for an existing order + class UpdateOrderTaxRequest + # The amount to be collected for tax in cents + attr_accessor :amount + + # description or tax's name + attr_accessor :description + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'description' => :'description', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'description' => :'String', + :'metadata' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdateOrderTaxRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdateOrderTaxRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@amount.nil? && @amount < 0 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') + end + + if !@description.nil? && @description.to_s.length < 2 + invalid_properties.push('invalid value for "description", the character length must be great than or equal to 2.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@amount.nil? && @amount < 0 + return false if !@description.nil? && @description.to_s.length < 2 + return false if !@metadata.nil? && @metadata.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if !amount.nil? && amount < 0 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.' + end + + @amount = amount + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if !description.nil? && description.to_s.length < 2 + fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 2.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + description == o.description && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, description, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_order_tax_response.rb b/lib/conekta/models/update_order_tax_response.rb new file mode 100644 index 0000000..a4ddb44 --- /dev/null +++ b/lib/conekta/models/update_order_tax_response.rb @@ -0,0 +1,345 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # create new taxes for an existing order response + class UpdateOrderTaxResponse + # The amount to be collected for tax in cents + attr_accessor :amount + + # description or tax's name + attr_accessor :description + + attr_accessor :metadata + + attr_accessor :id + + attr_accessor :object + + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'description' => :'description', + :'metadata' => :'metadata', + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'description' => :'String', + :'metadata' => :'Hash', + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'OrderTaxRequest', + :'UpdateOrderTaxResponseAllOf' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdateOrderTaxResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdateOrderTaxResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @amount < 0 + invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.') + end + + if @description.nil? + invalid_properties.push('invalid value for "description", description cannot be nil.') + end + + if @description.to_s.length < 2 + invalid_properties.push('invalid value for "description", the character length must be great than or equal to 2.') + end + + if !@metadata.nil? && @metadata.length > 100 + invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @amount.nil? + return false if @amount < 0 + return false if @description.nil? + return false if @description.to_s.length < 2 + return false if !@metadata.nil? && @metadata.length > 100 + return false if @id.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + if amount < 0 + fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.' + end + + @amount = amount + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if description.nil? + fail ArgumentError, 'description cannot be nil' + end + + if description.to_s.length < 2 + fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 2.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if !metadata.nil? && metadata.length > 100 + fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.' + end + + @metadata = metadata + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + description == o.description && + metadata == o.metadata && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, description, metadata, id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_order_tax_response_all_of.rb b/lib/conekta/models/update_order_tax_response_all_of.rb new file mode 100644 index 0000000..1620e26 --- /dev/null +++ b/lib/conekta/models/update_order_tax_response_all_of.rb @@ -0,0 +1,237 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class UpdateOrderTaxResponseAllOf + attr_accessor :id + + attr_accessor :object + + attr_accessor :parent_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'object' => :'object', + :'parent_id' => :'parent_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'object' => :'String', + :'parent_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdateOrderTaxResponseAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdateOrderTaxResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + object == o.object && + parent_id == o.parent_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, object, parent_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_payment_methods.rb b/lib/conekta/models/update_payment_methods.rb new file mode 100644 index 0000000..e1d5318 --- /dev/null +++ b/lib/conekta/models/update_payment_methods.rb @@ -0,0 +1,219 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class UpdatePaymentMethods + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdatePaymentMethods` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdatePaymentMethods`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/update_product.rb b/lib/conekta/models/update_product.rb new file mode 100644 index 0000000..8d517fe --- /dev/null +++ b/lib/conekta/models/update_product.rb @@ -0,0 +1,342 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class UpdateProduct + attr_accessor :antifraud_info + + attr_accessor :description + + attr_accessor :sku + + attr_accessor :name + + attr_accessor :unit_price + + attr_accessor :quantity + + attr_accessor :tags + + attr_accessor :brand + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'antifraud_info' => :'antifraud_info', + :'description' => :'description', + :'sku' => :'sku', + :'name' => :'name', + :'unit_price' => :'unit_price', + :'quantity' => :'quantity', + :'tags' => :'tags', + :'brand' => :'brand', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'antifraud_info' => :'Hash', + :'description' => :'String', + :'sku' => :'String', + :'name' => :'String', + :'unit_price' => :'Integer', + :'quantity' => :'Integer', + :'tags' => :'Array', + :'brand' => :'String', + :'metadata' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::UpdateProduct` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::UpdateProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'antifraud_info') + if (value = attributes[:'antifraud_info']).is_a?(Hash) + self.antifraud_info = value + end + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'sku') + self.sku = attributes[:'sku'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'unit_price') + self.unit_price = attributes[:'unit_price'] + end + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'brand') + self.brand = attributes[:'brand'] + end + + if attributes.key?(:'metadata') + if (value = attributes[:'metadata']).is_a?(Hash) + self.metadata = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@description.nil? && @description.to_s.length > 250 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.') + end + + if !@unit_price.nil? && @unit_price < 0 + invalid_properties.push('invalid value for "unit_price", must be greater than or equal to 0.') + end + + if !@quantity.nil? && @quantity < 1 + invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@description.nil? && @description.to_s.length > 250 + return false if !@unit_price.nil? && @unit_price < 0 + return false if !@quantity.nil? && @quantity < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if !description.nil? && description.to_s.length > 250 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if !unit_price.nil? && unit_price < 0 + fail ArgumentError, 'invalid value for "unit_price", must be greater than or equal to 0.' + end + + @unit_price = unit_price + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if !quantity.nil? && quantity < 1 + fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.' + end + + @quantity = quantity + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + antifraud_info == o.antifraud_info && + description == o.description && + sku == o.sku && + name == o.name && + unit_price == o.unit_price && + quantity == o.quantity && + tags == o.tags && + brand == o.brand && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [antifraud_info, description, sku, name, unit_price, quantity, tags, brand, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/webhook_key_create_response.rb b/lib/conekta/models/webhook_key_create_response.rb new file mode 100644 index 0000000..d5666c9 --- /dev/null +++ b/lib/conekta/models/webhook_key_create_response.rb @@ -0,0 +1,271 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # webhook keys model + class WebhookKeyCreateResponse + # Indicates if the webhook key is active + attr_accessor :active + + # Unix timestamp in seconds with the creation date of the webhook key + attr_accessor :created_at + + # Unique identifier of the webhook key + attr_accessor :id + + # Indicates if the webhook key is in live mode + attr_accessor :livemode + + # Object name, value is webhook_key + attr_accessor :object + + # Public key to be used in the webhook + attr_accessor :public_key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'active' => :'active', + :'created_at' => :'created_at', + :'id' => :'id', + :'livemode' => :'livemode', + :'object' => :'object', + :'public_key' => :'public_key' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'active' => :'Boolean', + :'created_at' => :'Integer', + :'id' => :'String', + :'livemode' => :'Boolean', + :'object' => :'String', + :'public_key' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WebhookKeyCreateResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WebhookKeyCreateResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'public_key') + self.public_key = attributes[:'public_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active && + created_at == o.created_at && + id == o.id && + livemode == o.livemode && + object == o.object && + public_key == o.public_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [active, created_at, id, livemode, object, public_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/webhook_key_delete_response.rb b/lib/conekta/models/webhook_key_delete_response.rb new file mode 100644 index 0000000..1575476 --- /dev/null +++ b/lib/conekta/models/webhook_key_delete_response.rb @@ -0,0 +1,271 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # webhook keys model + class WebhookKeyDeleteResponse + # Indicates if the webhook key is active + attr_accessor :active + + # Unix timestamp in seconds with the creation date of the webhook key + attr_accessor :created_at + + # Indicates if the webhook key is deleted + attr_accessor :deleted + + # Unique identifier of the webhook key + attr_accessor :id + + # Indicates if the webhook key is in live mode + attr_accessor :livemode + + # Object name, value is webhook_key + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'active' => :'active', + :'created_at' => :'created_at', + :'deleted' => :'deleted', + :'id' => :'id', + :'livemode' => :'livemode', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'active' => :'Boolean', + :'created_at' => :'Integer', + :'deleted' => :'Boolean', + :'id' => :'String', + :'livemode' => :'Boolean', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WebhookKeyDeleteResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WebhookKeyDeleteResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active && + created_at == o.created_at && + deleted == o.deleted && + id == o.id && + livemode == o.livemode && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [active, created_at, deleted, id, livemode, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/webhook_key_request.rb b/lib/conekta/models/webhook_key_request.rb new file mode 100644 index 0000000..01eb75a --- /dev/null +++ b/lib/conekta/models/webhook_key_request.rb @@ -0,0 +1,222 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class WebhookKeyRequest + # Indicates if the webhook key is active + attr_accessor :active + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'active' => :'active' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'active' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WebhookKeyRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WebhookKeyRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + else + self.active = true + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [active].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/webhook_key_response.rb b/lib/conekta/models/webhook_key_response.rb new file mode 100644 index 0000000..ef60ac1 --- /dev/null +++ b/lib/conekta/models/webhook_key_response.rb @@ -0,0 +1,282 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # webhook keys model + class WebhookKeyResponse + # Unique identifier of the webhook key + attr_accessor :id + + # Indicates if the webhook key is active + attr_accessor :active + + # Unix timestamp in seconds with the creation date of the webhook key + attr_accessor :created_at + + # Unix timestamp in seconds with the deactivation date of the webhook key + attr_accessor :deactivated_at + + # Public key to be used in the webhook + attr_accessor :public_key + + # Indicates if the webhook key is in live mode + attr_accessor :livemode + + # Object name, value is webhook_key + attr_accessor :object + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'active' => :'active', + :'created_at' => :'created_at', + :'deactivated_at' => :'deactivated_at', + :'public_key' => :'public_key', + :'livemode' => :'livemode', + :'object' => :'object' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'active' => :'Boolean', + :'created_at' => :'Integer', + :'deactivated_at' => :'Integer', + :'public_key' => :'String', + :'livemode' => :'Boolean', + :'object' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'deactivated_at', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WebhookKeyResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WebhookKeyResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'deactivated_at') + self.deactivated_at = attributes[:'deactivated_at'] + end + + if attributes.key?(:'public_key') + self.public_key = attributes[:'public_key'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + active == o.active && + created_at == o.created_at && + deactivated_at == o.deactivated_at && + public_key == o.public_key && + livemode == o.livemode && + object == o.object + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, active, created_at, deactivated_at, public_key, livemode, object].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/webhook_key_update_request.rb b/lib/conekta/models/webhook_key_update_request.rb new file mode 100644 index 0000000..7865b9d --- /dev/null +++ b/lib/conekta/models/webhook_key_update_request.rb @@ -0,0 +1,222 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class WebhookKeyUpdateRequest + # Indicates if the webhook key is active + attr_accessor :active + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'active' => :'active' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'active' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WebhookKeyUpdateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WebhookKeyUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + else + self.active = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [active].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/webhook_log.rb b/lib/conekta/models/webhook_log.rb new file mode 100644 index 0000000..b44dba8 --- /dev/null +++ b/lib/conekta/models/webhook_log.rb @@ -0,0 +1,290 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class WebhookLog + attr_accessor :failed_attempts + + attr_accessor :id + + attr_accessor :last_attempted_at + + attr_accessor :last_http_response_status + + attr_accessor :object + + attr_accessor :response_data + + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'failed_attempts' => :'failed_attempts', + :'id' => :'id', + :'last_attempted_at' => :'last_attempted_at', + :'last_http_response_status' => :'last_http_response_status', + :'object' => :'object', + :'response_data' => :'response_data', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'failed_attempts' => :'Integer', + :'id' => :'String', + :'last_attempted_at' => :'Integer', + :'last_http_response_status' => :'Integer', + :'object' => :'String', + :'response_data' => :'Hash', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WebhookLog` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WebhookLog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'failed_attempts') + self.failed_attempts = attributes[:'failed_attempts'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'last_attempted_at') + self.last_attempted_at = attributes[:'last_attempted_at'] + end + + if attributes.key?(:'last_http_response_status') + self.last_http_response_status = attributes[:'last_http_response_status'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'response_data') + if (value = attributes[:'response_data']).is_a?(Hash) + self.response_data = value + end + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@response_data.nil? && @response_data.length > 100 + invalid_properties.push('invalid value for "response_data", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@response_data.nil? && @response_data.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] response_data Value to be assigned + def response_data=(response_data) + if !response_data.nil? && response_data.length > 100 + fail ArgumentError, 'invalid value for "response_data", number of items must be less than or equal to 100.' + end + + @response_data = response_data + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + failed_attempts == o.failed_attempts && + id == o.id && + last_attempted_at == o.last_attempted_at && + last_http_response_status == o.last_http_response_status && + object == o.object && + response_data == o.response_data && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [failed_attempts, id, last_attempted_at, last_http_response_status, object, response_data, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/webhook_request.rb b/lib/conekta/models/webhook_request.rb new file mode 100644 index 0000000..bc44d99 --- /dev/null +++ b/lib/conekta/models/webhook_request.rb @@ -0,0 +1,264 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # a webhook + class WebhookRequest + # Here you must place the URL of your Webhook remember that you must program what you will do with the events received. Also do not forget to handle the HTTPS protocol for greater security. + attr_accessor :url + + # It is a value that allows to decide if the events will be synchronous or asynchronous. We recommend asynchronous = false + attr_accessor :synchronous + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'synchronous' => :'synchronous' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String', + :'synchronous' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WebhookRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WebhookRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'synchronous') + self.synchronous = attributes[:'synchronous'] + else + self.synchronous = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + pattern = Regexp.new(/^(?!.*(localhost|127\.0\.0\.1)).*$/) + if @url !~ pattern + invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.") + end + + if @synchronous.nil? + invalid_properties.push('invalid value for "synchronous", synchronous cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @url.nil? + return false if @url !~ Regexp.new(/^(?!.*(localhost|127\.0\.0\.1)).*$/) + return false if @synchronous.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] url Value to be assigned + def url=(url) + if url.nil? + fail ArgumentError, 'url cannot be nil' + end + + pattern = Regexp.new(/^(?!.*(localhost|127\.0\.0\.1)).*$/) + if url !~ pattern + fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}." + end + + @url = url + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + synchronous == o.synchronous + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, synchronous].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/webhook_response.rb b/lib/conekta/models/webhook_response.rb new file mode 100644 index 0000000..f782330 --- /dev/null +++ b/lib/conekta/models/webhook_response.rb @@ -0,0 +1,304 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # webhooks model + class WebhookResponse + attr_accessor :deleted + + attr_accessor :development_enabled + + attr_accessor :id + + attr_accessor :livemode + + attr_accessor :object + + attr_accessor :production_enabled + + attr_accessor :status + + attr_accessor :subscribed_events + + attr_accessor :synchronous + + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'deleted' => :'deleted', + :'development_enabled' => :'development_enabled', + :'id' => :'id', + :'livemode' => :'livemode', + :'object' => :'object', + :'production_enabled' => :'production_enabled', + :'status' => :'status', + :'subscribed_events' => :'subscribed_events', + :'synchronous' => :'synchronous', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'deleted' => :'Boolean', + :'development_enabled' => :'Boolean', + :'id' => :'String', + :'livemode' => :'Boolean', + :'object' => :'String', + :'production_enabled' => :'Boolean', + :'status' => :'String', + :'subscribed_events' => :'Array', + :'synchronous' => :'Boolean', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'deleted', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WebhookResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WebhookResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + + if attributes.key?(:'development_enabled') + self.development_enabled = attributes[:'development_enabled'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'production_enabled') + self.production_enabled = attributes[:'production_enabled'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'subscribed_events') + if (value = attributes[:'subscribed_events']).is_a?(Array) + self.subscribed_events = value + end + end + + if attributes.key?(:'synchronous') + self.synchronous = attributes[:'synchronous'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + deleted == o.deleted && + development_enabled == o.development_enabled && + id == o.id && + livemode == o.livemode && + object == o.object && + production_enabled == o.production_enabled && + status == o.status && + subscribed_events == o.subscribed_events && + synchronous == o.synchronous && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [deleted, development_enabled, id, livemode, object, production_enabled, status, subscribed_events, synchronous, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/webhook_update_request.rb b/lib/conekta/models/webhook_update_request.rb new file mode 100644 index 0000000..c5684d2 --- /dev/null +++ b/lib/conekta/models/webhook_update_request.rb @@ -0,0 +1,270 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + # an updated webhook + class WebhookUpdateRequest + # Here you must place the URL of your Webhook remember that you must program what you will do with the events received. Also do not forget to handle the HTTPS protocol for greater security. + attr_accessor :url + + # It is a value that allows to decide if the events will be synchronous or asynchronous. We recommend asynchronous = false + attr_accessor :synchronous + + attr_accessor :subscribed_events + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'synchronous' => :'synchronous', + :'subscribed_events' => :'subscribed_events' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String', + :'synchronous' => :'Boolean', + :'subscribed_events' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WebhookUpdateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WebhookUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'synchronous') + self.synchronous = attributes[:'synchronous'] + else + self.synchronous = false + end + + if attributes.key?(:'subscribed_events') + if (value = attributes[:'subscribed_events']).is_a?(Array) + self.subscribed_events = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + pattern = Regexp.new(/^(?!.*(localhost|127\.0\.0\.1)).*$/) + if @url !~ pattern + invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @url.nil? + return false if @url !~ Regexp.new(/^(?!.*(localhost|127\.0\.0\.1)).*$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] url Value to be assigned + def url=(url) + if url.nil? + fail ArgumentError, 'url cannot be nil' + end + + pattern = Regexp.new(/^(?!.*(localhost|127\.0\.0\.1)).*$/) + if url !~ pattern + fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}." + end + + @url = url + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + synchronous == o.synchronous && + subscribed_events == o.subscribed_events + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, synchronous, subscribed_events].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/whitelistlist_rule_response.rb b/lib/conekta/models/whitelistlist_rule_response.rb new file mode 100644 index 0000000..0fb4aa6 --- /dev/null +++ b/lib/conekta/models/whitelistlist_rule_response.rb @@ -0,0 +1,250 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module Conekta + class WhitelistlistRuleResponse + # Whitelist rule id + attr_accessor :id + + # field used for whitelists rule + attr_accessor :field + + # value used for whitelists rule + attr_accessor :value + + # use an description for whitelisted rule + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'field' => :'field', + :'value' => :'value', + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'field' => :'String', + :'value' => :'String', + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::WhitelistlistRuleResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::WhitelistlistRuleResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + field == o.field && + value == o.value && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, field, value, description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/operations/create.rb b/lib/conekta/operations/create.rb deleted file mode 100644 index e1b52ba..0000000 --- a/lib/conekta/operations/create.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Conekta - module Operations - module Create - module ClassMethods - def create(params) - _url = Util.types[self.class_name.downcase]._url - response = Requestor.new.request(:post, _url, params) - instance = self.new - instance.load_from(response) - instance - end - end - def self.included(base) - base.extend(ClassMethods) - end - end - end -end diff --git a/lib/conekta/operations/create_member.rb b/lib/conekta/operations/create_member.rb deleted file mode 100644 index e58a9e5..0000000 --- a/lib/conekta/operations/create_member.rb +++ /dev/null @@ -1,40 +0,0 @@ -module Conekta - module Operations - module CreateMember - def create_member(member, params) - _url = [self._url, member].join('/') - member = member.to_sym - response = Requestor.new.request(:post, _url, params) - - if self.send(member) && - (self.send(member).class.class_name == "ConektaObject" || - self.send(member).class.class_name == "List") - arr = [] - - if self.send(member).class.class_name == "List" - self.send(member).add_element(response) - else - self.method(member).call.values.each do |_,v| - arr << v.to_hash - end - - arr << response - self.send(member).load_from(arr) - self.load_from - end - - instances = self.send(member) - instance = instances.last - else - instance = Util.types[member.to_s].new() - instance.load_from(response) - self.create_attr(member.to_s, instance) - self.set_val(member.to_sym, instance) - self.load_from - end - - instance - end - end - end -end \ No newline at end of file diff --git a/lib/conekta/operations/custom_action.rb b/lib/conekta/operations/custom_action.rb deleted file mode 100644 index 4f0962e..0000000 --- a/lib/conekta/operations/custom_action.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Conekta - module Operations - module CustomAction - def custom_action(method, action=nil, params=nil) - _url = action ? [self._url, action].join('/') : self._url - response = Requestor.new.request(method, _url, params) - - self.load_from(response) - self - end - end - end -end diff --git a/lib/conekta/operations/delete.rb b/lib/conekta/operations/delete.rb deleted file mode 100644 index f4c286d..0000000 --- a/lib/conekta/operations/delete.rb +++ /dev/null @@ -1,45 +0,0 @@ -module Conekta - module Operations - module Delete - def delete - self.custom_action(:delete, nil, nil) - self - end - def delete_member(parent, member) - self.custom_action(:delete, nil, nil) - - parent = parent.to_sym - member = member.to_sym - obj = self.method(parent).call.method(member).call - - if obj.class.class_name == "ConektaObject" - self.method(parent).call.method(member).call.each do |(k, v)| - if v.id == self.id - self.method(parent).call.method(member).call[k] = nil - # Shift hash array - shift = false - self.method(parent).call.method(member).call.each_with_index do |v,i| - if shift - self.method(parent).call.method(member).call.set_val(i-1,v[1]) - self.method(parent).call.method(member).call[i-1] = v[1] - end - if v[1] == nil - shift = true - end - end - n_members = self.method(parent).call.method(member).call.count - last_index = n_members - 1 - # Remove last member because the hash array was shifted - self.method(parent).call.method(member).call.unset_key(last_index) - self.method(parent).call.method(member).call.delete(last_index) - break - end - end - else - self.create_attr(member.to_s, nil) - end - self - end - end - end -end diff --git a/lib/conekta/operations/find.rb b/lib/conekta/operations/find.rb deleted file mode 100644 index e01aed9..0000000 --- a/lib/conekta/operations/find.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Conekta - module Operations - module Find - module ClassMethods - def find(id) - instance = self.new(id) - response = Requestor.new.request(:get, instance._url) - instance.load_from(response) - instance - end - - # DEPRECATED: Please use find instead. - alias_method :retrieve, :find - end - def self.included(base) - base.extend(ClassMethods) - end - end - end -end diff --git a/lib/conekta/operations/update.rb b/lib/conekta/operations/update.rb deleted file mode 100644 index 0e55a38..0000000 --- a/lib/conekta/operations/update.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Conekta - module Operations - module Update - def update(params) - response = Requestor.new.request(:put, self._url, params) - self.load_from(response) - self - end - end - end -end diff --git a/lib/conekta/operations/where.rb b/lib/conekta/operations/where.rb deleted file mode 100644 index d5623e9..0000000 --- a/lib/conekta/operations/where.rb +++ /dev/null @@ -1,30 +0,0 @@ -module Conekta - module Operations - module Where - - def self.handle_type_of_paging(response, class_name, params) - if response.kind_of?(Hash) && response["object"] == "list" - List.new(class_name, params) - else - ConektaObject.new - end - end - - module ClassMethods - def where(params=nil) - _url = Util.types[self.class_name.downcase]._url - response = Requestor.new.request(:get, _url, params) - instance = ::Conekta::Operations::Where.handle_type_of_paging(response, self.class_name, params) - instance.load_from(response) - instance - end - - # DEPRECATED: Please use where instead. - alias_method :all, :where - end - def self.included(base) - base.extend(ClassMethods) - end - end - end -end \ No newline at end of file diff --git a/lib/conekta/order.rb b/lib/conekta/order.rb deleted file mode 100644 index 3079d9f..0000000 --- a/lib/conekta/order.rb +++ /dev/null @@ -1,86 +0,0 @@ -module Conekta - class Order < Resource - include Conekta::Operations::Find - include Conekta::Operations::Where - include Conekta::Operations::Create - include Conekta::Operations::Update - include Conekta::Operations::CreateMember - include Conekta::Operations::CustomAction - - attr_accessor :livemode, :amount, :payment_status, :customer_id, :currency, - :metadata, :created_at, :updated_at, :tax_lines, :line_items, - :shipping_lines, :discount_lines, :shipping_contact, :charges, - :checkout - - def initialize(id = nil) - @id = id - @line_items ||= List.new("LineItem", {}) - @tax_lines ||= List.new("TaxLine", {}) - @shipping_lines ||= List.new("ShippingLine", {}) - @discount_lines ||= List.new("DiscountLine", {}) - @charges ||= List.new("Charge", {}) - super(id) - end - - def load_from(response = nil) - if response - super - end - - order = self - submodels = [:line_items, :tax_lines, :shipping_lines, :discount_lines, - :charges] - create_submodels_lists(order, submodels) - end - - #Attribute accessors - def create_line_item(params) - self.create_member_with_relation("line_items", params, self) - end - - def create_tax_line(params) - self.create_member_with_relation("tax_lines", params, self) - end - - def create_shipping_line(params) - self.create_member_with_relation("shipping_lines", params, self) - end - - def create_discount_line(params) - self.create_member_with_relation("discount_lines", params, self) - end - - def create_charge(params) - self.create_member("charges", params) - end - - def create_shipping_contact(params) - self.update(shipping_contact: params).shipping_contact - end - - #State transitions - def authorize_capture(params = {}) - custom_action(:post, "capture", params) - end - - def void(params = {}) - custom_action(:post, "void", params) - end - - def refund(params = {}) - custom_action(:post, "refund", params) - end - - private - - def create_submodels_lists(order, submodels) - submodels.each do |submodel| - self.send(submodel).each do |k, v| - v.create_attr("order", order) - - self.send(submodel).set_val(k, v) - end if self.respond_to?(submodel) && !self.send(submodel).nil? - end - end - end -end diff --git a/lib/conekta/payee.rb b/lib/conekta/payee.rb deleted file mode 100644 index 5b71e79..0000000 --- a/lib/conekta/payee.rb +++ /dev/null @@ -1,66 +0,0 @@ -module Conekta - class Payee < Resource - include Conekta::Operations::Find - include Conekta::Operations::Where - include Conekta::Operations::Create - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - include Conekta::Operations::CreateMember - - attr_accessor :email, :name, :phone, :livemode, :default_destination_id, - :created_at - - def load_from(response=nil) - if response - super - end - payee = self - if Conekta.api_version <= "1.0.0" - self.payout_methods.each do |k,v| - if !v.respond_to? :deleted || !v.deleted - v.create_attr('payee', payee) - self.payout_methods.set_val(k,v) - end - end - else - self.destinations.each do |k,v| - if !v.respond_to? :deleted || !v.deleted - v.create_attr('payee', payee) - self.destinations.set_val(k,v) - end - end - end - end - - def create_payout_method(params) - raise_version_error("1.0.0") if Conekta.api_version > "1.0.0" - self.create_member('payout_methods', params) - end - - def create_destination(params) - raise_version_error("2.0.0") if Conekta.api_version <= "1.0.0" - self.create_member('destinations', params) - end - - private - def raise_version_error(version) - exception = Error.error_handler({ - "details" => [{ - "debug_message" => I18n.translate( - 'error.conflict.version.unspecified', - { resource: self.class.class_name, locale: :en } - ), - "message" => I18n.translate( - 'error.conflict.version.unspecified_purchaser', - { locale: Conekta.locale.to_sym } - ), - "param" => nil, - "code" => "error.conflict.version.unspecified" - }] - }, 409) - - raise exception - end - end -end diff --git a/lib/conekta/payment_method.rb b/lib/conekta/payment_method.rb deleted file mode 100644 index 4b80d77..0000000 --- a/lib/conekta/payment_method.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Conekta - class PaymentMethod < Resource - end -end diff --git a/lib/conekta/payment_source.rb b/lib/conekta/payment_source.rb deleted file mode 100644 index 2fdf3e7..0000000 --- a/lib/conekta/payment_source.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Conekta - class PaymentSource < Resource - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - def _url - ensure_id - - self.customer._url + self.class._url + "/" + id - end - - def delete - self.delete_member('customer', 'payment_sources') - end - end -end diff --git a/lib/conekta/payout.rb b/lib/conekta/payout.rb deleted file mode 100644 index 0553b89..0000000 --- a/lib/conekta/payout.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Conekta - class Payout < Resource - include Conekta::Operations::Find - include Conekta::Operations::Where - include Conekta::Operations::Create - end -end diff --git a/lib/conekta/payout_method.rb b/lib/conekta/payout_method.rb deleted file mode 100644 index adbc434..0000000 --- a/lib/conekta/payout_method.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Conekta - class PayoutMethod < Resource - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - def _url - ensure_id - - self.payee._url + self.class._url + "/" + id - end - - def delete - self.delete_member('payee','payout_methods') - end - end -end diff --git a/lib/conekta/plan.rb b/lib/conekta/plan.rb deleted file mode 100644 index 1c75c82..0000000 --- a/lib/conekta/plan.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Conekta - class Plan < Resource - include Conekta::Operations::Find - include Conekta::Operations::Where - include Conekta::Operations::Create - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - include Conekta::Operations::CreateMember - - attr_accessor :livemode, :created_at, :name, :amount, :currency, - :interval, :frequency, :expiry_count, :trial_period_days, - :created_at - - end -end diff --git a/lib/conekta/refund.rb b/lib/conekta/refund.rb deleted file mode 100644 index 999ff04..0000000 --- a/lib/conekta/refund.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Conekta - class Refund < Resource - - attr_accessor :amount, :auth_code, :created_at - end -end diff --git a/lib/conekta/requestor.rb b/lib/conekta/requestor.rb deleted file mode 100644 index 2dce386..0000000 --- a/lib/conekta/requestor.rb +++ /dev/null @@ -1,76 +0,0 @@ -require 'faraday' -require 'base64' - -module Conekta - class Requestor - require 'sys/uname' - include Sys - - attr_reader :api_key - - def initialize - @api_key = Conekta.api_key - end - - def api_url(_url='') - api_base = Conekta.api_base - api_base + _url - end - - def request(meth, _url, params = nil) - _url = self.api_url(_url) - meth = meth.downcase - - begin - connection = build_connection(_url, params) - response = connection.method(meth).call do |req| - (if meth == :get then req.params = params else req.body = params.to_json end) if params - end - rescue Exception => e - raise Error.error_handler({}, nil) - end - - json_response = JSON.parse(response.body) - raise Error.error_handler(json_response, response.status) if response.status != 200 - json_response - end - - private - - def build_connection(_url, params = nil) - connection = Faraday.new( - :url => _url, - :ssl => { :ca_file=> File.dirname(__FILE__) + '/../ssl_data/ca_bundle.crt'} - ) do |faraday| - faraday.adapter Faraday.default_adapter - end - - set_headers_for(connection) - return connection - end - - def set_headers_for(connection) - connection.headers['Content-Type'] = 'application/json' - connection.headers['X-Conekta-Client-User-Agent'] = conekta_headers.to_json - connection.headers['User-Agent'] = 'Conekta/v1 RubyBindings/' + Conekta::VERSION - connection.headers['Accept'] = "application/vnd.conekta-v#{Conekta.api_version}+json" - connection.headers['Accept-Language'] = Conekta.locale.to_s - connection.headers['Authorization'] = "Basic #{ Base64.strict_encode64("#{self.api_key}" + ':')}" - return connection - end - - def conekta_headers - params = { - bindings_version: Conekta::VERSION, - lang: 'ruby', - lang_version: RUBY_VERSION, - publisher: 'conekta', - uname: Uname.uname - } - - params.merge!(plugin: Conekta.plugin) if Conekta.plugin.to_s.length > 0 - - @conekta_headers ||= params - end - end -end diff --git a/lib/conekta/resource.rb b/lib/conekta/resource.rb deleted file mode 100644 index 0b1dafa..0000000 --- a/lib/conekta/resource.rb +++ /dev/null @@ -1,55 +0,0 @@ -module Conekta - class Resource < ConektaObject - - attr_accessor :id - - def initialize(id=nil) - @id = id - super() - end - - def self._url() - "/#{CGI.escape(underscored_class)}s" - end - - def _url - ensure_id - - return [self.class._url, id].join('/') - end - - def self.underscored_class - Conekta::Util.underscore(self.to_s) - end - - def create_member_with_relation(member, params, parent) - parent_klass = parent.class.underscored_class - child = self.create_member(member, params) - child.create_attr(parent_klass.to_s, parent) - return child - end - - private - def ensure_id - if (id.nil? || id.to_s.empty?) - exception = Error.error_handler({ - "details" => [{ - "debug_message" => I18n.translate( - 'error.resource.id', - locale: :en, - resource: self.class.class_name - ), - "message" => I18n.translate( - 'error.resource.id_purchaser', - locale: Conekta.locale.to_sym - ), - "param" => "id", - "code" => "error.resource.id" - }] - }, -2) - - raise exception - end - end - end -end diff --git a/lib/conekta/return.rb b/lib/conekta/return.rb deleted file mode 100644 index 07d242d..0000000 --- a/lib/conekta/return.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Conekta - class Return < Resource - - attr_accessor :livemode, :amount, :currency, :charge_id, :reason, - :created_at, :parent_id - def _url - ensure_id - - "#{self.order._url}#{self.class._url}/#{id}" - end - end -end diff --git a/lib/conekta/shipping_contact.rb b/lib/conekta/shipping_contact.rb deleted file mode 100644 index eff6c43..0000000 --- a/lib/conekta/shipping_contact.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Conekta - class ShippingContact < Resource - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - attr_accessor :receiver, :phone, :between_streets, :parent_id, :default - - def _url - ensure_id - - self.customer._url + self.class._url + "/" + id - end - - def delete - self.delete_member('customer', 'shipping_contacts') - end - end -end diff --git a/lib/conekta/shipping_line.rb b/lib/conekta/shipping_line.rb deleted file mode 100644 index 2795dde..0000000 --- a/lib/conekta/shipping_line.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Conekta - class ShippingLine < Resource - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - attr_accessor :description, :amount, :carrier, :shipping_line_method, :tracking_number, - :parent_id, :metadata - - def _url - ensure_id - - "#{self.order._url}#{self.class._url}/#{id}" - end - - def delete - self.delete_member('order', 'shipping_lines') - end - end -end diff --git a/lib/conekta/subscription.rb b/lib/conekta/subscription.rb deleted file mode 100644 index 1b1047d..0000000 --- a/lib/conekta/subscription.rb +++ /dev/null @@ -1,25 +0,0 @@ -module Conekta - class Subscription < Resource - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - attr_accessor :created_at, :subscription_start, :canceled_at, :paused_at, - :billing_cycle_start, :billing_cycle_end, :trial_start, - :trial_end, :plan_id, :customer_id, :card_id - - def _url - ensure_id - - self.customer._url + "/subscription" - end - def pause - custom_action(:post, 'pause') - end - def resume - custom_action(:post, 'resume') - end - def cancel - custom_action(:post, 'cancel') - end - end -end diff --git a/lib/conekta/tax_line.rb b/lib/conekta/tax_line.rb deleted file mode 100644 index 951c13e..0000000 --- a/lib/conekta/tax_line.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Conekta - class TaxLine < Resource - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - attr_accessor :description, :amount, :parent_id, :metadata - - def _url - ensure_id - - "#{self.order._url}#{self.class._url}/#{id}" - end - - def delete - self.delete_member('order', 'tax_lines') - end - end -end diff --git a/lib/conekta/token.rb b/lib/conekta/token.rb deleted file mode 100644 index 8e4661a..0000000 --- a/lib/conekta/token.rb +++ /dev/null @@ -1,8 +0,0 @@ -module Conekta - class Token < Resource - include Conekta::Operations::Find - include Conekta::Operations::Create - - attr_accessor :livemode, :used - end -end diff --git a/lib/conekta/transfer.rb b/lib/conekta/transfer.rb deleted file mode 100644 index e7f5142..0000000 --- a/lib/conekta/transfer.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Conekta - class Transfer < Resource - include Conekta::Operations::Find - include Conekta::Operations::Where - include Conekta::Operations::Create - end -end diff --git a/lib/conekta/util.rb b/lib/conekta/util.rb deleted file mode 100644 index 077f2c7..0000000 --- a/lib/conekta/util.rb +++ /dev/null @@ -1,137 +0,0 @@ -module Conekta - module Util - - def self.types - @types ||= { - 'customer_info' => ::Conekta::CustomerInfo, - 'details' => ::Conekta::Details, - 'bank_transfer_payment' => ::Conekta::PaymentMethod, - 'bank_transfer_payout_method' => ::Conekta::Method, - 'card' => ::Conekta::Card, - 'card_payment' => ::Conekta::PaymentMethod, - 'cash_payment' => ::Conekta::PaymentMethod, - 'charge' => ::Conekta::Charge, - 'checkout' => ::Conekta::Checkout, - 'customer' => ::Conekta::Customer, - 'event' => ::Conekta::Event, - 'log' => ::Conekta::Log, - 'payee' => ::Conekta::Payee, - 'payout' => ::Conekta::Payout, - 'payout_method' => ::Conekta::PayoutMethod, - 'destination' => ::Conekta::Destination, - 'plan' => ::Conekta::Plan, - 'subscription' => ::Conekta::Subscription, - 'token' => ::Conekta::Token, - 'webhook' => ::Conekta::Webhook, - 'webhook_log' => ::Conekta::WebhookLog, - 'refund' => ::Conekta::Refund, - 'line_item' => ::Conekta::LineItem, - 'address' => ::Conekta::Address, - 'billing_address' => ::Conekta::Address, - 'shipping_address' => ::Conekta::Address, - 'order' => ::Conekta::Order, - 'payment_source' => ::Conekta::PaymentSource, - 'tax_line' => ::Conekta::TaxLine, - 'shipping_line' => ::Conekta::ShippingLine, - 'discount_line' => ::Conekta::DiscountLine, - 'shipping_contact' => ::Conekta::ShippingContact, - 'transfer' => ::Conekta::Transfer, - 'list' => ::Conekta::List - } - end - - def self.convert_to_conekta_object(name,resp) - # these json strings should not be parsed into objects - return resp if ["data", "request_body", "request_headers", "response_headers", "response_body", "query_string", "metadata", "antifraud_info"].include?(name) - if resp.kind_of?(Hash) - if resp.has_key?('object') and types[resp['object']] - if resp['object'] == "list" - instance = types[resp['object']].new(name, resp) - else - instance = types[resp['object']].new() - end - - instance.load_from(resp) - - return instance - elsif name.instance_of? String - name = "shippin_line_method" if name == "method" - name = "event_data" if camelize(name) == "Data" - name = "obj" if camelize(name) == "Object" - if !Object.const_defined?(camelize(name)) - instance = Object.const_set(camelize(name), Class.new(ConektaObject)).new - else - begin - instance = constantize("Conekta::"+camelize(name)).new - rescue # Class is not defined - instance = constantize(camelize(name)).new - end - end - - instance.load_from(resp) - - return instance - end - end - - if resp.kind_of?(Array) - instance = ConektaObject.new - instance.load_from(resp) - if !resp.empty? and resp.first.instance_of? Hash and !resp.first["object"] - resp.each_with_index do |r, i| - obj = convert_to_conekta_object(name,r) - instance.set_val(i,obj) - instance[i] = obj - end - end - return instance - end - return instance - end - - def self.underscore(str) - str.split(/::/).last. - gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). - gsub(/([a-z\d])([A-Z])/,'\1_\2'). - tr("-", "_"). - downcase - end - - protected - - def self.camelize(str) - str.split('_').map{|e| e.capitalize}.join - end - - def self.constantize(camel_cased_word) - names = camel_cased_word.split('::') - - # Trigger a builtin NameError exception including the ill-formed constant in the message. - Object.const_get(camel_cased_word) if names.empty? - - # Remove the first blank element in case of '::ClassName' notation. - names.shift if names.size > 1 && names.first.empty? - - names.inject(Object) do |constant, name| - if constant == Object - constant.const_get(name) - else - candidate = constant.const_get(name) - next candidate if constant.const_defined?(name, false) - next candidate unless Object.const_defined?(name) - - # Go down the ancestors to check it it's owned - # directly before we reach Object or the end of ancestors. - constant = constant.ancestors.inject do |const, ancestor| - break const if ancestor == Object - break ancestor if ancestor.const_defined?(name, false) - const - end - - # owner is in Object, so raise - constant.const_get(name, false) - end - end - end - end -end diff --git a/lib/conekta/version.rb b/lib/conekta/version.rb index 9f75ef4..2a785ec 100644 --- a/lib/conekta/version.rb +++ b/lib/conekta/version.rb @@ -1,3 +1,15 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + module Conekta - VERSION = '2.6.0'.freeze + VERSION = '6.0.0' end diff --git a/lib/conekta/webhook.rb b/lib/conekta/webhook.rb deleted file mode 100644 index 3027251..0000000 --- a/lib/conekta/webhook.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Conekta - class Webhook < Resource - include Conekta::Operations::Find - include Conekta::Operations::Where - include Conekta::Operations::Create - include Conekta::Operations::Delete - include Conekta::Operations::Update - include Conekta::Operations::CustomAction - - attr_accessor :url, :status, :production_enabled, :development_enabled, :subscribed_events - end -end diff --git a/lib/conekta/webhook_log.rb b/lib/conekta/webhook_log.rb deleted file mode 100644 index e9a5635..0000000 --- a/lib/conekta/webhook_log.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Conekta - class WebhookLog < Resource - end -end diff --git a/lib/ssl_data/ca_bundle.crt b/lib/ssl_data/ca_bundle.crt index 8f1357b..9fed496 100644 --- a/lib/ssl_data/ca_bundle.crt +++ b/lib/ssl_data/ca_bundle.crt @@ -3953,3 +3953,87 @@ lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= -----END CERTIFICATE----- +================================================================ +Not Before:Jun 14 12:00:00 2016 +Not After: Jul 10 12:00:00 2019 + +-----BEGIN CERTIFICATE----- +MIIFZDCCBEygAwIBAgIQDYuMx20S3boz9J9cZ55iPDANBgkqhkiG9w0BAQsFADBN +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E +aWdpQ2VydCBTSEEyIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTYwNjE1MDAwMDAwWhcN +MTkwNzEwMTIwMDAwWjCBqzELMAkGA1UEBhMCTVgxKjAoBgNVBAgTIUNpdWRhZCBE +ZSBNZXhpY28gRGlzdHJpdG8gRmVkZXJhbDETMBEGA1UEBwwKSGlww7Nkcm9tbzEh +MB8GA1UEChMYR3J1cG8gQ29uZWt0YW1lIFNBIGRlIENWMSEwHwYDVQQLExhHUlVQ +TyBDT05FS1RBTUUgU0EgREUgQ1YxFTATBgNVBAMMDCouY29uZWt0YS5pbzCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKVJVBd2Bg5j1QU0cvdDVotQ7/xC +SMXY8tZKy4hxBgqIlGVh9r3gMixl6yzMBRjF0FbJFmNRbQmAaiJTXP8CmGGfR19V +IdYaXeverMRNkd4U9R1S79xQEfdtX0N9eRtDTwvwOrUxZTRlBLphY54HaFgNzTNZ +g4H/xXDv/d6e3z0dpf7QCUPcz0AOLVNRSShc0KMsiR3dIutMXIbryNtOseltkEbN +GOphu1bLJWJrDbEigLWddhb1CbUFCiIX1cjWW0KvoB+PHAkFSlvLrf/b68NQGrZq +5M0hI49Vn3EBYkvCunTPs62aqQmSw2g6HMDZ0m6MQ+3RfqiKuOZItjV2v4sCAwEA +AaOCAd8wggHbMB8GA1UdIwQYMBaAFA+AYRyCMWHVLyjnjUY4tCzhxtniMB0GA1Ud +DgQWBBSNnVHYzecnBaulfXvcUQ2cc5cmQDAjBgNVHREEHDAaggwqLmNvbmVrdGEu +aW+CCmNvbmVrdGEuaW8wDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUF +BwMBBggrBgEFBQcDAjBrBgNVHR8EZDBiMC+gLaArhilodHRwOi8vY3JsMy5kaWdp +Y2VydC5jb20vc3NjYS1zaGEyLWc1LmNybDAvoC2gK4YpaHR0cDovL2NybDQuZGln +aWNlcnQuY29tL3NzY2Etc2hhMi1nNS5jcmwwTAYDVR0gBEUwQzA3BglghkgBhv1s +AQEwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAI +BgZngQwBAgIwfAYIKwYBBQUHAQEEcDBuMCQGCCsGAQUFBzABhhhodHRwOi8vb2Nz +cC5kaWdpY2VydC5jb20wRgYIKwYBBQUHMAKGOmh0dHA6Ly9jYWNlcnRzLmRpZ2lj +ZXJ0LmNvbS9EaWdpQ2VydFNIQTJTZWN1cmVTZXJ2ZXJDQS5jcnQwDAYDVR0TAQH/ +BAIwADANBgkqhkiG9w0BAQsFAAOCAQEAYQdiXxovr+/IBCsJ9THPFzW8rUeGIIvz +I7lztIou0eNDi5Isr6dFgfsH7ZyDT/hQ72bd4F6ZOEHujin27HWksoNXkWrt6Nxo +UNbcCR99xRJwKLedTP4NDQmdaqyoFD30dUuOjbzXKV9eCsMQvCK7M4t/LP2WGsV4 +DKR0l4C93RD5nLF7ZnMFk5xp9O4oBmt6v9iLyXDOyysXU1luiuBdENNpQfpaYY/G +avazKHGKGp9WxFyKwhOyicTSwOmkk9n6yGpLCB3uVEpjyA15dG/hyo/VidwEXRKE +vnCGJh+Jh+9OJYby+6R8SJ1MAONL1ea723z6BuwiFzcFS3qJuxbKDQ== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIElDCCA3ygAwIBAgIQAf2j627KdciIQ4tyS8+8kTANBgkqhkiG9w0BAQsFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD +QTAeFw0xMzAzMDgxMjAwMDBaFw0yMzAzMDgxMjAwMDBaME0xCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxJzAlBgNVBAMTHkRpZ2lDZXJ0IFNIQTIg +U2VjdXJlIFNlcnZlciBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ANyuWJBNwcQwFZA1W248ghX1LFy949v/cUP6ZCWA1O4Yok3wZtAKc24RmDYXZK83 +nf36QYSvx6+M/hpzTc8zl5CilodTgyu5pnVILR1WN3vaMTIa16yrBvSqXUu3R0bd +KpPDkC55gIDvEwRqFDu1m5K+wgdlTvza/P96rtxcflUxDOg5B6TXvi/TC2rSsd9f +/ld0Uzs1gN2ujkSYs58O09rg1/RrKatEp0tYhG2SS4HD2nOLEpdIkARFdRrdNzGX +kujNVA075ME/OV4uuPNcfhCOhkEAjUVmR7ChZc6gqikJTvOX6+guqw9ypzAO+sf0 +/RR3w6RbKFfCs/mC/bdFWJsCAwEAAaOCAVowggFWMBIGA1UdEwEB/wQIMAYBAf8C +AQAwDgYDVR0PAQH/BAQDAgGGMDQGCCsGAQUFBwEBBCgwJjAkBggrBgEFBQcwAYYY +aHR0cDovL29jc3AuZGlnaWNlcnQuY29tMHsGA1UdHwR0MHIwN6A1oDOGMWh0dHA6 +Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbFJvb3RDQS5jcmwwN6A1 +oDOGMWh0dHA6Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbFJvb3RD +QS5jcmwwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8v +d3d3LmRpZ2ljZXJ0LmNvbS9DUFMwHQYDVR0OBBYEFA+AYRyCMWHVLyjnjUY4tCzh +xtniMB8GA1UdIwQYMBaAFAPeUDVW0Uy7ZvCj4hsbw5eyPdFVMA0GCSqGSIb3DQEB +CwUAA4IBAQAjPt9L0jFCpbZ+QlwaRMxp0Wi0XUvgBCFsS+JtzLHgl4+mUwnNqipl +5TlPHoOlblyYoiQm5vuh7ZPHLgLGTUq/sELfeNqzqPlt/yGFUzZgTHbO7Djc1lGA +8MXW5dRNJ2Srm8c+cftIl7gzbckTB+6WohsYFfZcTEDts8Ls/3HB40f/1LkAtDdC +2iDJ6m6K7hQGrn2iWZiIqBtvLfTyyRRfJs8sjX7tN8Cp1Tm5gr8ZDOo0rwAhaPit +c+LJMto4JQtV05od8GiG7S5BNO98pVAdvzr508EIDObtHopYJeS4d60tbvVS3bR0 +j6tJLp07kzQoH3jOlOrHvdPJbRzeXDLz +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD +QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB +CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 +nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt +43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P +T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 +gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR +TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw +DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr +hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg +06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF +PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls +YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/locales/en.yml b/locales/en.yml deleted file mode 100644 index f068502..0000000 --- a/locales/en.yml +++ /dev/null @@ -1,9 +0,0 @@ -# encoding: UTF-8 -en: - error: - resource: - id: 'Could not get the id of %{resource} instance.' - id_purchaser : 'There was an error. Please contact system administrator.' - requestor: - connection: 'Could not connect to %{base}.' - connection_purchaser: 'Could not connect to payment system.' diff --git a/locales/es.yml b/locales/es.yml deleted file mode 100644 index 21318a6..0000000 --- a/locales/es.yml +++ /dev/null @@ -1,10 +0,0 @@ -# encoding: UTF-8 -es: - error: - resource: - id: 'No se pudo obtener el id de la instancia de %{resource}.' - id_purchaser: 'Hubo un error. Favor de contactar al administrador del sistema.' - requestor: - connection: 'No se pudo conectar a %{base}.' - connection_purchaser: 'No se pudo conectar al sistema de pagos.' - diff --git a/readme_files/banner.png b/readme_files/banner.png deleted file mode 100644 index 762a392..0000000 Binary files a/readme_files/banner.png and /dev/null differ diff --git a/readme_files/conekta-badge.png b/readme_files/conekta-badge.png deleted file mode 100644 index 25cda85..0000000 Binary files a/readme_files/conekta-badge.png and /dev/null differ diff --git a/readme_files/ruby-badge.png b/readme_files/ruby-badge.png deleted file mode 100644 index 53953c1..0000000 Binary files a/readme_files/ruby-badge.png and /dev/null differ diff --git a/spec/api/antifraud_api_spec.rb b/spec/api/antifraud_api_spec.rb new file mode 100644 index 0000000..d0dec87 --- /dev/null +++ b/spec/api/antifraud_api_spec.rb @@ -0,0 +1,166 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require_relative 'base_test' +require 'json' + +# Unit tests for Conekta::AntifraudApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'AntifraudApi' do + before do + # run before each test + Conekta.configure do |config| + config.host = BaseTest.host + config.access_token = 'key_xxxxxx' + config.scheme = BaseTest.scheme + end + @api_instance = Conekta::AntifraudApi.new + end + + after do + # run after each test + end + + describe 'test an instance of AntifraudApi' do + it 'should create an instance of AntifraudApi' do + expect(@api_instance).to be_instance_of(Conekta::AntifraudApi) + end + end + + # unit tests for create_rule_blacklist + # Create blacklisted rule + # @param create_risk_rules_data requested field for blacklist rule + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [BlacklistRuleResponse] + describe 'create_rule_blacklist test' do + it 'should work' do + + create_risk_rules_data = Conekta::CreateRiskRulesData.new( + { + description: 'test description', + field: 'email', + value: 'fcarrero_black@gmail.com' + } + ) + + response = @api_instance.create_rule_blacklist(create_risk_rules_data) + + expect(response).not_to be_nil + expect(response).to be_instance_of(Conekta::BlacklistRuleResponse) + expect(response.value).to eq(create_risk_rules_data.value) + end + end + + # unit tests for create_rule_whitelist + # Create whitelisted rule + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [CreateRiskRulesData] :create_risk_rules_data + # @return [WhitelistlistRuleResponse] + describe 'create_rule_whitelist test' do + it 'should work' do + create_risk_rules_data = Conekta::CreateRiskRulesData.new( + { + description: 'test description', + field: 'email', + value: 'fcarrero@gmail.com' + } + ) + + response = @api_instance.create_rule_whitelist({accept_language: 'es', create_risk_rules_data: create_risk_rules_data}) + + expect(response).not_to be_nil + expect(response).to be_instance_of(Conekta::WhitelistlistRuleResponse) + expect(response.value).to eq(create_risk_rules_data.value) + expect(response.id).to eq('618c3f30db8b8da9be376b17') + expect(response.field).to eq(create_risk_rules_data.field) + expect(response.description).to eq(create_risk_rules_data.description) + + end + end + + # unit tests for delete_rule_blacklist + # Delete blacklisted rule + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DeletedBlacklistRuleResponse] + describe 'delete_rule_blacklist test' do + it 'should work' do + id = '618c3f30db8b8da9be376b1e' + + response = @api_instance.delete_rule_blacklist(id) + + expect(response).to be_instance_of(Conekta::DeletedBlacklistRuleResponse) + expect(response.id).to eq(id) + end + end + + # unit tests for delete_rule_whitelist + # Delete whitelisted rule + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DeletedWhitelistRuleResponse] + describe 'delete_rule_whitelist test' do + it 'should work' do + id = '618c3f2fdb8b8da9be376afe' + + response = @api_instance.delete_rule_whitelist(id) + + expect(response).to be_instance_of(Conekta::DeletedWhitelistRuleResponse) + expect(response.id).to eq(id) + end + end + + # unit tests for get_rule_blacklist + # Get list of blacklisted rules + # Return all rules + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [RiskRulesList] + describe 'get_rule_blacklist test' do + it 'should work' do + response = @api_instance.get_rule_blacklist + + expect(response).to be_instance_of(Conekta::RiskRulesList) + expect(response.data.length).to eq(25) + expect(response.has_more).to be_truthy + expect(response.data).to be_instance_of(Array) + expect(response.data.first.field).to eq('email') + end + end + + # unit tests for get_rule_whitelist + # Get a list of whitelisted rules + # Return all rules + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [RiskRulesList] + describe 'get_rule_whitelist test' do + it 'should work' do + response = @api_instance.get_rule_whitelist + + expect(response).to be_instance_of(Conekta::RiskRulesList) + expect(response.data.length).to eq(25) + expect(response.has_more).to be_truthy + expect(response.data).to be_instance_of(Array) + expect(response.data.first.field).to eq('email') + end + end + +end diff --git a/spec/api/api_keys_api_spec.rb b/spec/api/api_keys_api_spec.rb new file mode 100644 index 0000000..06c83e4 --- /dev/null +++ b/spec/api/api_keys_api_spec.rb @@ -0,0 +1,151 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require_relative 'base_test' +require 'json' + +# Unit tests for Conekta::ApiKeysApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ApiKeysApi' do + before do + # run before each test + Conekta.configure do |config| + config.host = BaseTest.host + config.access_token = 'key_xxxxxx' + config.scheme = BaseTest.scheme + end + @api_instance = Conekta::ApiKeysApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ApiKeysApi' do + it 'should create an instance of ApiKeysApi' do + expect(@api_instance).to be_instance_of(Conekta::ApiKeysApi) + end + end + + # unit tests for create_api_key + # Create Api Key + # Create a api key + # @param api_key_request requested field for a api keys + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ApiKeyCreateResponse] + describe 'create_api_key test' do + it 'should work' do + api_key_request= Conekta::ApiKeyRequest.new( + { + description: 'test', + role: 'private' + } + ) + response = @api_instance.create_api_key(api_key_request, accept_language: 'es') + + expect(response).to be_instance_of(Conekta::ApiKeyCreateResponse) + expect(response.id).to eq('64625cc9f3e02c00163f5e4d') + expect(response.authentication_token).to eq('key_rpHzxufNgjFCdprEEFZRTKi') + expect(response.object).to eq('api_key') + expect(response.role).to eq(api_key_request.role) + end + end + + # unit tests for delete_api_key + # Delete Api Key + # Deletes a api key that corresponds to a api key ID + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [DeleteApiKeysResponse] + describe 'delete_api_key test' do + it 'should work' do + id = '64625cc9f3e02c00163f5e4d' + + response = @api_instance.delete_api_key(id, accept_language: 'es') + + expect(response).to be_instance_of(Conekta::DeleteApiKeysResponse) + expect(response.deleted).to be_truthy + expect(response.id).to eq(id) + end + end + + # unit tests for get_api_key + # Get Api Key + # Gets a api key that corresponds to a api key ID + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ApiKeyResponse] + describe 'get_api_key test' do + it 'should work' do + id = '64625cc9f3e02c00163f5e4d' + + response = @api_instance.get_api_key(id, accept_language: 'es') + + expect(response).to be_instance_of(Conekta::ApiKeyResponse) + expect(response.id).to eq(id) + expect(response.object).to eq('api_key') + end + end + + # unit tests for get_api_keys + # Get list of Api Keys + # Consume the list of api keys you have + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @option opts [String] :search General search, e.g. by id, description, prefix + # @return [GetApiKeysResponse] + describe 'get_api_keys test' do + it 'should work' do + response = @api_instance.get_api_keys(accept_language: 'es', limit: 20) + + expect(response).to be_instance_of(Conekta::GetApiKeysResponse) + expect(response.has_more).to be_falsey + expect(response.data.length).to eq(1) + expect(response.data.first.id).to eq('64625cc9f3e02c00163f5e4d') + expect(response.data.first).to be_instance_of(Conekta::ApiKeyResponse) + end + end + + # unit tests for update_api_key + # Update Api Key + # Update an existing api key + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [ApiKeyUpdateRequest] :api_key_update_request + # @return [ApiKeyResponse] + describe 'update_api_key test' do + it 'should work' do + id = '64625cc9f3e02c00163f5e4d' + api_key_update_request = Conekta::ApiKeyUpdateRequest.new({ + description: 'online store' + }) + response = @api_instance.update_api_key(id,{accept_language: 'es', api_key_update_request: api_key_update_request } ) + + expect(response).to be_instance_of(Conekta::ApiKeyResponse) + expect(response.id).to eq(id) + expect(response.description).to eq(api_key_update_request.description) + end + end + +end diff --git a/spec/api/balances_api_spec.rb b/spec/api/balances_api_spec.rb new file mode 100644 index 0000000..5d66bd1 --- /dev/null +++ b/spec/api/balances_api_spec.rb @@ -0,0 +1,56 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require_relative 'base_test' +require 'json' + +# Unit tests for Conekta::BalancesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BalancesApi' do + before do + # run before each test + Conekta.configure do |config| + config.host = BaseTest.host + config.access_token = 'key_xxxxxx' + config.scheme = BaseTest.scheme + end + @api_instance = Conekta::BalancesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of BalancesApi' do + it 'should create an instance of BalancesApi' do + expect(@api_instance).to be_instance_of(Conekta::BalancesApi) + end + end + + # unit tests for get_balance + # Get a company's balance + # Get a company's balance + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [BalanceResponse] + describe 'get_balance test' do + it 'should work' do + response = @api_instance.get_balance({accept_language: 'es'}) + + expect(response).to be_instance_of(Conekta::BalanceResponse) + expect(response.available).to be_instance_of(Array) + end + end + +end diff --git a/spec/api/base_test.rb b/spec/api/base_test.rb new file mode 100644 index 0000000..aa343b3 --- /dev/null +++ b/spec/api/base_test.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true +class BaseTest + def self.host + ENV['BASE_PATH'] || 'http://localhost:3000' + end + def self.scheme + 'http' + end +end diff --git a/spec/api/charges_api_spec.rb b/spec/api/charges_api_spec.rb new file mode 100644 index 0000000..af7ea0d --- /dev/null +++ b/spec/api/charges_api_spec.rb @@ -0,0 +1,140 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require_relative 'base_test' +require 'json' + +# Unit tests for Conekta::ChargesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ChargesApi' do + before do + # run before each test + Conekta.configure do |config| + config.host = BaseTest.host + config.access_token = 'key_xxxxxx' + config.scheme = BaseTest.scheme + end + @api_instance = Conekta::ChargesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ChargesApi' do + it 'should create an instance of ChargesApi' do + expect(@api_instance).to be_instance_of(Conekta::ChargesApi) + end + end + + # unit tests for get_charges + # Get A List of Charges + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetChargesResponse] + describe 'get_charges test' do + it 'should work' do + response = @api_instance.get_charges({ limit: 20, accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::GetChargesResponse) + expect(response.has_more).to be_truthy + expect(response.data.length).to eq(20) + expect(response.data.first.channel.id).to eq('channel_2tqJMS7on7HBVqWKo') + expect(response.data.first.payment_method).to be_instance_of(Conekta::PaymentMethodCash) + expect(response.data.first.payment_method.reference).to eq('93003547316416') + expect(response.data.first.refunds).to be_nil + expect(response.data.first.reference_id).to be_falsey + end + end + + # unit tests for orders_create_charge + # Create charge + # Create charge for an existing orden + # @param id Identifier of the resource + # @param charge_request requested field for a charge + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ChargeOrderResponse] + describe 'orders_create_charge test' do + it 'card' do + id = 'ord_2tVKxbhNzfUnGjnXG' + charge_request = Conekta::ChargeRequest.new({ + amount: 40000, + payment_method: Conekta::ChargeRequestPaymentMethod.new({ + type: 'card', + token_id: 'tok_2tVKyGpobEKAR3xVH' + }) + }) + response = @api_instance.orders_create_charge(id, charge_request) + + expect(response).to be_instance_of(Conekta::ChargeOrderResponse) + expect(response.amount).to eq(charge_request.amount) + expect(response.object).to eq('charge') + expect(response.status).to eq('pre_authorized') + expect(response.payment_method).to be_instance_of(Conekta::PaymentMethodCard) + expect(response.payment_method.object).to eq('card_payment') + expect(response.payment_method.type).to eq('credit') + end + + it 'cash' do + id = "ord_2tVL8dT1Hm3y3YiaN" + charge_request = Conekta::ChargeRequest.new({ + amount: 40000, + payment_method: Conekta::ChargeRequestPaymentMethod.new({ + type: 'cash', + }) + }) + response = @api_instance.orders_create_charge(id,charge_request) + + expect(response).to be_instance_of(Conekta::ChargeOrderResponse) + expect(response.amount).to eq(charge_request.amount) + expect(response.object).to eq('charge') + expect(response.status).to eq('pending_payment') + expect(response.payment_method).to be_instance_of(Conekta::PaymentMethodCash) + expect(response.payment_method.object).to eq('cash_payment') + expect(response.payment_method.type).to eq('oxxo') + expect(response.payment_method.barcode_url).to be_truthy + expect(response.payment_method.cashier_id).to be_falsey + expect(response.payment_method.auth_code).to be_falsey + expect(response.payment_method.store).to be_falsey + end + it 'spei' do + id = "ord_2tVLUFrQBB4HKz1zj" + charge_request = Conekta::ChargeRequest.new({ + amount: 40000, + payment_method: Conekta::ChargeRequestPaymentMethod.new({ + type: 'spei', + }) + }) + response = @api_instance.orders_create_charge(id,charge_request) + + expect(response).to be_instance_of(Conekta::ChargeOrderResponse) + expect(response.amount).to eq(charge_request.amount) + expect(response.object).to eq('charge') + expect(response.status).to eq('pending_payment') + expect(response.payment_method).to be_instance_of(Conekta::PaymentMethodBankTransfer) + expect(response.payment_method.object).to eq('bank_transfer_payment') + expect(response.payment_method.type).to eq('spei') + expect(response.payment_method.clabe).to eq('646180111805035472') + expect(response.payment_method.bank).to eq('STP') + end + end + +end diff --git a/spec/api/companies_api_spec.rb b/spec/api/companies_api_spec.rb new file mode 100644 index 0000000..e9b4837 --- /dev/null +++ b/spec/api/companies_api_spec.rb @@ -0,0 +1,71 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::CompaniesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CompaniesApi' do + before do + @api_instance = Conekta::CompaniesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of CompaniesApi' do + it 'should create an instance of CompaniesApi' do + expect(@api_instance).to be_instance_of(Conekta::CompaniesApi) + end + end + + # unit tests for get_companies + # Get List of Companies + # Consume the list of child companies. This is used for holding companies with several child entities. + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetCompaniesResponse] + describe 'get_companies test' do + it 'should work' do + response = @api_instance.get_companies({accept_language: 'es', limit: 20}) + + expect(response).to be_instance_of(Conekta::GetCompaniesResponse) + expect(response.data.first).to be_instance_of(Conekta::CompanyResponse) + expect(response.data.length).to eq(1) + end + end + + # unit tests for get_company + # Get Company + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [CompanyResponse] + describe 'get_company test' do + it 'should work' do + id ='6441bb27659a060465da7335' + + response = @api_instance.get_company(id, {accept_language: 'es'}) + + expect(response).to be_instance_of(Conekta::CompanyResponse) + expect(response.id).to eq(id) + end + end + +end diff --git a/spec/api/customers_api_spec.rb b/spec/api/customers_api_spec.rb new file mode 100644 index 0000000..63062fb --- /dev/null +++ b/spec/api/customers_api_spec.rb @@ -0,0 +1,305 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' +# Unit tests for Conekta::CustomersApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CustomersApi' do + before do + # run before each test + @api_instance = Conekta::CustomersApi.new + end + + after do + # run after each test + end + + describe 'test an instance of CustomersApi' do + it 'should create an instance of CustomersApi' do + expect(@api_instance).to be_instance_of(Conekta::CustomersApi) + end + end + + # unit tests for create_customer + # Create customer + # The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer) + # @param customer requested field for customer + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerResponse] + describe 'create_customer test' do + it 'should work' do + + customer = full_customer + + response = @api_instance.create_customer(customer) + + expect(response).to be_instance_of(Conekta::CustomerResponse) + expect(response.id).to be_truthy + expect(response.custom_reference).to eq(customer.custom_reference) + expect(response.fiscal_entities.data.length).to eq(1) + expect(response.fiscal_entities.has_more).to be_falsey + expect(response.livemode).to be_truthy + end + end + + # unit tests for create_customer_fiscal_entities + # Create Fiscal Entity + # Create Fiscal entity resource that corresponds to a customer ID. + # @param id Identifier of the resource + # @param customer_fiscal_entities_request requested field for customer fiscal entities + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CreateCustomerFiscalEntitiesResponse] + describe 'create_customer_fiscal_entities test' do + it 'should work' do + id = "cus_2tXyF9BwPG14UMkkg" + request = Conekta::CustomerFiscalEntitiesRequest.new({ + address: Conekta::CustomerFiscalEntitiesRequestAddress.new({ + street1: "av siem", + city: "mexico", + country: "MX", + postal_code: "11000", + external_number: "11544" + }) + }) + + response = @api_instance.create_customer_fiscal_entities(id, request) + + expect(response).to be_instance_of(Conekta::CreateCustomerFiscalEntitiesResponse) + expect(response.address.country).not_to eq(request.address.country) + expect(response.parent_id).to eq(id) + expect(response.id).to be_truthy + end + end + + # unit tests for delete_customer_by_id + # Delete Customer + # Deleted a customer resource that corresponds to a customer ID. + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerResponse] + describe 'delete_customer_by_id test' do + it 'should work' do + id = "cus_2tXyF9BwPG14UMkkg" + + response = @api_instance.delete_customer_by_id(id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::CustomerResponse) + expect(response.id).to eq(id) + end + end + + # unit tests for get_customer_by_id + # Get Customer + # Gets a customer resource that corresponds to a customer ID. + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerResponse] + describe 'get_customer_by_id test' do + it 'card' do + id = "cus_2tXx8KUxw6311kEbs" + + response = @api_instance.get_customer_by_id(id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::CustomerResponse) + expect(response.id).to eq(id) + expect(response.payment_sources.data.length).to eq(1) + expect(response.payment_sources.data.first).to be_instance_of(Conekta::PaymentMethodCardResponse) + expect(response.payment_sources.data.first.type).to eq('card') + expect(response.payment_sources.data.first.card_type).to eq('credit') + expect(response.subscription).not_to be_nil + expect(response.subscription.customer_id).to eq(id) + end + it 'cash' do + id = 'cus_2rGtVzg5V2KZrKXBh' + + response = @api_instance.get_customer_by_id(id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::CustomerResponse) + expect(response.id).to eq(id) + expect(response.payment_sources.data.length).to eq(1) + expect(response.payment_sources.data.first).to be_instance_of(Conekta::PaymentMethodCashResponse) + expect(response.payment_sources.data.first.type).to eq('oxxo_recurrent') + expect(response.payment_sources.data.first.provider).to eq('Oxxo') + expect(response.payment_sources.data.first.object).to eq('payment_source') + end + it 'spei' do + id = "cus_2tYELwYTKSB5hDXsr" + + response = @api_instance.get_customer_by_id(id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::CustomerResponse) + expect(response.id).to eq(id) + expect(response.payment_sources.data.length).to eq(1) + expect(response.payment_sources.data.first).to be_instance_of(Conekta::PaymentMethodSpeiRecurrent) + expect(response.payment_sources.data.first.type).to eq('spei_recurrent') + end + end + + # unit tests for get_customers + # Get a list of customers + # The purpose of business is to create and maintain a client, you will learn what elements you need to obtain a list of clients, which can be paged. + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [CustomersResponse] + describe 'get_customers test' do + it 'with limit' do + response = @api_instance.get_customers({ accept_language: 'es', limit: 21 }) + + expect(response).to be_instance_of(Conekta::CustomersResponse) + expect(response.next_page_url).to be_truthy + expect(response.previous_page_url).to be_falsey + expect(response.has_more).to be_truthy + expect(response.object).to eq('list') + end + it 'next' do + response = @api_instance.get_customers({ accept_language: 'es', limit: 22, _next: 'cus_2sthLBEZRLp2s6GWc' }) + + expect(response).to be_instance_of(Conekta::CustomersResponse) + expect(response.next_page_url).to be_truthy + expect(response.previous_page_url).to be_truthy + expect(response.has_more).to be_truthy + expect(response.object).to eq('list') + end + it 'previous' do + response = @api_instance.get_customers({ accept_language: 'es', limit: 23, previous: 'cus_2ss5YAeTKuEr5M4fD' }) + + expect(response).to be_instance_of(Conekta::CustomersResponse) + expect(response.next_page_url).to be_truthy + expect(response.previous_page_url).to be_falsey + expect(response.has_more).to be_falsey + expect(response.object).to eq('list') + end + end + + # unit tests for update_customer + # Update customer + # You can update customer-related data + # @param id Identifier of the resource + # @param update_customer requested field for customer + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerResponse] + describe 'update_customer test' do + it 'should work' do + id = "cus_2tYENskzTjjgkGQLt" + update_request = Conekta::UpdateCustomer.new({ + email: 'dotnet@test.com' + }) + response = @api_instance.update_customer(id, update_request) + + expect(response).to be_instance_of(Conekta::CustomerResponse) + expect(response.email).to eq(update_request.email) + expect(response.id).to eq(id) + end + end + + # unit tests for update_customer_fiscal_entities + # Update Fiscal Entity + # Update Fiscal Entity resource that corresponds to a customer ID. + # @param id Identifier of the resource + # @param fiscal_entities_id identifier + # @param customer_update_fiscal_entities_request requested field for customer update fiscal entities + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateCustomerFiscalEntitiesResponse] + describe 'update_customer_fiscal_entities test' do + it 'should work' do + id = "cus_2tYENskzTjjgkGQLt" + fiscal_entities_id = "fis_ent_2tYENskzTjjgkGQLr" + request = Conekta::CustomerUpdateFiscalEntitiesRequest.new({ + tax_id: 'tax_28764234' + }) + response = @api_instance.update_customer_fiscal_entities(id, fiscal_entities_id, request) + + expect(response).to be_instance_of(Conekta::UpdateCustomerFiscalEntitiesResponse) + expect(response.tax_id).to eq(request.tax_id) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(fiscal_entities_id) + end + end + + def full_customer + fiscal_entities = Array.new(1) + fiscal_entities[0] = + Conekta::CustomerFiscalEntitiesRequest.new({ + address: Conekta::CustomerFiscalEntitiesRequestAddress.new({ + street1: "av siempre viva", + street2: "condensa", + postal_code: "11011", + city: "cdmx mexico", + state: "cdmx mexico", + country: "mexico", + residential: true, + external_number: "avas3" + }), + company_name: "testing ca", + tax_id: "tax_23432", + email: "test@conekta.com", + phone: "+573143152012", + }) + + payment_sources = Array.new(1) + payment_sources[0] = + Conekta::PaymentMethodCardRequest.new({ + type: 'card', + token_id: 'tok_2tXyExrU6U7yiaTto' + }) + shipping_contacts = Array.new(1) + shipping_contacts[0] = Conekta::CustomerShippingContacts.new({ + address: Conekta::CustomerShippingContactsAddress.new({ + street1: "avenida siempre viva", + country: "mexico", + postal_code: "11011" + }), + phone: "+54874122144" + }) + + subscription = Conekta::SubscriptionRequest.new({ + plan_id: "plan_2tXx672QLQ68CkmMn", + card_id: "card_2tXyExrU6U7yiaTto", + trial_end: 1679321468 + }) + Conekta::Customer.new( + { + name: 'test dot', + phone: '+573143159063', + email: 'test@conekta.com', + corporate: true, + plan_id: 'plan_2tXx672QLQ68CkmMn', + default_shipping_contact_id: "", + default_payment_source_id: "", + custom_reference: "dotnet_12345678", + fiscal_entities: fiscal_entities, + payment_sources: payment_sources, + shipping_contacts: shipping_contacts, + subscription: subscription + } + ) + end +end diff --git a/spec/api/discounts_api_spec.rb b/spec/api/discounts_api_spec.rb new file mode 100644 index 0000000..c72b492 --- /dev/null +++ b/spec/api/discounts_api_spec.rb @@ -0,0 +1,153 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::DiscountsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'DiscountsApi' do + before do + # run before each test + @api_instance = Conekta::DiscountsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of DiscountsApi' do + it 'should create an instance of DiscountsApi' do + expect(@api_instance).to be_instance_of(Conekta::DiscountsApi) + end + end + + # unit tests for orders_create_discount_line + # Create Discount + # Create discount lines for an existing orden + # @param id Identifier of the resource + # @param order_discount_lines_request requested field for a discount lines + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DiscountLinesResponse] + describe 'orders_create_discount_line test' do + it 'should work' do + id = 'ord_2tVyWPnCPWbrV37mW' + request = Conekta::OrderDiscountLinesRequest.new({ + amount: 500, + code: "track", + type: "loyalty" + }) + response = @api_instance.orders_create_discount_line(id, request) + + expect(response).to be_instance_of(Conekta::DiscountLinesResponse) + expect(response.parent_id).to eq(id) + expect(response.amount).to eq(request.amount) + end + end + + # unit tests for orders_delete_discount_lines + # Delete Discount + # Delete an existing discount lines for an existing orden + # @param id Identifier of the resource + # @param discount_lines_id discount line id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DiscountLinesResponse] + describe 'orders_delete_discount_lines test' do + it 'should work' do + id = 'ord_2tVyWPnCPWbrV37mW' + discount_line_id = 'dis_lin_2tVyahK8Nts7rKRMZ' + + response = @api_instance.orders_delete_discount_lines(id, discount_line_id) + + expect(response).to be_instance_of(Conekta::DiscountLinesResponse) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(discount_line_id) + + end + end + + # unit tests for orders_get_discount_line + # Get Discount + # Get an existing discount lines for an existing orden + # @param id Identifier of the resource + # @param discount_lines_id discount line id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DiscountLinesResponse] + describe 'orders_get_discount_line test' do + it 'should work' do + id = 'ord_2tkwrBmcvGnA9zdU9' + discount_line_id = 'dis_lin_2tkwrBmcvGnA9zdU6' + response = @api_instance.orders_get_discount_line(id, discount_line_id) + + expect(response).to be_instance_of(Conekta::DiscountLinesResponse) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(discount_line_id) + end + end + + # unit tests for orders_get_discount_lines + # Get a List of Discount + # Get discount lines for an existing orden + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetOrderDiscountLinesResponse] + describe 'orders_get_discount_lines test' do + it 'should work' do + id = 'ord_2tVyWPnCPWbrV37mW' + response = @api_instance.orders_get_discount_lines(id) + + expect(response).to be_instance_of(Conekta::GetOrderDiscountLinesResponse) + expect(response.data.length).to eq(2) + expect(response.has_more).to be_falsey + end + end + + # unit tests for orders_update_discount_lines + # Update Discount + # Update an existing discount lines for an existing orden + # @param id Identifier of the resource + # @param discount_lines_id discount line id identifier + # @param update_order_discount_lines_request requested field for a discount lines + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [DiscountLinesResponse] + describe 'orders_update_discount_lines test' do + it 'should work' do + id = 'ord_2tVyWPnCPWbrV37mW' + discount_lines_id = 'dis_lin_2tVyahK8Nts7rKRMZ' + request = Conekta::UpdateOrderDiscountLinesRequest.new({ + amount: 100 + }) + + response = @api_instance.orders_update_discount_lines(id, discount_lines_id, request) + + expect(response).to be_instance_of(Conekta::DiscountLinesResponse) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(discount_lines_id) + end + end + +end diff --git a/spec/api/events_api_spec.rb b/spec/api/events_api_spec.rb new file mode 100644 index 0000000..67e4ccf --- /dev/null +++ b/spec/api/events_api_spec.rb @@ -0,0 +1,96 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::EventsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'EventsApi' do + before do + # run before each test + @api_instance = Conekta::EventsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of EventsApi' do + it 'should create an instance of EventsApi' do + expect(@api_instance).to be_instance_of(Conekta::EventsApi) + end + end + + # unit tests for get_event + # Get Event + # Returns a single event + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [EventResponse] + describe 'get_event test' do + it 'should work' do + id= '63fe3d2ddf70970001cfb41a' + response = @api_instance.get_event(id, {accept_language: 'en'}) + + expect(response).to be_instance_of(Conekta::EventResponse) + expect(response.id).to eq(id) + expect(response.webhook_logs.length).to eq(1) + end + end + + # unit tests for get_events + # Get list of Events + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetEventsResponse] + describe 'get_events test' do + it 'should work' do + response = @api_instance.get_events({accept_language: 'es'}) + + expect(response).to be_instance_of(Conekta::GetEventsResponse) + expect(response.has_more).to be_truthy + expect(response.previous_page_url).to be_nil + expect(response.next_page_url).not_to be_nil + end + end + + # unit tests for resend_event + # Resend Event + # Try to send an event + # @param event_id event identifier + # @param webhook_log_id webhook log identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [EventsResendResponse] + describe 'resend_event test' do + it 'should work' do + event_id= '6463d6e35a4c3e001819e760' + webhook_log_id= 'webhl_2svd2sh6GbqzyWBNZ' + + response = @api_instance.resend_event(event_id, webhook_log_id) + + expect(response).to be_instance_of(Conekta::EventsResendResponse) + expect(response.id).to eq(webhook_log_id) + expect(response.last_http_response_status).to eq(405) + end + end + +end diff --git a/spec/api/logs_api_spec.rb b/spec/api/logs_api_spec.rb new file mode 100644 index 0000000..0933ac7 --- /dev/null +++ b/spec/api/logs_api_spec.rb @@ -0,0 +1,78 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require_relative 'base_test' +require 'json' + +# Unit tests for Conekta::LogsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'LogsApi' do + before do + # run before each test + @api_instance = Conekta::LogsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of LogsApi' do + it 'should create an instance of LogsApi' do + expect(@api_instance).to be_instance_of(Conekta::LogsApi) + end + end + + # unit tests for get_log_by_id + # Get Log + # Get the details of a specific log + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [LogResponse] + describe 'get_log_by_id test' do + it 'should work' do + id = '6419dd15b985080001fc280e' + response = @api_instance.get_log_by_id(id, {accept_language: 'es'}) + + expect(response).not_to be_nil + expect(response).to be_instance_of(Conekta::LogResponse) + expect(response.id).to eq(id) + end + end + + # unit tests for get_logs + # Get List Of Logs + # Get log details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [LogsResponse] + describe 'get_logs test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + response = @api_instance.get_logs({accept_language: 'es'}) + + expect(response).not_to be_nil + expect(response.has_more).to be_truthy + expect(response).to be_instance_of(Conekta::LogsResponse) + expect(response.data.length).to eq(20) + end + end + +end diff --git a/spec/api/orders_api_spec.rb b/spec/api/orders_api_spec.rb new file mode 100644 index 0000000..2044cd6 --- /dev/null +++ b/spec/api/orders_api_spec.rb @@ -0,0 +1,362 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Conekta::OrdersApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'OrdersApi' do + before do + # run before each test + @api_instance = Conekta::OrdersApi.new + end + + after do + # run after each test + end + + describe 'test an instance of OrdersApi' do + it 'should create an instance of OrdersApi' do + expect(@api_instance).to be_instance_of(Conekta::OrdersApi) + end + end + + # unit tests for cancel_order + # Cancel Order + # Cancel an order that has been previously created. + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + describe 'cancel_order test' do + it 'should work' do + id = 'ord_2tqaGQYZyvBsMKEgs' + response = @api_instance.cancel_order(id) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.id).to eq(id) + expect(response.payment_status).to eq('canceled') + end + end + + # unit tests for create_order + # Create order + # Create a new order. + # @param order_request requested field for order + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + describe 'create_order test' do + it 'error' do + expect { + request = Conekta::OrderRequest.new({ + customer_info: Conekta::CustomerInfoJustCustomerId.new({ customer_id: 'cus_2tKcHxhTz7xU5SymF2' }) + }) + + @api_instance.create_order(request) + }.to raise_error do |error| + expect(error.code).to eq(402) + end + end + it 'cash' do + thirty_days_from_now = DateTime.now + 30 # Sumamos 30 días a la fecha actual + unix_timestamp = (thirty_days_from_now - DateTime.new(1970, 1, 1)).to_i + products = [ + Conekta::Product.new({ + name: "toshiba", + quantity: 1, + unit_price: 1555 + }) + ] + charges = Array.new(1) + charges[0] = Conekta::ChargeRequest.new({ amount: 1555, + payment_method: Conekta::ChargeRequestPaymentMethod.new( + { + expires_at: unix_timestamp, + type: 'cash' + } + ) + }) + request = Conekta::OrderRequest.new( + { + currency: "MXN", + pre_authorize: false, + customer_info: Conekta::CustomerInfoJustCustomerId.new({ customer_id: 'cus_2tKcHxhTz7xU5SymF' }), + line_items: products, + charges: charges + } + ) + + response = @api_instance.create_order(request, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.payment_status).to eq('pending_payment') + expect(response.currency).to eq('MXN') + expect(response.charges.data.first.payment_method).to be_instance_of(Conekta::PaymentMethodCash) + end + + it 'msi' do + products = [ + Conekta::Product.new({ + name: "toshiba", + quantity: 1, + unit_price: 1555 + }) + ] + checkout = Conekta::CheckoutRequest.new({ + allowed_payment_methods: %w[cash card bank_transfer], + monthly_installments_enabled: true, + monthly_installments_options: [3, 6, 12] + }) + request = Conekta::OrderRequest.new({ + currency: "MXN", + customer_info: Conekta::CustomerInfoJustCustomerId.new({ customer_id: 'cus_msi_2o8jK3TDtejmz1sYd' }), + line_items: products, + checkout: checkout, + metadata: { test: "true" } + }) + response = @api_instance.create_order(request) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.checkout).to be_instance_of(Conekta::OrderResponseCheckout) + expect(response.checkout.id).to be_truthy + expect(response.id).to eq('ord_msi_2tUgccjdQJ7SdBrXb') + expect(response.checkout.type).to eq('Integration') + end + it 'card' do + products = [ + Conekta::Product.new({ + name: "toshiba", + quantity: 1, + unit_price: 1555 + }) + ] + checkout = Conekta::CheckoutRequest.new({ + allowed_payment_methods: %w[cash card bank_transfer], + on_demand_enabled: true + }) + request = Conekta::OrderRequest.new({ + currency: "MXN", + customer_info: Conekta::CustomerInfoJustCustomerId.new({ customer_id: 'cus_save_card_2o8jK3TDtejmz1sYd' }), + line_items: products, + checkout: checkout, + metadata: { test: "true" } + }) + response = @api_instance.create_order(request) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.checkout).to be_instance_of(Conekta::OrderResponseCheckout) + expect(response.checkout.id).to be_truthy + expect(response.id).to eq('ord_saved_card_2tUgccjdQJ7SdBrXb') + expect(response.checkout.type).to eq('Integration') + end + end + + # unit tests for get_order_by_id + # Get Order + # Info for a specific order + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + describe 'get_order_by_id test' do + it 'not found' do + expect { + @api_instance.get_order_by_id('ord_2tUhuyzqLi6UJE9D12', { accept_language: 'en' }) + }.to raise_error do |error| + expect(error.code).to eq(404) + end + end + it 'bank transfer' do + id = 'ord_2tUyGSk9TNWUcyvjn' + + response = @api_instance.get_order_by_id(id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.charges.data.length).to eq(1) + expect(response.charges.data.first.payment_method).to be_instance_of(Conekta::PaymentMethodBankTransfer) + expect(response.charges.data.first.payment_method.object).to eq('bank_transfer_payment') + end + end + + # unit tests for get_orders + # Get a list of Orders + # Get order details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetOrdersResponse] + describe 'get_orders test' do + it 'should work' do + response = @api_instance.get_orders({ accept_language: 'en', limit: 20 }) + + expect(response).to be_instance_of(Conekta::GetOrdersResponse) + expect(response.has_more).to be_truthy + expect(response.next_page_url).to eq('https://api-core.stg.conekta.io/orders?next=ord_2tNDyQbJacvUZiyfp') + expect(response.previous_page_url).to be_falsey + expect(response.data.first.charges.data.first.payment_method).to be_instance_of(Conekta::PaymentMethodCard) + expect(response.data[9].charges.data.first.payment_method).to be_instance_of(Conekta::PaymentMethodCash) + end + it 'next' do + response = @api_instance.get_orders({ accept_language: 'en', limit: 19, _next: 'ord_2tNDyQbJacvUZiyfp' }) + + expect(response).to be_instance_of(Conekta::GetOrdersResponse) + expect(response.has_more).to be_truthy + expect(response.next_page_url).to eq('https://api-core.stg.conekta.io/orders?limit=19&next=ord_2tKZmA749BLsMRgBg') + expect(response.previous_page_url).to eq('https://api-core.stg.conekta.io/orders?limit=19&previous=ord_2tNDwzeMnVSU9kKHR') + expect(response.data.length).to eq(19) + expect(response.data.first.customer_info.customer_id).to eq('cus_2tKcHxhTz7xU5SymF') + expect(response.data.first.shipping_contact.address.country).to eq('mx') + end + it 'previous' do + response = @api_instance.get_orders({ accept_language: 'en', limit: 21, previous: 'ord_2tHuXwkFTkjAbMGjU' }) + + expect(response).to be_instance_of(Conekta::GetOrdersResponse) + expect(response.has_more).to be_truthy + expect(response.data.length).to eq(21) + expect(response.data.first.customer_info.customer_id).to eq('cus_2tKcHxhTz7xU5SymF') + expect(response.data.first.shipping_contact.address.country).to eq('mx') + end + it 'search' do + response = @api_instance.get_orders({ accept_language: 'en', limit: 22, search: 'ord_2tNDzhA4Akmzj11AS' }) + + expect(response).to be_instance_of(Conekta::GetOrdersResponse) + expect(response.has_more).to be_falsey + expect(response.data.length).to eq(1) + expect(response.data.first.customer_info.customer_id).to eq('cus_2tKcHxhTz7xU5SymF') + expect(response.data.first.id).to eq('ord_2tNDzhA4Akmzj11AS') + expect(response.data.first.shipping_contact.address.postal_code).to eq('06100') + end + end + + # unit tests for order_cancel_refund + # Cancel Refund + # A refunded order describes the items, amount, and reason an order is being refunded. + # @param id Identifier of the resource + # @param refund_id refund identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + describe 'order_cancel_refund test' do + it 'should work' do + id = 'ord_2tV52JvSom2w3E8bX' + refund_id = '6407b5bee1329a000175ba11' + + response = @api_instance.order_cancel_refund(id, refund_id) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.id).to eq(id) + expect(response.charges.data.first.refunds.data.first.id).to eq(refund_id) + end + end + + # unit tests for order_refund + # Refund Order + # A refunded order describes the items, amount, and reason an order is being refunded. + # @param id Identifier of the resource + # @param order_refund_request requested field for a refund + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [OrderResponse] + describe 'order_refund test' do + it 'should work' do + id = 'ord_2tV52JvSom2w3E8bX' + request = Conekta::OrderRefundRequest.new({ + amount: 15000, + reason: "requested_by_client" + }) + + response = @api_instance.order_refund(id, request) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.payment_status).to eq('partially_refunded') + expect(response.charges.data.first.status).to eq('partially_refunded') + expect(response.charges.data.first.refunds.data.first.object).to eq('refund') + expect(response.charges.data.first.payment_method).to be_instance_of(Conekta::PaymentMethodCard) + end + end + + # unit tests for orders_create_capture + # Capture Order + # Processes an order that has been previously authorized. + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [OrderCaptureRequest] :order_capture_request requested fields for capture order + # @return [OrderResponse] + describe 'orders_create_capture test' do + it 'should work' do + id = 'ord_2tVKoTd79XK1GqJme' + + response = @api_instance.orders_create_capture(id, { accept_language: 'en' }) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.payment_status).to eq('paid') + expect(response.amount).to eq(40000) + end + it 'with body' do + id = 'ord_2tVKoTd79XK1GqJmm' + + response = @api_instance.orders_create_capture(id, { accept_language: 'en', order_capture_request: Conekta::OrderCaptureRequest.new({ amount: 40000 }) }) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.payment_status).to eq('paid') + expect(response.amount).to eq(40000) + end + end + + # unit tests for update_order + # Update Order + # Update an existing Order. + # @param id Identifier of the resource + # @param order_update_request requested field for an order + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [OrderResponse] + describe 'update_order test' do + it 'should work' do + + id = 'ord_2tVPCGRXnMXKdvcsj' + products = [ + Conekta::Product.new({ + name: "Pago Mensualidad enero", + quantity: 2, + unit_price: 41000, + description: "Mes de enero.", + tags: { "Pago": "Pago mensualidad" } + }) + ] + request = Conekta::OrderUpdateRequest.new({ + line_items: products + }) + response = @api_instance.update_order(id, request) + + expect(response).to be_instance_of(Conekta::OrderResponse) + expect(response.created_at).not_to eq(response.updated_at) + expect(response.line_items.data.first.unit_price).to eq(products.first.unit_price) + end + end + +end diff --git a/spec/api/payment_link_api_spec.rb b/spec/api/payment_link_api_spec.rb new file mode 100644 index 0000000..ea801fe --- /dev/null +++ b/spec/api/payment_link_api_spec.rb @@ -0,0 +1,192 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::PaymentLinkApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'PaymentLinkApi' do + before do + # run before each test + @api_instance = Conekta::PaymentLinkApi.new + end + + after do + # run after each test + end + + describe 'test an instance of PaymentLinkApi' do + it 'should create an instance of PaymentLinkApi' do + expect(@api_instance).to be_instance_of(Conekta::PaymentLinkApi) + end + end + + # unit tests for cancel_checkout + # Cancel Payment Link + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + describe 'cancel_checkout test' do + it 'should work' do + id = "c7734ada-e1e9-4b22-90f6-b80a1b2006d4" + + response = @api_instance.cancel_checkout(id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::CheckoutResponse) + expect(response.status).to eq('Cancelled') + expect(response.id).to eq(id) + end + end + + # unit tests for create_checkout + # Create Unique Payment Link + # @param checkout requested field for checkout + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + describe 'create_checkout test' do + it 'without customer info' do + + checkout = Conekta::Checkout.new({ + allowed_payment_methods: %w[card cash bank_transfer], + type: "PaymentLink", + name: "Payment Link Name netcore sdk", + recurrent: false, + needs_shipping_contact: false, + expires_at: (DateTime.now + 200).to_time.to_i, + order_template: Conekta::CheckoutOrderTemplate.new({ currency: "MXN", line_items: [ + Conekta::Product.new({ name: "toshiba", quantity: 1, unit_price: 500 })] }) + }) + + response = @api_instance.create_checkout(checkout) + + expect(response).to be_instance_of(Conekta::CheckoutResponse) + expect(response.expires_at).to eq(checkout.expires_at) + expect(response.id).to eq('e4bcbed2-194c-4540-a922-b6d7531925a3') + end + it 'with customer info' do + customer_info = Conekta::CustomerInfo.new({ + name: 'steven', + email: 'steven@gmail.com', + phone: '5555555555' + }) + checkout = Conekta::Checkout.new({ + allowed_payment_methods: %w[card cash bank_transfer], + type: "PaymentLink", + name: "Payment Link Name netcore sdk", + recurrent: true, + needs_shipping_contact: false, + expires_at: (DateTime.now + 200).to_time.to_i, + order_template: Conekta::CheckoutOrderTemplate.new({ + currency: "MXN", + customer_info: customer_info, + line_items: [ + Conekta::Product.new({ name: "toshiba", quantity: 1, unit_price: 500 })] }) + }) + + response = @api_instance.create_checkout(checkout) + + expect(response.expires_at).to eq(checkout.expires_at) + expect(response.id).to eq('4b57dde6-1080-4529-8a7c-7299812a3b1a') + end + end + + # unit tests for email_checkout + # Send an email + # @param id Identifier of the resource + # @param email_checkout_request requested field for sms checkout + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + describe 'email_checkout test' do + it 'should work' do + id = "102bdf5c-3ee6-48ec-a9ff-40ec6f5f054b" + request = Conekta::EmailCheckoutRequest.new({ email: 'example@conekta.com' }) + + response = @api_instance.email_checkout(id, request) + + expect(response).to be_instance_of(Conekta::CheckoutResponse) + expect(response.emails_sent).to eq(1) + expect(response.sms_sent).to eq(0) + expect(response.id).to eq(id) + end + end + + # unit tests for get_checkout + # Get a payment link by ID + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + describe 'get_checkout test' do + it 'should work' do + id = "bac0ed14-6888-4d1d-927a-c80d3f55c009" + + response = @api_instance.get_checkout(id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::CheckoutResponse) + expect(response.id).to eq(id) + expect(response.status).to eq('Expired') + end + end + + # unit tests for get_checkouts + # Get a list of payment links + # Returns a list of links generated by the merchant + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [CheckoutsResponse] + describe 'get_checkouts test' do + it 'should work' do + response = @api_instance.get_checkouts({ accept_language: 'en' }) + + expect(response).to be_instance_of(Conekta::CheckoutsResponse) + expect(response.data.length).to eq(20) + expect(response.next_page_url).to eq('https://api-core.stg.conekta.io/checkouts?next=bac0ed14-6888-4d1d-927a-c80d3f55c009') + end + end + + # unit tests for sms_checkout + # Send an sms + # @param id Identifier of the resource + # @param sms_checkout_request requested field for sms checkout + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CheckoutResponse] + describe 'sms_checkout test' do + it 'should work' do + id = "ce1076bb-5ee6-4d08-a0e2-ec0bfbc49883" + request = Conekta::SmsCheckoutRequest.new({ phonenumber: '5566982090' }) + + response = @api_instance.sms_checkout(id, request) + + expect(response).to be_instance_of(Conekta::CheckoutResponse) + expect(response.id).to eq(id) + expect(response.sms_sent).to eq(1) + expect(response.emails_sent).to eq(0) + end + end + +end diff --git a/spec/api/payment_methods_api_spec.rb b/spec/api/payment_methods_api_spec.rb new file mode 100644 index 0000000..3a82e0c --- /dev/null +++ b/spec/api/payment_methods_api_spec.rb @@ -0,0 +1,134 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::PaymentMethodsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'PaymentMethodsApi' do + before do + # run before each test + @api_instance = Conekta::PaymentMethodsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of PaymentMethodsApi' do + it 'should create an instance of PaymentMethodsApi' do + expect(@api_instance).to be_instance_of(Conekta::PaymentMethodsApi) + end + end + + # unit tests for create_customer_payment_methods + # Create Payment Method + # Create a payment method for a customer. + # @param id Identifier of the resource + # @param create_customer_payment_methods_request requested field for customer payment methods + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CreateCustomerPaymentMethodsResponse] + describe 'create_customer_payment_methods test' do + it 'should work' do + id = "cus_2tXyF9BwPG14UMkkg" + request = Conekta::PaymentMethodCashRequest.new({ type: 'oxxo_recurrent' }) + + response = @api_instance.create_customer_payment_methods(id, request) + + expect(response).to be_instance_of(Conekta::PaymentMethodCashResponse) + expect(response.parent_id).to eq(id) + expect(response.id).to be_truthy + expect(response.barcode_url).to be_truthy + + end + end + + # unit tests for delete_customer_payment_methods + # Delete Payment Method + # Delete an existing payment method + # @param id Identifier of the resource + # @param payment_method_id Identifier of the payment method + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateCustomerPaymentMethodsResponse] + describe 'delete_customer_payment_methods test' do + it 'should work' do + id = "cus_2tZWxbTPtQgGJGh8P" + payment_method_id = "src_2tZWxbTPtQgGJGh8R" + + response = @api_instance.delete_customer_payment_methods(id, payment_method_id, { accept_language: 'en' }) + + expect(response).to be_instance_of(Conekta::PaymentMethodCardResponse) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(payment_method_id) + end + end + + # unit tests for get_customer_payment_methods + # Get Payment Methods + # Get a list of Payment Methods + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @return [GetPaymentMethodResponse] + describe 'get_customer_payment_methods test' do + it 'should work' do + id = 'src_2tbd5Bgy67RL9oycM' + response = @api_instance.get_customer_payment_methods(id) + + expect(response).to be_instance_of(Conekta::GetPaymentMethodResponse) + expect(response.data.first).to be_instance_of(Conekta::PaymentMethodCardResponse) + expect(response.data.first.id).to eq(id) + expect(response.next_page_url).to be_falsey + expect(response.previous_page_url).to be_falsey + expect(response.has_more).to be_falsey + end + end + + # unit tests for update_customer_payment_methods + # Update Payment Method + # Gets a payment Method that corresponds to a customer ID. + # @param id Identifier of the resource + # @param payment_method_id Identifier of the payment method + # @param update_payment_methods requested field for customer payment methods + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateCustomerPaymentMethodsResponse] + describe 'update_customer_payment_methods test' do + it 'should work' do + id = "cus_2tZWxbTPtQgGJGh8P" + payment_method_id = "src_2tZWxbTPtQgGJGh8R" + request = Conekta::UpdatePaymentMethods.new({ + name: 'name of person' + }) + + response = @api_instance.update_customer_payment_methods(id, payment_method_id, request) + + expect(response).to be_instance_of(Conekta::PaymentMethodCardResponse) + expect(response.name).to eq(request.name) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(payment_method_id) + end + end + +end diff --git a/spec/api/plans_api_spec.rb b/spec/api/plans_api_spec.rb new file mode 100644 index 0000000..1f51723 --- /dev/null +++ b/spec/api/plans_api_spec.rb @@ -0,0 +1,139 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::PlansApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'PlansApi' do + before do + # run before each test + @api_instance = Conekta::PlansApi.new + end + + after do + # run after each test + end + + describe 'test an instance of PlansApi' do + it 'should create an instance of PlansApi' do + expect(@api_instance).to be_instance_of(Conekta::PlansApi) + end + end + + # unit tests for create_plan + # Create Plan + # Create a new plan for an existing order + # @param plan_request requested field for plan + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [PlanResponse] + describe 'create_plan test' do + it 'should work' do + request = Conekta::PlanRequest.new({ + name: "Gold Plan", + amount: 10000, + currency: "MXN", + interval: 'week', + frequency: 1 + }) + + response = @api_instance.create_plan(request) + + expect(response).to be_instance_of(Conekta::PlanResponse) + expect(response.expiry_count).to be_nil + expect(response.livemode).to be_truthy + expect(response.name).to eq(request.name) + end + end + + # unit tests for delete_plan + # Delete Plan + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [PlanResponse] + describe 'delete_plan test' do + it 'should work' do + response = @api_instance.delete_plan('plan_2tZb5q8Z3PYpg6SJd', { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::PlanResponse) + end + end + + # unit tests for get_plan + # Get Plan + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [PlanResponse] + describe 'get_plan test' do + it 'should work' do + id = 'plan_2tZb5q8Z3PYpg6SJd' + + response = @api_instance.get_plan(id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::PlanResponse) + expect(response.id).to eq(id) + expect(response.currency).to eq('MXN') + end + end + + # unit tests for get_plans + # Get A List of Plans + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetPlansResponse] + describe 'get_plans test' do + it 'should work' do + response = @api_instance.get_plans({ accept_language: 'es', limit: 20 }) + + expect(response).to be_instance_of(Conekta::GetPlansResponse) + expect(response.data.length).to eq(10) + expect(response.has_more).to be_falsey + expect(response.next_page_url).to be_nil + expect(response.previous_page_url).to be_nil + end + end + + # unit tests for update_plan + # Update Plan + # @param id Identifier of the resource + # @param plan_update_request requested field for plan + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [PlanResponse] + describe 'update_plan test' do + it 'should work' do + id = 'plan_2tZb5q8Z3PYpg6SJd' + request = Conekta::PlanUpdateRequest.new({ + name: 'updated name' + }) + response = @api_instance.update_plan(id, request) + + expect(response).to be_instance_of(Conekta::PlanResponse) + expect(response.name).to eq(request.name) + expect(response.id).to eq(id) + end + end + +end diff --git a/spec/api/products_api_spec.rb b/spec/api/products_api_spec.rb new file mode 100644 index 0000000..bdc0398 --- /dev/null +++ b/spec/api/products_api_spec.rb @@ -0,0 +1,106 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::ProductsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProductsApi' do + before do + # run before each test + @api_instance = Conekta::ProductsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ProductsApi' do + it 'should create an instance of ProductsApi' do + expect(@api_instance).to be_instance_of(Conekta::ProductsApi) + end + end + + # unit tests for orders_create_product + # Create Product + # Create a new product for an existing order. + # @param id Identifier of the resource + # @param product requested field for a product + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ProductOrderResponse] + describe 'orders_create_product test' do + it 'should work' do + id = "ord_2tVyWPnCPWbrV37mW" + request = Conekta::Product.new({ + description: "Mes de marz.", + name: "Pago Mensualidad test", + quantity: 1, + unit_price: 1000, + tags: ["Pago 2", "Pago mensualidad 2"] + }) + + response = @api_instance.orders_create_product(id, request) + + expect(response).to be_instance_of(Conekta::ProductOrderResponse) + expect(response.parent_id).to eq(id) + expect(response.object).to eq('line_item') + end + end + + # unit tests for orders_delete_product + # Delete Product + # Delete product for an existing orden + # @param id Identifier of the resource + # @param line_item_id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ProductOrderResponse] + describe 'orders_delete_product test' do + it 'should work' do + response = @api_instance.orders_delete_product('ord_2tVyWPnCPWbrV37mW', 'line_item_2tVz8UkyWhSxLfUd7') + + expect(response).to be_instance_of(Conekta::ProductOrderResponse) + expect(response.id).to eq('line_item_2tVz8UkyWhSxLfUd7') + expect(response.parent_id).to eq('ord_2tVyWPnCPWbrV37mW') + end + end + + # unit tests for orders_update_product + # Update Product + # Update an existing product for an existing orden + # @param id Identifier of the resource + # @param line_item_id identifier + # @param update_product requested field for products + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ProductOrderResponse] + describe 'orders_update_product test' do + it 'should work' do + id = "ord_2tVyWPnCPWbrV37mW" + product_id = "line_item_2tVz8UkyWhSxLfUd7" + request = Conekta::UpdateProduct.new({description: "Pago Mensualidad"}) + + response = @api_instance.orders_update_product(id, product_id, request) + + expect(response).to be_instance_of(Conekta::ProductOrderResponse) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(product_id) + end + end + +end diff --git a/spec/api/shipping_contacts_api_spec.rb b/spec/api/shipping_contacts_api_spec.rb new file mode 100644 index 0000000..caec348 --- /dev/null +++ b/spec/api/shipping_contacts_api_spec.rb @@ -0,0 +1,117 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::ShippingContactsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ShippingContactsApi' do + before do + # run before each test + @api_instance = Conekta::ShippingContactsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ShippingContactsApi' do + it 'should create an instance of ShippingContactsApi' do + expect(@api_instance).to be_instance_of(Conekta::ShippingContactsApi) + end + end + + # unit tests for create_customer_shipping_contacts + # Create a shipping contacts + # Create a shipping contacts for a customer. + # @param id Identifier of the resource + # @param customer_shipping_contacts requested field for customer shippings contacts + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerShippingContactsResponse] + describe 'create_customer_shipping_contacts test' do + it 'should work' do + id = "cus_2tXyF9BwPG14UMkkg" + request = Conekta::CustomerShippingContacts.new({ + address: Conekta::CustomerShippingContactsAddress.new({ + street1: "av siem", + city: "mexico", + country: "mx", + postal_code: "11000" + }), + phone: "1234567890", + receiver: "receiver" + }) + response = @api_instance.create_customer_shipping_contacts(id, request) + + expect(response).to be_instance_of(Conekta::CustomerShippingContactsResponse) + expect(response.parent_id).to eq(id) + expect(response.address.country).to eq(request.address.country) + expect(response.id).to be_truthy + expect(response.created_at).to eq(1679009479) + end + end + + # unit tests for delete_customer_shipping_contacts + # Delete shipping contacts + # Delete shipping contact that corresponds to a customer ID. + # @param id Identifier of the resource + # @param shipping_contacts_id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerShippingContactsResponse] + describe 'delete_customer_shipping_contacts test' do + it 'should work' do + id = 'cus_2tZWxbTPtQgGJGh8P' + shipping_contact_id = 'ship_cont_2tZWzJPBf87C6TcoQ' + + response = @api_instance.delete_customer_shipping_contacts(id, shipping_contact_id) + + expect(response).to be_instance_of(Conekta::CustomerShippingContactsResponse) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(shipping_contact_id) + end + end + + # unit tests for update_customer_shipping_contacts + # Update shipping contacts + # Update shipping contact that corresponds to a customer ID. + # @param id Identifier of the resource + # @param shipping_contacts_id identifier + # @param customer_update_shipping_contacts requested field for customer update shippings contacts + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [CustomerShippingContactsResponse] + describe 'update_customer_shipping_contacts test' do + it 'should work' do + id = "cus_2tZWxbTPtQgGJGh8P"; + shipping_contacts_id = "ship_cont_2tZWzJPBf87C6TcoQ" + request = Conekta::CustomerUpdateShippingContacts.new({ + phone: "3143145050" + }) + + response = @api_instance.update_customer_shipping_contacts(id, shipping_contacts_id, request) + + expect(response).to be_instance_of(Conekta::CustomerShippingContactsResponse) + expect(response.phone).to eq(request.phone) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(shipping_contacts_id) + expect(response.default).to eq(false) + end + end + +end diff --git a/spec/api/shippings_api_spec.rb b/spec/api/shippings_api_spec.rb new file mode 100644 index 0000000..238247d --- /dev/null +++ b/spec/api/shippings_api_spec.rb @@ -0,0 +1,108 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::ShippingsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ShippingsApi' do + before do + # run before each test + @api_instance = Conekta::ShippingsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ShippingsApi' do + it 'should create an instance of ShippingsApi' do + expect(@api_instance).to be_instance_of(Conekta::ShippingsApi) + end + end + + # unit tests for orders_create_shipping + # Create Shipping + # Create new shipping for an existing orden + # @param id Identifier of the resource + # @param shipping_request requested field for a shipping + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ShippingOrderResponse] + describe 'orders_create_shipping test' do + it 'should work' do + id = "ord_2tVyWPnCPWbrV37mW" + shipping_request = Conekta::ShippingRequest.new({ + amount: 500 + }) + response = @api_instance.orders_create_shipping(id, shipping_request) + + expect(response).to be_instance_of(Conekta::ShippingOrderResponse) + expect(response.parent_id).to eq(id) + expect(response.amount).to eq(shipping_request.amount) + expect(response.object).to eq("shipping_line") + end + end + + # unit tests for orders_delete_shipping + # Delete Shipping + # Delete shipping + # @param id Identifier of the resource + # @param shipping_id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ShippingOrderResponse] + describe 'orders_delete_shipping test' do + it 'should work' do + id = 'ord_2tVyWPnCPWbrV37mW' + shipping_id = 'ship_lin_2tVzNuDGSaDwreMg6' + + response = @api_instance.orders_delete_shipping(id, shipping_id) + + expect(response).to be_instance_of(Conekta::ShippingOrderResponse) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(shipping_id) + end + end + + # unit tests for orders_update_shipping + # Update Shipping + # Update existing shipping for an existing orden + # @param id Identifier of the resource + # @param shipping_id identifier + # @param shipping_request requested field for a shipping + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ShippingOrderResponse] + describe 'orders_update_shipping test' do + it 'should work' do + id = 'ord_2tVyWPnCPWbrV37mW' + shipping_id = 'ship_lin_2tVzNuDGSaDwreMg6' + shipping_request = Conekta::ShippingRequest.new({ + amount: 540 + }) + + response = @api_instance.orders_update_shipping(id, shipping_id, shipping_request) + + expect(response).to be_instance_of(Conekta::ShippingOrderResponse) + expect(response.parent_id).to eq(id) + expect(response.id).to eq(shipping_id) + expect(response.amount).to eq(shipping_request.amount) + end + end + +end diff --git a/spec/api/subscriptions_api_spec.rb b/spec/api/subscriptions_api_spec.rb new file mode 100644 index 0000000..9fddfde --- /dev/null +++ b/spec/api/subscriptions_api_spec.rb @@ -0,0 +1,177 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::SubscriptionsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'SubscriptionsApi' do + before do + # run before each test + @api_instance = Conekta::SubscriptionsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of SubscriptionsApi' do + it 'should create an instance of SubscriptionsApi' do + expect(@api_instance).to be_instance_of(Conekta::SubscriptionsApi) + end + end + + # unit tests for cancel_subscription + # Cancel Subscription + # You can cancel the subscription to stop the plans that your customers consume + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + describe 'cancel_subscription test' do + it 'should work' do + customer_id = 'cus_2tZWxbTPtQgGJGh8P' + + response = @api_instance.cancel_subscription(customer_id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::SubscriptionResponse) + expect(response.customer_id).to eq(customer_id) + expect(response.status).to eq('canceled') + expect(response.canceled_at).to eq(1679431258) + end + end + + # unit tests for create_subscription + # Create Subscription + # You can create the subscription to include the plans that your customers consume + # @param id Identifier of the resource + # @param subscription_request requested field for subscriptions + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + describe 'create_subscription test' do + it 'should work' do + customer_id = 'cus_2tXx8KUxw6311kEbs' + subscription_request = Conekta::SubscriptionRequest.new({plan_id: "contracargos-plan"}) + + response = @api_instance.create_subscription(customer_id, subscription_request) + + expect(response).to be_instance_of(Conekta::SubscriptionResponse) + expect(response.customer_id).to eq(customer_id) + expect(response.status).to eq('past_due') + expect(response.object).to eq('subscription') + expect(response.plan_id).to eq(subscription_request.plan_id) + expect(response.created_at).to eq(1679431660) + end + end + + # unit tests for get_all_events_from_subscription + # Get Events By Subscription + # You can get the events of the subscription(s) of a client, with the customer id + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionEventsResponse] + describe 'get_all_events_from_subscription test' do + it 'should work' do + + response = @api_instance.get_all_events_from_subscription('cus_2rKpeXQpapLonfVke', { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::SubscriptionEventsResponse) + expect(response.has_more).to eq(false) + end + end + + # unit tests for get_subscription + # Get Subscription + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [SubscriptionResponse] + describe 'get_subscription test' do + it 'should work' do + response = @api_instance.get_subscription('cus_2tZWxbTPtQgGJGh8P', { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::SubscriptionResponse) + expect(response.customer_id).to eq('cus_2tZWxbTPtQgGJGh8P') + expect(response.object).to eq('subscription') + end + end + + # unit tests for pause_subscription + # Pause Subscription + # You can pause the subscription to stop the plans that your customers consume + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + describe 'pause_subscription test' do + it 'should work' do + customer_id = 'cus_2tZWxbTPtQgGJGh8P' + + response = @api_instance.pause_subscription(customer_id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::SubscriptionResponse) + expect(response.customer_id).to eq(customer_id) + expect(response.status).to eq('paused') + expect(response.paused_at).to eq(1679429155) + end + end + + # unit tests for resume_subscription + # Resume Subscription + # You can resume the subscription to start the plans that your customers consume + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + describe 'resume_subscription test' do + it 'should work' do + customer_id = 'cus_2tZWxbTPtQgGJGh8P' + + response = @api_instance.resume_subscription(customer_id, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::SubscriptionResponse) + expect(response.customer_id).to eq(customer_id) + expect(response.status).to eq('active') + expect(response.paused_at).to be_nil + end + end + + # unit tests for update_subscription + # Update Subscription + # You can modify the subscription to change the plans that your customers consume + # @param id Identifier of the resource + # @param subscription_update_request requested field for update a subscription + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [SubscriptionResponse] + describe 'update_subscription test' do + it 'should work' do + customer_id = 'cus_2tZWxbTPtQgGJGh8P' + subscription_update_request = Conekta::SubscriptionUpdateRequest.new({ trial_end: 1679752328}) + + response = @api_instance.update_subscription(customer_id, subscription_update_request, { accept_language: 'es' }) + + expect(response).to be_instance_of(Conekta::SubscriptionResponse) + end + end + +end diff --git a/spec/api/taxes_api_spec.rb b/spec/api/taxes_api_spec.rb new file mode 100644 index 0000000..8930ed2 --- /dev/null +++ b/spec/api/taxes_api_spec.rb @@ -0,0 +1,110 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::TaxesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TaxesApi' do + before do + # run before each test + @api_instance = Conekta::TaxesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of TaxesApi' do + it 'should create an instance of TaxesApi' do + expect(@api_instance).to be_instance_of(Conekta::TaxesApi) + end + end + + # unit tests for orders_create_taxes + # Create Tax + # Create new taxes for an existing orden + # @param id Identifier of the resource + # @param order_tax_request requested field for a taxes + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateOrderTaxResponse] + describe 'orders_create_taxes test' do + it 'should work' do + id = 'ord_2tVyWPnCPWbrV37mW' + order_tax_request = Conekta::OrderTaxRequest.new({ + amount: 100, + description: "test", + metadata: { "key": "value" } + }) + + response = @api_instance.orders_create_taxes(id, order_tax_request) + + expect(response).to be_instance_of(Conekta::UpdateOrderTaxResponse) + expect(response.amount).to eq(100) + expect(response.description).to eq("test postman") + expect(response.parent_id).to eq(id) + expect(response.id).to be_truthy + end + end + + # unit tests for orders_delete_taxes + # Delete Tax + # Delete taxes for an existing orden + # @param id Identifier of the resource + # @param tax_id identifier + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateOrderTaxResponse] + describe 'orders_delete_taxes test' do + it 'should work' do + id = 'ord_2tVyWPnCPWbrV37mW' + tax_id = 'tax_lin_2tVzVp6AAptCRHhgt' + + response = @api_instance.orders_delete_taxes(id, tax_id) + + expect(response).to be_instance_of(Conekta::UpdateOrderTaxResponse) + expect(response.id).to eq(tax_id) + expect(response.parent_id).to eq(id) + end + end + + # unit tests for orders_update_taxes + # Update Tax + # Update taxes for an existing orden + # @param id Identifier of the resource + # @param tax_id identifier + # @param update_order_tax_request requested field for taxes + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [UpdateOrderTaxResponse] + describe 'orders_update_taxes test' do + it 'should work' do + id = 'ord_2tVyWPnCPWbrV37mW' + tax_id = 'tax_lin_2tVzVp6AAptCRHhgt' + update_order_tax_request = Conekta::UpdateOrderTaxRequest.new({amount: 99}) + + response = @api_instance.orders_update_taxes(id, tax_id, update_order_tax_request) + + expect(response).to be_instance_of(Conekta::UpdateOrderTaxResponse) + expect(response.id).to eq(tax_id) + expect(response.parent_id).to eq(id) + expect(response.amount).to eq(update_order_tax_request.amount) + end + end + +end diff --git a/spec/api/tokens_api_spec.rb b/spec/api/tokens_api_spec.rb new file mode 100644 index 0000000..a870802 --- /dev/null +++ b/spec/api/tokens_api_spec.rb @@ -0,0 +1,76 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::TokensApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TokensApi' do + before do + # run before each test + @api_instance = Conekta::TokensApi.new + end + + after do + # run after each test + end + + describe 'test an instance of TokensApi' do + it 'should create an instance of TokensApi' do + expect(@api_instance).to be_instance_of(Conekta::TokensApi) + end + end + + # unit tests for create_token + # Create Token + # Generate a payment token, to associate it with a card + # @param token requested field for token + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [TokenResponse] + describe 'create_token test' do + it 'should work' do + token = Conekta::Token.new({ + card: { + name: "Jorge López", + expMonth: "12", + expYear: "25", + cvc: "123", + number: "5475040095304607" + } + }) + + response = @api_instance.create_token(token) + + expect(response).to be_instance_of(Conekta::TokenResponse) + expect(response.id).to eq('tok_2toPJUcZ27AH5LsZk') + expect(response.used).to eq(false) + expect(response.livemode).to eq(true) + expect(response.checkout).to be_nil + end + it 'empty token' do + token = Conekta::Token.new({ + checkout: Conekta::TokenCheckout.new({returns_control_on: "Token"}) + }) + + response = @api_instance.create_token(token) + + expect(response).to be_instance_of(Conekta::TokenResponse) + expect(response.id).to eq('tok_2toNoPZpJgRU4PvgZ') + expect(response.checkout).not_to be_nil + expect(response.checkout.status).to eq('Issued') + end + end + +end diff --git a/spec/api/transactions_api_spec.rb b/spec/api/transactions_api_spec.rb new file mode 100644 index 0000000..1e7c582 --- /dev/null +++ b/spec/api/transactions_api_spec.rb @@ -0,0 +1,82 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::TransactionsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TransactionsApi' do + before do + # run before each test + @api_instance = Conekta::TransactionsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of TransactionsApi' do + it 'should create an instance of TransactionsApi' do + expect(@api_instance).to be_instance_of(Conekta::TransactionsApi) + end + end + + # unit tests for get_transaction + # Get transaction + # Get the details of a transaction + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [TransactionResponse] + describe 'get_transaction test' do + it 'should work' do + id = '6456b6dfac0fd40001a64eb8' + + response = @api_instance.get_transaction(id) + + expect(response).to be_instance_of(Conekta::TransactionResponse) + expect(response.object).to eq('transaction') + expect(response.id).to eq(id) + end + end + + # unit tests for get_transactions + # Get List transactions + # Get transaction details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetTransactionsResponse] + describe 'get_transactions test' do + it 'should work' do + response = @api_instance.get_transactions({limit: 2}) + + expect(response).to be_instance_of(Conekta::GetTransactionsResponse) + expect(response.object).to eq('list') + expect(response.has_more).to eq(true) + expect(response.next_page_url).not_to be_nil + expect(response.previous_page_url).to be_nil + expect(response.data).not_to be_nil + expect(response.data.size).to eq(2) + expect(response.data[0].id).to eq('644acceb0a49bb001b2a04aa') + expect(response.data[1].id).to eq('644ac60691882d001bec62b3') + end + end + +end diff --git a/spec/api/transfers_api_spec.rb b/spec/api/transfers_api_spec.rb new file mode 100644 index 0000000..4c0660a --- /dev/null +++ b/spec/api/transfers_api_spec.rb @@ -0,0 +1,96 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::TransfersApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'TransfersApi' do + before do + # run before each test + @api_instance = Conekta::TransfersApi.new + end + + after do + # run after each test + end + + describe 'test an instance of TransfersApi' do + it 'should create an instance of TransfersApi' do + expect(@api_instance).to be_instance_of(Conekta::TransfersApi) + end + end + + # unit tests for get_transfer + # Get Transfer + # Get the details of a Transfer + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [TransferResponse] + describe 'get_transfer test' do + it 'should work' do + id = '64462930651b2600017b6d43' + + response= @api_instance.get_transfer(id) + + expect(response).to be_instance_of(Conekta::TransferResponse) + expect(response.id).to eq(id) + expect(response.destination).not_to be_nil + expect(response.destination.type).to eq('bank_transfer') + expect(response.destination).to be_instance_of(Conekta::TransferDestinationResponse) + end + end + + # unit tests for get_transfers + # Get a list of transfers + # Get transfers details in the form of a list + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetTransfersResponse] + describe 'get_transfers test' do + it 'should work' do + limit = 5 + + response = @api_instance.get_transfers({limit: limit}) + + expect(response).to be_instance_of(Conekta::GetTransfersResponse) + expect(response.data).not_to be_nil + expect(response.data).to be_instance_of(Array) + expect(response.data.length).to eq(limit) + expect(response.data[0]).to be_instance_of(Conekta::TransfersResponse) + end + it 'with next' do + limit = 6 + _next = '6419562fdb5c8a0001e1cd61' + + response = @api_instance.get_transfers({limit: limit, _next: _next}) + + expect(response).to be_instance_of(Conekta::GetTransfersResponse) + expect(response.data).not_to be_nil + expect(response.data).to be_instance_of(Array) + expect(response.data.length).to eq(limit) + expect(response.data[0]).to be_instance_of(Conekta::TransfersResponse) + expect(response.next_page_url).not_to be_nil + expect(response.previous_page_url).not_to be_nil + end + end + +end diff --git a/spec/api/webhook_keys_api_spec.rb b/spec/api/webhook_keys_api_spec.rb new file mode 100644 index 0000000..37c3faf --- /dev/null +++ b/spec/api/webhook_keys_api_spec.rb @@ -0,0 +1,146 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::WebhookKeysApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'WebhookKeysApi' do + before do + # run before each test + @api_instance = Conekta::WebhookKeysApi.new + end + + after do + # run after each test + end + + describe 'test an instance of WebhookKeysApi' do + it 'should create an instance of WebhookKeysApi' do + expect(@api_instance).to be_instance_of(Conekta::WebhookKeysApi) + end + end + + # unit tests for create_webhook_key + # Create Webhook Key + # Create a webhook key + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [WebhookKeyRequest] :webhook_key_request + # @return [WebhookKeyCreateResponse] + describe 'create_webhook_key test' do + it 'should work' do + response = @api_instance.create_webhook_key({ webhook_key_request: Conekta::WebhookKeyRequest.new({ active: true }) }) + + expect(response).to be_instance_of(Conekta::WebhookKeyCreateResponse) + expect(response.id).to eq('645a59da22e7da0001cad283') + expect(response.livemode).to eq(true) + end + end + + # unit tests for delete_webhook_key + # Delete Webhook key + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [WebhookKeyDeleteResponse] + describe 'delete_webhook_key test' do + it 'should work' do + id = '645a59da22e7da0001cad283' + + response = @api_instance.delete_webhook_key(id) + + expect(response).to be_instance_of(Conekta::WebhookKeyDeleteResponse) + expect(response.id).to eq('645a59da22e7da0001cad283') + expect(response.deleted).to eq(true) + expect(response.active).to eq(false) + end + end + + # unit tests for get_webhook_key + # Get Webhook Key + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [WebhookKeyResponse] + describe 'get_webhook_key test' do + it 'should work' do + id = '645a5eb022e7da0001cad2a4' + + response = @api_instance.get_webhook_key(id) + + expect(response).to be_instance_of(Conekta::WebhookKeyResponse) + expect(response.id).to eq('645a5eb022e7da0001cad2a4') + expect(response.active).to eq(true) + expect(response.deactivated_at).to be_nil + end + it 'get deleted webhook key' do + id = '635594352a1979000185a36a' + + response = @api_instance.get_webhook_key(id) + + expect(response).to be_instance_of(Conekta::WebhookKeyResponse) + expect(response.id).to eq('635594352a1979000185a36a') + expect(response.active).to eq(false) + expect(response.deactivated_at).not_to be_nil + end + end + + # unit tests for get_webhook_keys + # Get List of Webhook Keys + # Consume the list of webhook keys you have + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetWebhookKeysResponse] + describe 'get_webhook_keys test' do + it 'should work' do + response = @api_instance.get_webhook_keys({limit: 2}) + + expect(response).to be_instance_of(Conekta::GetWebhookKeysResponse) + expect(response.data).to be_instance_of(Array) + expect(response.data.size).to eq(2) + expect(response.data[0].id).to eq('645a5eb022e7da0001cad2a4') + expect(response.data[0].active).to eq(true) + expect(response.data[0].deactivated_at).to be_nil + end + end + + # unit tests for update_webhook_key + # Update Webhook Key + # updates an existing webhook key + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [WebhookKeyUpdateRequest] :webhook_key_update_request + # @return [WebhookKeyResponse] + describe 'update_webhook_key test' do + it 'should work' do + id = '645a613622e7da0001cad882' + + response = @api_instance.update_webhook_key(id, { webhook_key_update_request: Conekta::WebhookKeyUpdateRequest.new({ active: false }) }) + + expect(response).to be_instance_of(Conekta::WebhookKeyResponse) + expect(response.id).to eq('645a613622e7da0001cad882') + expect(response.active).to eq(false) + expect(response.deactivated_at).not_to be_nil + end + end + +end diff --git a/spec/api/webhooks_api_spec.rb b/spec/api/webhooks_api_spec.rb new file mode 100644 index 0000000..cd51e0e --- /dev/null +++ b/spec/api/webhooks_api_spec.rb @@ -0,0 +1,152 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Conekta::WebhooksApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'WebhooksApi' do + before do + # run before each test + @api_instance = Conekta::WebhooksApi.new + end + + after do + # run after each test + end + + describe 'test an instance of WebhooksApi' do + it 'should create an instance of WebhooksApi' do + expect(@api_instance).to be_instance_of(Conekta::WebhooksApi) + end + end + + # unit tests for create_webhook + # Create Webhook + # What we do at Conekta translates into events. For example, an event of interest to us occurs at the time a payment is successfully processed. At that moment we will be interested in doing several things: Send an email to the buyer, generate an invoice, start the process of shipping the product, etc. + # @param webhook_request requested field for webhook + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [WebhookResponse] + describe 'create_webhook test' do + it 'should work' do + webhook_request = Conekta::WebhookRequest.new({ url: 'https://webhook.site/0b8c9fa8-92c3-4a04-beea-a7ec037f6466', synchronous: false }) + + response = @api_instance.create_webhook(webhook_request) + + expect(response).to be_instance_of(Conekta::WebhookResponse) + expect(response.status).to eq('listening') + expect(response.url).to eq('https://webhook.site/0b8c9fa8-92c3-4a04-beea-a7ec037f6466') + expect(response.synchronous).to eq(webhook_request.synchronous) + end + end + + # unit tests for delete_webhook + # Delete Webhook + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [WebhookResponse] + describe 'delete_webhook test' do + it 'should work' do + id = '641b1d5662d7e00001eaa46b' + + response = @api_instance.delete_webhook(id, {accept_language: 'es'}) + + expect(response).to be_instance_of(Conekta::WebhookResponse) + expect(response.id).to eq(id) + expect(response.deleted).to eq(true) + end + end + + # unit tests for get_webhook + # Get Webhook + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [WebhookResponse] + describe 'get_webhook test' do + it 'should work' do + + id = '641b1d5662d7e00001eaa46b' + + response = @api_instance.get_webhook(id, {accept_language: 'es'}) + + expect(response).to be_instance_of(Conekta::WebhookResponse) + expect(response.id).to eq(id) + end + end + + # unit tests for get_webhooks + # Get List of Webhooks + # Consume the list of webhooks you have, each environment supports 10 webhooks (For production and testing) + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 + # @option opts [String] :search General order search, e.g. by mail, reference etc. + # @option opts [String] :_next next page + # @option opts [String] :previous previous page + # @return [GetWebhooksResponse] + describe 'get_webhooks test' do + it 'should work' do + response = @api_instance.get_webhooks({accept_language: 'es', limit: 20}) + + expect(response).to be_instance_of(Conekta::GetWebhooksResponse) + expect(response.data).to be_instance_of(Array) + expect(response.data.length).to be > 0 + expect(response.data[0]).to be_instance_of(Conekta::WebhookResponse) + end + end + + # unit tests for test_webhook + # Test Webhook + # Send a webhook.ping event + # @param id Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @return [WebhookResponse] + describe 'test_webhook test' do + it 'should work' do + response = @api_instance.test_webhook('641b1d5662d7e00001eaa46b', {accept_language: 'es'}) + + expect(response).to be_instance_of(Conekta::WebhookResponse) + expect(response.id).to eq('641b1d5662d7e00001eaa46b') + end + end + + # unit tests for update_webhook + # Update Webhook + # updates an existing webhook + # @param id Identifier of the resource + # @param webhook_update_request requested fields in order to update a webhook + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [WebhookResponse] + describe 'update_webhook test' do + it 'should work' do + id = '641b1d5662d7e00001eaa46b' + + response = @api_instance.update_webhook(id, Conekta::WebhookUpdateRequest.new({ url: 'https://updated.webhook.site/0b8c9fa8-92c3-4a04-beea-a7ec037f6466', synchronous: false })) + + expect(response).to be_instance_of(Conekta::WebhookResponse) + expect(response.id).to eq(id) + expect(response.url).to eq('https://updated.webhook.site/0b8c9fa8-92c3-4a04-beea-a7ec037f6466') + expect(response.synchronous).to eq(false) + end + end + +end diff --git a/spec/api_client_spec.rb b/spec/api_client_spec.rb new file mode 100644 index 0000000..8c71e33 --- /dev/null +++ b/spec/api_client_spec.rb @@ -0,0 +1,223 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' + +describe Conekta::ApiClient do + context 'initialization' do + context 'URL stuff' do + context 'host' do + it 'removes http from host' do + Conekta.configure { |c| c.host = 'http://example.com' } + expect(Conekta::Configuration.default.host).to eq('example.com') + end + + it 'removes https from host' do + Conekta.configure { |c| c.host = 'https://wookiee.com' } + expect(Conekta::ApiClient.default.config.host).to eq('wookiee.com') + end + + it 'removes trailing path from host' do + Conekta.configure { |c| c.host = 'hobo.com/v4' } + expect(Conekta::Configuration.default.host).to eq('hobo.com') + end + end + + context 'base_path' do + it "prepends a slash to base_path" do + Conekta.configure { |c| c.base_path = 'v4/dog' } + expect(Conekta::Configuration.default.base_path).to eq('/v4/dog') + end + + it "doesn't prepend a slash if one is already there" do + Conekta.configure { |c| c.base_path = '/v4/dog' } + expect(Conekta::Configuration.default.base_path).to eq('/v4/dog') + end + + it "ends up as a blank string if nil" do + Conekta.configure { |c| c.base_path = nil } + expect(Conekta::Configuration.default.base_path).to eq('') + end + end + end + end + + + describe 'proxy in #build_connection' do + let(:config) { Conekta::Configuration.new } + let(:api_client) { Conekta::ApiClient.new(config) } + let(:proxy_uri) { URI('http://example.org:8080') } + + it 'defaults to nil' do + expect(Conekta::Configuration.default.proxy).to be_nil + expect(config.proxy).to be_nil + + connection = api_client.build_connection + expect(connection.proxy_for_request('/test')).to be_nil + end + + it 'can be customized with a string' do + config.proxy = proxy_uri.to_s + + connection = api_client.build_connection + configured_proxy = connection.proxy_for_request('/test') + + expect(configured_proxy).not_to be_nil + expect(configured_proxy.uri.to_s).to eq proxy_uri.to_s + end + + it 'can be customized with a hash' do + config.proxy = { uri: proxy_uri } + + connection = api_client.build_connection + configured_proxy = connection.proxy_for_request('/test') + + expect(configured_proxy).not_to be_nil + expect(configured_proxy.uri).to eq proxy_uri + end + end + + describe '#deserialize' do + it "handles Array" do + api_client = Conekta::ApiClient.new + headers = { 'Content-Type' => 'application/json' } + response = double('response', headers: headers, body: '[12, 34]') + data = api_client.deserialize(response, 'Array') + expect(data).to be_instance_of(Array) + expect(data).to eq([12, 34]) + end + + it 'handles Array>' do + api_client = Conekta::ApiClient.new + headers = { 'Content-Type' => 'application/json' } + response = double('response', headers: headers, body: '[[12, 34], [56]]') + data = api_client.deserialize(response, 'Array>') + expect(data).to be_instance_of(Array) + expect(data).to eq([[12, 34], [56]]) + end + + it 'handles Hash' do + api_client = Conekta::ApiClient.new + headers = { 'Content-Type' => 'application/json' } + response = double('response', headers: headers, body: '{"message": "Hello"}') + data = api_client.deserialize(response, 'Hash') + expect(data).to be_instance_of(Hash) + expect(data).to eq(:message => 'Hello') + end + end + + describe "#object_to_hash" do + it 'ignores nils and includes empty arrays' do + # uncomment below to test object_to_hash for model + # api_client = Conekta::ApiClient.new + # _model = Conekta::ModelName.new + # update the model attribute below + # _model.id = 1 + # update the expected value (hash) below + # expected = {id: 1, name: '', tags: []} + # expect(api_client.object_to_hash(_model)).to eq(expected) + end + end + + describe '#build_collection_param' do + let(:param) { ['aa', 'bb', 'cc'] } + let(:api_client) { Conekta::ApiClient.new } + + it 'works for csv' do + expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc') + end + + it 'works for ssv' do + expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc') + end + + it 'works for tsv' do + expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc") + end + + it 'works for pipes' do + expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc') + end + + it 'works for multi' do + expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc']) + end + + it 'fails for invalid collection format' do + expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID') + end + end + + describe '#json_mime?' do + let(:api_client) { Conekta::ApiClient.new } + + it 'works' do + expect(api_client.json_mime?(nil)).to eq false + expect(api_client.json_mime?('')).to eq false + + expect(api_client.json_mime?('application/json')).to eq true + expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true + expect(api_client.json_mime?('APPLICATION/JSON')).to eq true + + expect(api_client.json_mime?('application/xml')).to eq false + expect(api_client.json_mime?('text/plain')).to eq false + expect(api_client.json_mime?('application/jsonp')).to eq false + end + end + + describe '#select_header_accept' do + let(:api_client) { Conekta::ApiClient.new } + + it 'works' do + expect(api_client.select_header_accept(nil)).to be_nil + expect(api_client.select_header_accept([])).to be_nil + + expect(api_client.select_header_accept(['application/json'])).to eq('application/json') + expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + + expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml') + end + end + + describe '#select_header_content_type' do + let(:api_client) { Conekta::ApiClient.new } + + it 'works' do + expect(api_client.select_header_content_type(nil)).to be_nil + expect(api_client.select_header_content_type([])).to be_nil + + expect(api_client.select_header_content_type(['application/json'])).to eq('application/json') + expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain') + end + end + + describe '#sanitize_filename' do + let(:api_client) { Conekta::ApiClient.new } + + it 'works' do + expect(api_client.sanitize_filename('sun')).to eq('sun') + expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif') + end + end +end diff --git a/spec/conekta/1.0.0/.DS_Store b/spec/conekta/1.0.0/.DS_Store deleted file mode 100644 index 059383e..0000000 Binary files a/spec/conekta/1.0.0/.DS_Store and /dev/null differ diff --git a/spec/conekta/1.0.0/card_spec.rb b/spec/conekta/1.0.0/card_spec.rb deleted file mode 100644 index 19cc916..0000000 --- a/spec/conekta/1.0.0/card_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'spec_helper' - -describe Conekta::Card do - include_context "API 1.0.0" - let(:customer_data) do - { - email: "hola@hola.com", - name: "John Constantine", - cards: ["tok_test_visa_4242"] - } - end - - let(:customer) do - Conekta::Customer.create(customer_data) - end - - let(:card) { customer.cards.first } - - context "deleting cards" do - it "successful card delete" do - card.delete - - expect(card.deleted).to eq(true) - end - end - - context "updating cards" do - it "successful card update" do - card.update(active: false) - - expect(card.active).to eq(false) - end - - it "unsuccessful card update" do - expect { - card.update(token: "tok_test_visa_4241") - }.to raise_error(Conekta::ParameterValidationError) - end - end -end diff --git a/spec/conekta/1.0.0/charge_spec.rb b/spec/conekta/1.0.0/charge_spec.rb deleted file mode 100644 index bce875f..0000000 --- a/spec/conekta/1.0.0/charge_spec.rb +++ /dev/null @@ -1,152 +0,0 @@ -require 'spec_helper' - -describe Conekta::Charge do - include_context "API 1.0.0" - - let(:payment_method) do - { - amount: 2000, - currency: 'mxn', - description: 'Some desc', - details: { - name: "Wolverine", - email: "logan.thomas@xmen.org", - phone: "403-342-0642", - line_items: [{ - name: "Shades", - description: "Imported From Mex.", - unit_price: 20000, - quantity: 1, - sku: "cohb_s1", - category: "eyewear" - }] - } - } - end - - let(:invalid_payment_method) do - { - amount: 10, - currency: 'mxn', - description: 'Some desc', - details: { - name: "Wolverine", - email: "logan.thomas@xmen.org", - phone: "403-342-0642", - line_items: [{ - name: "Shades", - description: "Imported From Mex.", - unit_price: 20000, - quantity: 1, - sku: "cohb_s1", - category: "eyewear" - }] - } - } - end - - let(:card) { { card: 'tok_test_visa_4242' } } - - context "get" do - it "succesfully gets charge" do - transaction = Conekta::Charge.create(payment_method.merge(card)) - expect(transaction.status).to eq("paid") - charge = Conekta::Charge.find(transaction.id) - expect(charge).to be_a(Conekta::Charge) - end - - it "test succesful where" do - charges = Conekta::Charge.where - charge = charges.first - expect(charge).to be_a(Conekta::Charge) - end - it "test succesful where status 'pending_payment'" do - charges = Conekta::Charge.where({status: 'pending_payment'}) - charges.map{|index, charge| - expect(charge.status).to eq("pending_payment") - } - end - it "test succesful where status 'paid'" do - charges = Conekta::Charge.where({status: 'paid'}) - charges.map{|index, charge| - expect(charge.status).to eq("paid") - } - end - end - - context "creating charges" do - it "tests succesful bank payment" do - bank = { bank: { 'type' => 'banorte' } } - bank_payment = Conekta::Charge.create(payment_method.merge(bank)) - expect(bank_payment.status).to eq("pending_payment") - end - - it "tests succesful card payment" do - card_payment = Conekta::Charge.create(payment_method.merge(card)) - expect(card_payment.status).to eq("paid") - end - - it "tests succesful oxxo payment" do - oxxo = { cash: { 'type' => 'oxxo' } } - cash_payment = Conekta::Charge.create(payment_method.merge(oxxo)) - expect(cash_payment.status).to eq("pending_payment") - end - - it "tests succesful card payment capture" do - # pm = @valid_payment_method - # card = @valid_visa_card - capture = { capture: false } - transaction = Conekta::Charge.create( - payment_method.merge(card).merge(capture) - ) - expect(transaction.status).to eq("pre_authorized") - transaction.capture - expect(transaction.status).to eq("paid") - end - - it "test unsuccesful create" do - expect { - Conekta::Charge.create(invalid_payment_method.merge(card)) - }.to raise_error( - Conekta::ParameterValidationError, - "The minimum for card payments is 3 pesos. Check that the amount " + - "is in cents as explained in the documentation." - ) - end - end - - context "refunding charges" do - it "test susccesful refund" do - transaction = Conekta::Charge.create(payment_method.merge(card)) - expect(transaction.status).to eq("paid") - transaction.refund - expect(transaction.status).to eq("refunded") - end - - it "test unsusccesful refund" do - transaction = Conekta::Charge.create(payment_method.merge(card)) - expect(transaction.status).to eq("paid") - - expect { transaction.refund(3000) }.to raise_error( - Conekta::ProcessingError, - "The amount to refund exceeds the charge total." - ) - end - end - - context 'capturing charges' do - it 'captures an existing charge' do - amount_before_capture = 2000 - amount_after_capture = 1000 - capture = { capture: false } - transaction = Conekta::Charge.create( - payment_method.merge(card).merge(capture) - ) - expect(transaction.status).to eq('pre_authorized') - expect(transaction.amount).to be == amount_before_capture - transaction.capture(1000) - expect(transaction.amount).to be == amount_after_capture - expect(transaction.status).to eq("paid") - end - end -end diff --git a/spec/conekta/1.0.0/customer_spec.rb b/spec/conekta/1.0.0/customer_spec.rb deleted file mode 100644 index 1870095..0000000 --- a/spec/conekta/1.0.0/customer_spec.rb +++ /dev/null @@ -1,147 +0,0 @@ -require 'spec_helper' - -describe Conekta::Customer do - include_context "API 1.0.0" - let(:customer_data) { { :cards => ["tok_test_visa_4242"], email: "test@gmail.com", name: "Mario" } } - - context "creating customers" do - it "successful customer create" do - customer = Conekta::Customer.create(customer_data) - expect(customer).to be_a(Conekta::Customer) - end - - it "unsuccessful customer create" do - expect { Conekta::Customer.create( - :cards => ["tok_test_visa_4241"], - :name => "Mario", - :email => "test@gmail.com" - ) }.to raise_error( - Conekta::ParameterValidationError, - "The token does not exist." - ) - end - end - - context "getting customers" do - it "successful customer get" do - transaction = Conekta::Customer.create(customer_data) - customer = Conekta::Customer.find(transaction.id) - expect(customer).to be_a(Conekta::Customer) - end - - it "successful customer where" do - customers = Conekta::Customer.where - expect(customers.class.class_name).to eq("ConektaObject") - expect(customers.first).to be_a(Conekta::Customer) - end - end - - context "updating customers" do - it "successful customer update" do - customer = Conekta::Customer.create({ - :cards => ["tok_test_visa_4242"], - :name => "Mario", - :email => "test@gmail.com" - }) - customer.update({name: 'Logan', email: 'logan@x-men.org'}) - expect(customer.name).to eq('Logan') - end - end - - context "deleting customers" do - it "successful customer delete" do - customer = Conekta::Customer.create(customer_data) - customer.delete - expect(customer.deleted).to eq(true) - end - end - - context "adding cards" do - let!(:customer) { Conekta::Customer.create(customer_data) } - - it "add card to customer" do - card = customer.create_card(:token => 'tok_test_visa_1881') - expect(customer.cards.count).to eq(2) - expect(customer.cards.last.last4).to eq('1881') - end - - it "test delete card" do - card = customer.cards[0].delete - expect(card.deleted).to eq(true) - end - - it "test update card" do - customer.cards[0].update(token: 'tok_test_mastercard_4444', active: false) - expect(customer.cards[0].last4).to eq('4444') - end - end - - context "managing subscriptions" do - let!(:customer) { Conekta::Customer.create(customer_data) } - - context "create" do - it "test succesful create subscription" do - subscription = customer.create_subscription({plan: 'gold-plan'}) - expect(subscription.class.class_name).to eq('Subscription') - end - - it "test unsuccesful create subscription" do - expect { customer.create_subscription({plan: 'unexistent-plan'}) }.to \ - raise_error( - Conekta::ResourceNotFoundError, - 'The object Plan "unexistent-plan" could not be found.' - ) - end - end - - context "update" do - it "test succesful update subscription" do - subscription = customer.create_subscription({plan: 'gold-plan'}) - plan = find_or_create_plan('gold-plan2') - - subscription.update({plan: plan.id}) - expect(subscription.plan_id).to eq('gold-plan2') - end - end - - context "pause/resume" do - let!(:subscription) { customer.create_subscription({plan: 'gold-plan'}) } - - it "test succesful pause subscription" do - subscription.pause - expect(subscription.status).to eq('paused') - end - - it "test succesful resume subscription" do - subscription.pause - expect(subscription.status).to eq('paused') - subscription.resume - expect(subscription.status).to_not eq('paused') - end - end - - context "cancel" do - it "test succesful cancel subscription" do - subscription = customer.create_subscription({plan: 'gold-plan'}) - subscription.cancel - expect(subscription.status).to eq('canceled') - end - end - end -end - -def find_or_create_plan(plan_id) - plan = Conekta::Plan.find(plan_id) -rescue Conekta::Error => e - plan = Conekta::Plan.create({ - id: plan_id, - name: "Gold Plan", - amount: 10000, - currency: "MXN", - interval: "month", - frequency: 1, - trial_period_days: 15, - expiry_count: 12 - }) - return plan -end diff --git a/spec/conekta/1.0.0/error_spec.rb b/spec/conekta/1.0.0/error_spec.rb deleted file mode 100644 index db86ae6..0000000 --- a/spec/conekta/1.0.0/error_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'spec_helper' - -describe Conekta::Error do - include_context "API 1.0.0" - let(:card) { { cards: ["tok_test_visa_4242"] } } - - it "test no id error" do - expect { Conekta::Charge.find(nil) }.to raise_error( - Conekta::Error, "Could not get the id of Charge instance." - ) - end - - it "test no connection error" do - api_url = Conekta::api_base - Conekta::api_base = 'http://localhost:3001' - - expect { Conekta::Customer.create(card) }.to raise_error( - Conekta::NoConnectionError, "Could not connect to http://localhost:3001." - ) - - # cleanup - Conekta::api_base = api_url - end - - it "test api error" do - expect { Conekta::Customer.create({ cards: {0=>"tok_test_visa_4242"} }) }.to \ - raise_error(Conekta::ParameterValidationError) - end - - it "test authentication error" do - api_key = Conekta::api_key - Conekta::api_key = "" - expect { Conekta::Customer.create({ cards: ["tok_test_visa_4242"] }) }.to \ - raise_error(Conekta::AuthenticationError) - - # cleanup - Conekta.api_key = api_key - end - - it "test parameter validation error" do - expect { Conekta::Plan.create({id: 'gold-plan'}) }.to raise_error( - Conekta::ParameterValidationError - ) - end - - it "test processing error" do - charge = nil - charges = Conekta::Charge.where() - charges.each do |(k,v)| - if v.status == "pre_authorized" - charge = v - break - end - end - begin - if charge - charge.capture - end - rescue Conekta::Error => e - expect(e.class_name).to eq("ProcessingError") - end - end - - it "test resource not found error" do - expect { Conekta::Charge.find(1) }.to raise_error( - Conekta::ResourceNotFoundError - ) - end -end diff --git a/spec/conekta/1.0.0/event_spec.rb b/spec/conekta/1.0.0/event_spec.rb deleted file mode 100644 index d10622c..0000000 --- a/spec/conekta/1.0.0/event_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'spec_helper' - -describe Conekta::Event do - include_context "API 1.0.0" - it "test successful where" do - events = Conekta::Event.where - expect(events.class_name).to eq("ConektaObject") - expect(events[0].class_name).to eq("Event") - if !events[0].webhook_logs.empty? - expect(events[0].webhook_logs.first.class_name).to eq("WebhookLog") - end - end - - it "test successful find" do - events = Conekta::Event.where - e = events.first - - event = Conekta::Event.find(e.id) - - expect(event).to be_a(Conekta::Event) - expect(event.class_name).to eq("Event") - if !events[0].webhook_logs.empty? - expect(events[0].webhook_logs.first.class_name).to eq("WebhookLog") - end - end -end diff --git a/spec/conekta/1.0.0/log_spec.rb b/spec/conekta/1.0.0/log_spec.rb deleted file mode 100644 index 74f8cda..0000000 --- a/spec/conekta/1.0.0/log_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe Conekta::Log do - include_context "API 1.0.0" - it "test successful where" do - events = Conekta::Log.where - expect(events.class_name).to eq("ConektaObject") - expect(events[0].class_name).to eq("Log") - end - - it "test successful find" do - events = Conekta::Log.where - e = events.first - - event = Conekta::Log.find(e.id) - - expect(event).to be_a(Conekta::Log) - expect(event.class_name).to eq("Log") - end -end diff --git a/spec/conekta/1.0.0/payout_spec.rb b/spec/conekta/1.0.0/payout_spec.rb deleted file mode 100644 index c8af043..0000000 --- a/spec/conekta/1.0.0/payout_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'spec_helper' - -describe Conekta::Payout do - include_context "API 1.0.0" - let(:payee_attributes) do - { - name: "John Doe", email: "j_d@radcorp.com", phone: "555555555", - billing_address:{ - company_name: 'Rad Corp', - tax_id: 'tax121212abc', - street1: 'Guadalupe 73', - street2: 'Despacho 32', - street3: 'Condesa', - city: 'Cuauhtemoc', - state: 'DF', - country: 'MX', - zip: '06100' - } - } - end - - let(:bank_attributes) do - { - account_number: '032180000118359719', - account_holder: 'J D - Radcorp', - description: 'Conekta To JD', - statement_description: 'Conekta To JD 111111111', - statement_reference: '111111111' - } - end - - describe 'an instance' do - before do - payee = Conekta::Payee.create(payee_attributes) - payout_method = payee.create_payout_method(bank_attributes) - - @payee = Conekta::Payee.find(payee.id) - end - - it 'is created successfully' do - payout = Conekta::Payout.create( - amount: 5000, currency: "MXN", payee: @payee.id - ) - expect(payout).to be_a(Conekta::Payout) - end - - it 'can be retrieved by :id' do - transaction = Conekta::Payout.create( - amount: 5000, currency: "MXN", payee: @payee.id - ) - # refetch payout - payout = Conekta::Payout.find(transaction.id) - expect(payout).to be_a(Conekta::Payout) - end - - it 'has a :method attribute' do - expect(@payee.payout_methods.first).to be_a(Conekta::Method) - end - end -end diff --git a/spec/conekta/1.0.0/plan_spec.rb b/spec/conekta/1.0.0/plan_spec.rb deleted file mode 100644 index 6612cba..0000000 --- a/spec/conekta/1.0.0/plan_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'spec_helper' - -describe Conekta::Plan do - include_context "API 1.0.0" - context "get/where" do - it "test succesful get plan" do - plans = Conekta::Plan.where - p = plans.first; - plan = Conekta::Plan.find(p.id) - expect(plan).to be_a(Conekta::Plan) - end - - it "test succesful where" do - plans = Conekta::Plan.where - expect(plans.class_name).to eq("ConektaObject") - expect(plans.first).to be_a(Conekta::Plan) - end - end - - context "creating plans" do - it "test succesful create plan" do - plan = Conekta::Plan.create( - id: ((0...8).map { (65 + rand(26)).chr }.join), - name: "Gold Plan", - amount: 10000, - currency: "MXN", - interval: "month", - frequency: 10, - trial_period_days: 15, - expiry_count: 12 - ) - expect(plan).to be_a(Conekta::Plan) - end - end - - context "updating plans" do - it "test update plan" do - plans = Conekta::Plan.where - plan = plans.first - plan.update({name: "Silver Plan"}) - expect(plan.name).to eq("Silver Plan") - end - end - - context "deleting plans" do - it "test delete plan" do - plans = Conekta::Plan.where - plan = plans.first - plan.delete - expect(plan.deleted).to eq(true) - end - end -end diff --git a/spec/conekta/1.0.0/token_spec.rb b/spec/conekta/1.0.0/token_spec.rb deleted file mode 100644 index 8c2d8f1..0000000 --- a/spec/conekta/1.0.0/token_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe Conekta::Token do - include_context "API 1.0.0" -end diff --git a/spec/conekta/1.0.0/webhook_spec.rb b/spec/conekta/1.0.0/webhook_spec.rb deleted file mode 100644 index 468d377..0000000 --- a/spec/conekta/1.0.0/webhook_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -require 'spec_helper' - -describe Conekta::Webhook do - include_context "API 1.0.0" - let!(:events) do - { - events: [ - "charge.created", "charge.paid", "charge.under_fraud_review", - "charge.fraudulent", "charge.refunded", "charge.created", "customer.created", - "customer.updated", "customer.deleted", "webhook.created", "webhook.updated", - "webhook.deleted", "charge.chargeback.created", "charge.chargeback.updated", - "charge.chargeback.under_review", "charge.chargeback.lost", "charge.chargeback.won", - "payout.created", "payout.retrying", "payout.paid_out", "payout.failed", - "plan.created", "plan.updated", "plan.deleted", "subscription.created", - "subscription.paused", "subscription.resumed", "subscription.canceled", - "subscription.expired", "subscription.updated", "subscription.paid", - "subscription.payment_failed", "payee.created", "payee.updated", - "payee.deleted", "payee.payout_method.created", - "payee.payout_method.updated", "payee.payout_method.deleted" - ] - } - end - let(:url) { { url: "http://localhost:3000/my_listener" } } - - # This spec was commented to avoid webhook creation saturation. - # - # it "succesfully gets charge" do - # webhook = Conekta::Webhook.create(url.merge(events)) - # expect(webhook.url).to eq(url[:url]) - # webhook = Conekta::Webhook.find(webhook.id) - # expect(webhook.url).to eq(url[:url]) - # webhook.update({url: "http://localhost:2000/my_listener"}) - # expect(webhook.url).to eq("http://localhost:2000/my_listener") - # webhook.delete - # end -end diff --git a/spec/conekta/2.0.0/checkout_spec.rb b/spec/conekta/2.0.0/checkout_spec.rb deleted file mode 100644 index 6706a51..0000000 --- a/spec/conekta/2.0.0/checkout_spec.rb +++ /dev/null @@ -1,224 +0,0 @@ -require "spec_helper" - -describe Conekta::Checkout do - include_context "API 2.0.0" - - before(:each) do - if Conekta.api_base == "https://api.conekta.io" - skip("This test should be run in staging.") - end - end - - let(:customer_info) do - { - name: "John Constantine", - phone: "4493424352", - email: "hola@hola.com", - } - end - - let(:line_items) do - [{ - name: "Box of Cohiba S1s", - unit_price: 35000, - quantity: 1, - }] - end - - let(:msi_enabled) do - { - monthly_installments_enabled: true, - monthly_installments_options: [3, 6, 12], - } - end - - let(:recurrent) do - { - recurrent: true, - payments_limit_count: 10, - } - end - - let(:order_template) do - { - currency: "MXN", - line_items: line_items, - customer_info: customer_info, - metadata: { - "mycustomkey": "12345", - "othercustomkey": "abcde", - }, - } - end - - let(:order_template_no_customer) do - { - currency: "MXN", - line_items: line_items, - metadata: { - "mycustomkey": "12345", - "othercustomkey": "abcde", - }, - } - end - - let(:checkout_data) do - { - name: "Payment Link Name", - type: "PaymentLink", - recurrent: false, - expired_at: (Time.now + 259200).to_i, - allowed_payment_methods: ["cash", "card", "bank_transfer"], - needs_shipping_contact: false, - order_template: order_template, - } - end - - let(:checkout_data_no_customer) do - { - name: "Payment Link Name", - type: "PaymentLink", - recurrent: false, - expired_at: (Time.now + 259200).to_i, - allowed_payment_methods: ["cash", "card", "bank_transfer"], - needs_shipping_contact: false, - order_template: order_template_no_customer, - } - end - - let(:checkout_invalid_expired_at) do - { - name: "Payment Link Name", - type: "PaymentLink", - recurrent: false, - expired_at: (Time.now + 3600).to_i, - allowed_payment_methods: ["cash", "card", "bank_transfer"], - needs_shipping_contact: false, - order_template: order_template, - } - end - - let(:checkout_data_with_msi) do - checkout_data.merge(msi_enabled) - end - - let(:checkout_data_recurrent) do - checkout_data_no_customer.merge(recurrent) - end - - context "creating payment link" do - it "successful checkout create" do - checkout = Conekta::Checkout.create(checkout_data) - - expect(checkout).to be_a(Conekta::Checkout) - expect(checkout.id).not_to eq("") - expect(checkout.id.length).to eq(36) - expect(checkout.type).to eq("PaymentLink") - expect(checkout.livemode).to eq(false) - expect(checkout.needs_shipping_contact).to eq(false) - expect(checkout.monthly_installments_enabled).to eq(false) - expect(checkout.slug).not_to eq("") - expect(checkout.url).not_to eq("") - end - - it "unsuccessful checkout create" do - expect { - Conekta::Checkout.create({}) - }.to raise_error(Conekta::ParameterValidationError) - end - - it "unsuccessful checkout expired at create" do - expect { - Conekta::Checkout.create(checkout_invalid_expired_at) - }.to raise_error(Conekta::ParameterValidationError) - end - - it "successful with monthly installments enabled" do - checkout = Conekta::Checkout.create(checkout_data_with_msi) - - expect(checkout).to be_a(Conekta::Checkout) - expect(checkout.id).not_to eq("") - expect(checkout.id.length).to eq(36) - expect(checkout.type).to eq("PaymentLink") - expect(checkout.livemode).to eq(false) - expect(checkout.needs_shipping_contact).to eq(false) - expect(checkout.monthly_installments_enabled).to eq(true) - expect(checkout.monthly_installments_options.length).to eq(3) - expect(checkout.slug).not_to eq("") - expect(checkout.url).not_to eq("") - end - - it "successful with recurrent" do - checkout = Conekta::Checkout.create(checkout_data_recurrent) - - expect(checkout).to be_a(Conekta::Checkout) - expect(checkout.id).not_to eq("") - expect(checkout.id.length).to eq(36) - expect(checkout.type).to eq("PaymentLink") - expect(checkout.livemode).to eq(false) - expect(checkout.needs_shipping_contact).to eq(false) - expect(checkout.recurrent).to eq(true) - expect(checkout.payments_limit_count).to eq(10) - expect(checkout.slug).not_to eq("") - expect(checkout.url).not_to eq("") - end - end - - context "get" do - it "successfully gets checkout" do - id = Conekta::Checkout.create(checkout_data).id - - checkout = Conekta::Checkout.find(id) - - expect(checkout).to be_a(Conekta::Checkout) - end - - it "test successful checkout where" do - checkouts = Conekta::Checkout.where - - expect(checkouts).to be_a(Conekta::List) - expect(checkouts.elements_type).to eq("Checkout") - expect(checkouts.first).to be_a(Conekta::Checkout) - end - end - - context "notifications with payment link" do - it "unsuccessful send a checkout sms" do - expect { - checkout = Conekta::Checkout.create(checkout_data) - expect(checkout.sms_sent).to eq(0) - - checkout.send_sms({ - "phone": "5555555555", - }) - }.to raise_error(Conekta::ProcessingError) - end - - it "successfully send a checkout email" do - checkout = Conekta::Checkout.create(checkout_data) - expect(checkout.emails_sent).to eq(0) - - checkout.send_email({ - "email": "test@mail.com", - }) - - checkoutFound = Conekta::Checkout.find(checkout.id) - expect(checkoutFound.emails_sent).to eq(1) - end - end - - context "cancel checkout request" do - it "successful cancel a checkout" do - checkout = Conekta::Checkout.create(checkout_data) - id = checkout.id - expect(checkout.status).to eq("Issued") - - checkout.cancel({ - "id": id, - }) - - checkoutFound = Conekta::Checkout.find(id) - expect(checkoutFound.status).to eq("Cancelled") - end - end -end diff --git a/spec/conekta/2.0.0/customer_spec.rb b/spec/conekta/2.0.0/customer_spec.rb deleted file mode 100644 index 7005a0d..0000000 --- a/spec/conekta/2.0.0/customer_spec.rb +++ /dev/null @@ -1,77 +0,0 @@ -require 'spec_helper' - -describe Conekta::Customer do - include_context "API 2.0.0" - context "updating customers" do - context "creating submodels" do - include_context "customer" - - let(:customer) { Conekta::Customer.create(customer_data) } - - let(:customer_oxxo) { - { - payment_sources: [{ - type: 'oxxo_recurrent', - expires_at: (Time.now + 60 * 60 * 24 * 30).to_i - }], - email: 'test@gmail.com', - name: 'Mario' - } - } - - let(:oxxo_source_params) do - { - type: 'oxxo_recurrent', - expires_at: (Time.now + 60 * 60 * 24 * 30).to_i - } - end - - let(:source_params) do - { - type: "card", - token_id: "tok_test_visa_4242" - } - end - - let(:shipping_contact_params) do - { - email: "rogue@xmen.org", - phone: "+5213353319758", - receiver: "Test Conekta", - address: { - street1: "250 Alexis St", - city: "Red Deer", - state: "Alberta", - country: "CA", - postal_code: "T4N 0B8", - } - } - end - - it "successfully creates source for customer" do - customer = Conekta::Customer.create(customer_oxxo) - source = customer.payment_sources.first - - expect(source.class.to_s).to eq('Conekta::PaymentSource') - expect(customer.payment_sources.class.to_s).to eq('Conekta::List') - expect(source.reference.size).to eq(14) - end - - it 'successfully creates oxxo recurrent reference for customer' do - source = customer.create_offline_recurrent_reference(oxxo_source_params) - - expect(source.class.to_s).to eq("Conekta::PaymentSource") - expect(customer.payment_sources.class.to_s).to eq("Conekta::List") - expect(source.reference.size).to eq(14) - end - - it "successfully creates shipping contact for customer" do - shipping_contact = - customer.create_shipping_contact(shipping_contact_params) - - expect(shipping_contact.class.to_s).to eq("Conekta::ShippingContact") - expect(customer.shipping_contacts.class.to_s).to eq("Conekta::List") - end - end - end -end diff --git a/spec/conekta/2.0.0/discount_line_spec.rb b/spec/conekta/2.0.0/discount_line_spec.rb deleted file mode 100644 index 8bca3aa..0000000 --- a/spec/conekta/2.0.0/discount_line_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'spec_helper' - -describe Conekta::DiscountLine do - include_context "API 2.0.0" - include_context "order" - - let(:discount_lines) do - [ - { - code: "Cupon de descuento", - type: "loyalty", - amount: 10 - }, - { - code: "Cupon de descuento", - type: "loyalty", - amount: 5 - } - ] - end - - let(:order) do - Conekta::Order.create(order_data.merge(discount_lines: discount_lines)) - end - - let(:discount_line) { order.discount_lines.first } - - context "deleting discount lines" do - it "successful discount line delete" do - discount_line.delete - - expect(discount_line.deleted).to eq(true) - end - end - - context "updating discount lines" do - it "successful discount line update" do - discount_line.update(amount: 11) - - expect(discount_line.amount).to eq(11) - end - - it "unsuccessful discount line update" do - expect { - discount_line.update(amount: -1) - }.to raise_error(Conekta::ParameterValidationError) - end - end -end diff --git a/spec/conekta/2.0.0/error_spec.rb b/spec/conekta/2.0.0/error_spec.rb deleted file mode 100644 index 18b8366..0000000 --- a/spec/conekta/2.0.0/error_spec.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'spec_helper' - -describe Conekta::Error do - include_context "API 2.0.0" - - let(:card) { { cards: ["tok_test_visa_4242"] } } - - it "test no id error" do - expect{ - Conekta::Customer.find(nil) - }.to raise_error(Conekta::Error) - end - - it "test no connection error" do - api_url = Conekta::api_base - Conekta::api_base = 'http://localhost:3001' - - expect{ - Conekta::Customer.create(card) - }.to raise_error(Conekta::NoConnectionError) - - # cleanup - Conekta::api_base = api_url - end - - it "test api error" do - expect{ - Conekta::Customer.create({ - cards: { - 0 => "tok_test_visa_4242" - } - }) - }.to raise_error(Conekta::ParameterValidationError) - end - - it "test parameter validation error" do - expect{ - Conekta::Order.create({}) - }.to raise_error(Conekta::ParameterValidationError) - end - - it "test resource not found error" do - expect{ - Conekta::Order.find(1) - }.to raise_error(Conekta::ResourceNotFoundError) - end - - it "test authentication error" do - api_key = Conekta::api_key - Conekta::api_key = "" - - expect{ - Conekta::Customer.create({ - cards: ["tok_test_visa_4242"] - }) - }.to raise_error(Conekta::AuthenticationError) - - # cleanup - Conekta::api_key = api_key - end -end diff --git a/spec/conekta/2.0.0/line_item_spec.rb b/spec/conekta/2.0.0/line_item_spec.rb deleted file mode 100644 index b420903..0000000 --- a/spec/conekta/2.0.0/line_item_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'spec_helper' - -describe Conekta::LineItem do - include_context "API 2.0.0" - - let(:line_items) do - [{ - name: "Box of Cohiba S1s", - description: "Imported From Mex.", - unit_price: 35000, - quantity: 1, - tags: ["food", "mexican food"] - }, - { - name: "Other item", - description: "other description", - unit_price: 35000, - quantity: 1, - tags: ["food"] - }] - end - let(:order_data) do - { - currency: 'mxn', - line_items: line_items - } - end - let(:order) { Conekta::Order.create(order_data) } - let(:line_item) { order.line_items.first } - - context "deleting line items" do - it "successful line item delete" do - line_item.delete - - expect(line_item.deleted).to eq(true) - end - end - - context "updating line items" do - it "successful line item update" do - line_item.update(unit_price: 1000) - - expect(line_item.unit_price).to eq(1000) - end - - it "unsuccessful line item update" do - expect { - line_item.update(description: nil) - }.to raise_error(Conekta::ParameterValidationError) - end - end - -end diff --git a/spec/conekta/2.0.0/list_spec.rb b/spec/conekta/2.0.0/list_spec.rb deleted file mode 100644 index e0675b9..0000000 --- a/spec/conekta/2.0.0/list_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'spec_helper' - -describe Conekta::List do - - include_context "API 2.0.0" - - let(:list) do - response = JSON.parse(File.read("spec/support/fixtures/orders.json")) - order_list = Conekta::List.new("Order",response) - order_list.load_from(response) - order_list - end - - context "moving cursor" do - it "moves cursor forward" do - window = Conekta::Order.where({"limit" => 5, "next" => list[9].id}) - expect(window.first.id).to eq(list[10].id) - window.next(limit: 1) - expect(window.first.id).to eq(list[15].id) - end - - it "moves cursor backwards" do - window = Conekta::Order.where({"limit" => 5, "next" => list[14].id}) - expect(window.first.id).to eq(list[15].id) - window.previous(limit: 1) - expect(window.first.id).to eq(list[14].id) - end - end -end diff --git a/spec/conekta/2.0.0/order_spec.rb b/spec/conekta/2.0.0/order_spec.rb deleted file mode 100644 index 950db9c..0000000 --- a/spec/conekta/2.0.0/order_spec.rb +++ /dev/null @@ -1,376 +0,0 @@ -require "spec_helper" - -describe Conekta::Order do - include_context "API 2.0.0" - - let(:customer_info) do - { - name: "John Constantine", - phone: "3353319758", - email: "hola@hola.com", - } - end - - let(:customer_data) do - { - email: "hola@hola.com", - name: "John Constantine", - cards: ["tok_test_visa_4242"], - } - end - - let(:charges) do - [{ - payment_method: { - type: "oxxo_cash", - expires_at: (Time.now + 3600).to_i, - }, - amount: 35000, - }] - end - - let(:card_charges) do - [{ - payment_method: { - type: "card", - token_id: "tok_test_visa_4242", - }, - amount: 35000, - }] - end - - let(:line_items) do - [{ - name: "Box of Cohiba S1s", - description: "Imported From Mex.", - unit_price: 35000, - quantity: 1, - tags: ["food", "mexican food"], - }] - end - - let(:msi_enabled) do - { - monthly_installments_enabled: true, - monthly_installments_options: [3, 6, 12], - } - end - - let(:save_card_in_checkout) do - { - on_demand_enabled: true, - } - end - - let(:checkout_data) do - { - expired_at: (Time.now + 259200).to_i, - allowed_payment_methods: ["cash", "card", "bank_transfer"], - } - end - - let(:checkout_msi) do - checkout_data.merge(msi_enabled) - end - - let(:checkout_save_card) do - checkout_data.merge(save_card_in_checkout) - end - - let(:order_data) do - { - currency: "mxn", - line_items: line_items, - metadata: { - test: true, - }, - } - end - - let(:order_data_with_charges) do - order_data.merge(charges: charges) - end - - let(:order_data_with_card_charges) do - order_data.merge(charges: card_charges) - end - - let(:order_data_with_checkout) do - order_data.merge(checkout: checkout_data) - end - - let(:order_data_with_checkout_msi) do - order_data.merge(checkout: checkout_msi) - end - - let(:order_data_with_checkout_save_card) do - order_data.merge(checkout: checkout_save_card) - end - - context "creating orders" do - it "successful order create" do - order = Conekta::Order.create(order_data) - - expect(order).to be_a(Conekta::Order) - expect(order.metadata["test"]).to eq(true) - end - - it "unsuccessful order create" do - expect { - Conekta::Order.create({}) - }.to raise_error(Conekta::ParameterValidationError) - end - - context "with charges" do - it "successful order create" do - order = Conekta::Order.create(order_data_with_charges. - merge(customer_info: customer_info)) - - expect(order).to be_a(Conekta::Order) - end - - context "unsuccessful order create" do - it "with missing customer_info and customer_id" do - expect { - Conekta::Order.create(order_data_with_charges) - }.to raise_error(Conekta::ParameterValidationError) - end - end - end - - context "with checkout components" do - before(:each) do - if Conekta.api_base == "https://api.conekta.io" - skip("This test should be run in staging.") - end - end - - it "successful order create" do - order = Conekta::Order.create(order_data_with_checkout. - merge(customer_info: customer_info)) - - expect(order).to be_a(Conekta::Order) - expect(order.checkout.class.to_s).to eq("Conekta::Checkout") - expect(order.checkout.id).not_to eq("") - expect(order.checkout.type).to eq("Integration") - expect(order.checkout.monthly_installments_enabled).to eq(false) - end - - context "with checkout components monthly installments create" do - it "with missing customer_info and customer_id" do - order = Conekta::Order.create(order_data_with_checkout_msi. - merge(customer_info: customer_info)) - - expect(order).to be_a(Conekta::Order) - expect(order.checkout.class.to_s).to eq("Conekta::Checkout") - expect(order.checkout.id).not_to eq("") - expect(order.checkout.type).to eq("Integration") - expect(order.checkout.monthly_installments_enabled).to eq(true) - end - end - - context "with checkout components save card create" do - it "with missing customer_info and customer_id" do - order = Conekta::Order.create(order_data_with_checkout_save_card. - merge(customer_info: customer_info)) - - expect(order).to be_a(Conekta::Order) - expect(order.checkout.class.to_s).to eq("Conekta::Checkout") - expect(order.checkout.id).not_to eq("") - expect(order.checkout.type).to eq("Integration") - expect(order.checkout.on_demand_enabled).to eq(true) - end - end - end - end - - context "updating orders" do - let(:order) { Conekta::Order.create(order_data) } - - it "successful order update" do - order.update(charges: charges, customer_info: customer_info) - - expect(order.charges).not_to be_empty - end - - it "unsuccessful order update" do - expect { - order.update(charges: charges) - }.to raise_error(Conekta::ParameterValidationError) - end - end - - context "creating submodels" do - let(:line_item_params) do - { - name: "Box of Cohiba S1s", - description: "Imported From Mex.", - unit_price: 35000, - quantity: 1, - tags: ["food", "mexican food"], - } - end - - let(:tax_line_params) do - { - description: "IVA", - amount: 600, - } - end - - let(:shipping_line_params) do - { - description: "Otro Shipping", - amount: 40, - tracking_number: "TRACK124", - carrier: "USPS", - method: "Train", - } - end - - let(:discount_line_params) do - { - code: "Cupon de descuento", - type: "loyalty", - amount: 10, - } - end - - let(:charge_params) do - { - payment_method: { - type: "oxxo_cash", - expires_at: (Time.now + 3600).to_i, - }, - amount: 35000, - } - end - - let(:shipping_contact_params) do - { - id: "1jap4jmcjnwh34", - email: "thomas.logan@xmen.org", - phone: "+5213353319758", - receiver: "Marvin Fuller", - between_streets: "Ackerman Crescent", - address: { - street1: "250 Alexis St", - city: "Red Deer", - state: "Alberta", - country: "MX", - postal_code: "78219", - residential: true, - }, - } - end - - let(:order) { Conekta::Order.create(order_data) } - - it "successfully creates charge for order" do - other_params = { - currency: "mxn", - customer_info: { - name: "John Constantine", - phone: "+5213353319758", - email: "hola@hola.com", - }, - } - - order = Conekta::Order.create(order_data.merge(other_params)) - charge = order.create_charge(charge_params) - - expect(charge.class.to_s).to eq("Conekta::Charge") - expect(order.charges.class.to_s).to eq("Conekta::List") - end - - it "successfully creates line item for order" do - line_item = order.create_line_item(line_item_params) - - expect(line_item.class.to_s).to eq("Conekta::LineItem") - expect(order.line_items.class.to_s).to eq("Conekta::List") - end - - it "successfully creates tax line for order" do - tax_line = order.create_tax_line(tax_line_params) - new_tax_line = order.create_tax_line(description: "ISR", amount: 2) - - expect(tax_line.class.to_s).to eq("Conekta::TaxLine") - expect(order.tax_lines.class.to_s).to eq("Conekta::List") - expect(order.tax_lines.total).to eq(2) - end - - it "successfully creates shipping line for order" do - shipping_line = order.create_shipping_line(shipping_line_params) - - expect(shipping_line.class.to_s).to eq("Conekta::ShippingLine") - expect(order.shipping_lines.class.to_s).to eq("Conekta::List") - end - - it "successfully creates discount line for order" do - discount_line = order.create_discount_line(discount_line_params) - - discount_line.update({ amount: 1000 }) - - expect(discount_line.class.to_s).to eq("Conekta::DiscountLine") - expect(order.discount_lines.class.to_s).to eq("Conekta::List") - end - - it "successfully create shipping contact for order" do - shipping_contact = order.create_shipping_contact(shipping_contact_params) - - expect(shipping_contact.class.to_s).to eq("Conekta::ShippingContact") - end - end - - context "get" do - it "successfully gets order" do - id = Conekta::Order.create(order_data).id - - order = Conekta::Order.find(id) - - expect(order).to be_a(Conekta::Order) - end - - it "test successful where" do - orders = Conekta::Order.where - - expect(orders).to be_a(Conekta::List) - expect(orders.elements_type).to eq("Order") - expect(orders.first).to be_a(Conekta::Order) - end - end - - it "successfully captures an order" do - order = Conekta::Order.create(order_data_with_card_charges. - merge(customer_info: customer_info, pre_authorize: true)) - expect(order.payment_status).to eq("pre_authorized") - - order.authorize_capture - - expect(order.payment_status).to eq("paid") - end - - context "refund" do - let(:order_refund) do - { - amount: 35000, - reason: "requested_by_client", - } - end - - it "test successful refund" do - order = Conekta::Order.create(order_data_with_card_charges. - merge(customer_info: customer_info). - merge(line_items: line_items)) - begin - order.refund(order_refund) - rescue Exception => e - puts e.details.map { |d| d.message } - end - - refunded_order = Conekta::Order.find(order.id) - - expect(refunded_order.payment_status).to eq("refunded") - end - end -end diff --git a/spec/conekta/2.0.0/payee_spec.rb b/spec/conekta/2.0.0/payee_spec.rb deleted file mode 100644 index 2f08ff1..0000000 --- a/spec/conekta/2.0.0/payee_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -require 'spec_helper' -# require 'conekta' - -describe Conekta::Payee do - include_context "API 2.0.0" - - describe 'an instance' do - let(:payee_attributes) do - { - name: "John Doe", email: "j_d@radcorp2.com", phone: "555555555", - billing_address:{ - company_name: 'Rad Corp', - tax_id: 'tax121212abc', - street1: 'Guadalupe 73', - street2: 'Despacho 32', - street3: 'Condesa', - city: 'Cuauhtemoc', - state: 'DF', - country: 'MX', - postal_code: '06100' - } - } - end - - it 'creates successfully' do - payee = Conekta::Payee.create(payee_attributes) - expect(payee).to be_a(Conekta::Payee) - end - - describe ':payout_methods' do - let!(:payee) { Conekta::Payee.create(payee_attributes) } - let(:bank_attributes) do - { - type: "bank_account", - account_number: '072225008217746674', - account_holder_name: 'J D - Radcorp' - } - end - - it 'can create payout methods' do - payout_method = payee.create_destination(bank_attributes) - expect(payout_method).to be_a(Conekta::Destination) - # I'm sure this should be a Conekta::PayoutMethod, - # just not sure why it's reporting back as a Conekta::Method - end - - it 'assigns default_payout_method_id to first payout method created' do - payout_method = payee.create_destination(bank_attributes) - # refetch the payee object - payee = Conekta::Payee.find(payout_method.payee_id) - expect(payee.default_destination_id).to eq(payout_method.id) - end - end - end -end diff --git a/spec/conekta/2.0.0/shipping_contact_spec.rb b/spec/conekta/2.0.0/shipping_contact_spec.rb deleted file mode 100644 index acb16a5..0000000 --- a/spec/conekta/2.0.0/shipping_contact_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'spec_helper' - -describe Conekta::ShippingContact do - include_context "API 2.0.0" - include_context "customer" - - let(:shipping_contacts) do - [{ - receiver: "John Williams", - phone: "+5213353319758", - address: { - street1: "250 Alexis St", - city: "Red Deer", - state: "Alberta", - country: "CA", - postal_code: "T4N 0B8", - } - }, - { - receiver: "John Williams", - phone: "+5213353319758", - address: { - street1: "250 Alexis St", - city: "Red Deer", - state: "Alberta", - country: "CA", - postal_code: "T4N 0B8", - } - }] - end - - let(:customer) do - Conekta::Customer.create(customer_data. - merge(shipping_contacts: shipping_contacts)) - end - - let(:shipping_contact) { customer.shipping_contacts.first } - - context "deleting shipping contacts" do - it "successful shipping contact delete" do - shipping_contact.delete - - expect(shipping_contact.deleted).to eq(true) - end - end - - context "updating shipping contacts" do - it "successful shipping contact update" do - shipping_contact.update(receiver: "Mario Moreno") - - expect(shipping_contact.receiver).to eq("Mario Moreno") - end - - it "unsuccessful shipping contact update" do - expect { - shipping_contact.update(receiver: 123) - }.to raise_error(Conekta::Error) - end - end -end diff --git a/spec/conekta/2.0.0/shipping_line_spec.rb b/spec/conekta/2.0.0/shipping_line_spec.rb deleted file mode 100644 index e183730..0000000 --- a/spec/conekta/2.0.0/shipping_line_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'spec_helper' - -describe Conekta::ShippingLine do - include_context "API 2.0.0" - include_context "order" - - let(:shipping_lines) do - [ - { - description: "Free Shipping", - amount: 0, - tracking_number: "TRACK123", - carrier: "USPS", - method: "Train", - }, - { - description: "Otro Shipping", - amount: 40, - tracking_number: "TRACK124", - carrier: "USPS", - method: "Train", - } - ] - end - - let(:order) do - Conekta::Order.create(order_data.merge(shipping_lines: shipping_lines)) - end - - let(:shipping_line) { order.shipping_lines.first } - - context "deleting shipping lines" do - it "successful shipping line delete" do - shipping_line.delete - - expect(shipping_line.deleted).to eq(true) - end - end - - context "updating shipping lines" do - it "successful shipping line update" do - shipping_line.update(method: "Air") - - expect(shipping_line._method).to eq("Air") - end - - it "unsuccessful shipping line update" do - expect { - shipping_line.update(amount: -1) - }.to raise_error(Conekta::ParameterValidationError) - end - end -end diff --git a/spec/conekta/2.0.0/source_spec.rb b/spec/conekta/2.0.0/source_spec.rb deleted file mode 100644 index 7e3d806..0000000 --- a/spec/conekta/2.0.0/source_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'spec_helper' - -describe Conekta::PaymentSource do - include_context "API 2.0.0" - include_context "customer" - - let(:customer) { Conekta::Customer.create(customer_data) } - let(:payment_source) { customer.payment_sources.first } - - context "deleting payment_sources" do - it "successful source delete" do - payment_source.delete - - expect(payment_source.deleted).to eq(true) - end - end - - context "updating payment_sources" do - it "successful payment_source update" do - payment_source.update(exp_month: 12) - - expect(payment_source.exp_month).to eq("12") - end - - it "unsuccessful payment_source update" do - expect { - payment_source.update(token_id: "tok_test_visa_4241") - }.to raise_error(Conekta::ParameterValidationError) - end - end -end diff --git a/spec/conekta/2.0.0/tax_line_spec.rb b/spec/conekta/2.0.0/tax_line_spec.rb deleted file mode 100644 index 37893d0..0000000 --- a/spec/conekta/2.0.0/tax_line_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'spec_helper' - -describe Conekta::TaxLine do - include_context "API 2.0.0" - include_context "order" - - let(:tax_lines) do - [ - { - description: "IVA", - amount: 600 - }, - { - description: "ISR", - amount: 100 - } - ] - end - - let(:order) { Conekta::Order.create(order_data.merge(tax_lines: tax_lines)) } - let(:tax_line) { order.tax_lines.first } - - context "deleting tax lines" do - it "successful tax line delete" do - tax_line.delete - - expect(tax_line.deleted).to eq(true) - end - end - - context "updating tax lines" do - it "successful tax line update" do - tax_line.update(amount: 50) - - expect(tax_line.amount).to eq(50) - end - - it "unsuccessful tax line update" do - expect { - tax_line.update(amount: -1) - }.to raise_error(Conekta::Error) - end - end -end diff --git a/spec/conekta/2.0.0/transfer_spec.rb b/spec/conekta/2.0.0/transfer_spec.rb deleted file mode 100644 index 3ff884b..0000000 --- a/spec/conekta/2.0.0/transfer_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -require 'spec_helper' - -describe Conekta::Payout do - include_context "API 2.0.0" - - let(:payee_attributes) do - { - name: "John Doe", email: "j_d@radcorp.com", phone: "555555555", - billing_address:{ - company_name: 'Rad Corp', - tax_id: 'tax121212abc', - street1: 'Guadalupe 73', - street2: 'Despacho 32', - street3: 'Condesa', - city: 'Cuauhtemoc', - state: 'DF', - country: 'MX', - zip: '06100' - } - } - end - - let(:bank_attributes) do - { - type: "bank_account", - account_number: '072225008217746674', - account_holder_name: 'J D - Radcorp' - } - end - - describe 'an instance' do - before do - payee = Conekta::Payee.create(payee_attributes) - payout_method = payee.create_destination(bank_attributes) - - @payee = Conekta::Payee.find(payee.id) - end - - it 'is created successfully' do - payout = Conekta::Transfer.create( - amount: 5000, currency: "MXN", payee: @payee.id - ) - expect(payout).to be_a(Conekta::Transfer) - end - - it 'can be retrieved by :id' do - transaction = Conekta::Transfer.create( - amount: 5000, currency: "MXN", payee: @payee.id - ) - # refetch payout - payout = Conekta::Transfer.find(transaction.id) - expect(payout).to be_a(Conekta::Transfer) - end - - it 'has a :method attribute' do - expect(@payee.destinations.first).to be_a(Conekta::Destination) - end - end -end diff --git a/spec/conekta_spec.rb b/spec/conekta_spec.rb deleted file mode 100644 index eb89f22..0000000 --- a/spec/conekta_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'spec_helper' - -describe Conekta do - describe ".config" do - it "sets the api key initializer style" do - Conekta.config { |c| c.api_key = "abc" } - - expect(Conekta.api_key).to eq("abc") - end - - it "sets the api version initializer style" do - Conekta.config { |c| c.api_version = "1.0" } - - expect(Conekta.api_version).to eq("1.0") - end - - it "sets the api locale initializer style" do - Conekta.config { |c| c.locale = "es" } - - expect(Conekta.locale).to eq("es") - end - - it "sets the plugin initializer style" do - Conekta.config { |c| c.plugin = "spree" } - - expect(Conekta.plugin).to eq("spree") - end - end -end diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb new file mode 100644 index 0000000..c667028 --- /dev/null +++ b/spec/configuration_spec.rb @@ -0,0 +1,82 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'spec_helper' + +describe Conekta::Configuration do + let(:config) { Conekta::Configuration.default } + + before(:each) do + # uncomment below to setup host and base_path + # require 'URI' + # uri = URI.parse("https://api.conekta.io") + # Conekta.configure do |c| + # c.host = uri.host + # c.base_path = uri.path + # end + end + + describe '#base_url' do + it 'should have the default value' do + # uncomment below to test default value of the base path + # expect(config.base_url).to eq("https://api.conekta.io") + end + + it 'should remove trailing slashes' do + [nil, '', '/', '//'].each do |base_path| + config.base_path = base_path + # uncomment below to test trailing slashes + # expect(config.base_url).to eq("https://api.conekta.io") + end + end + end + + describe '#configure_faraday_connection' do + let(:faraday_connection) { Faraday::Connection.new } + + before do + stub_const('CustomAdapter', Class.new(Faraday::Adapter)) + stub_const('AnotherCustomAdapter', Class.new(Faraday::Adapter)) + + config.configure_faraday_connection do |conn| + conn.adapter CustomAdapter + conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger| + logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]') + end + end + end + + it 'adds a block that will be used to configure the connection' do + expect(faraday_connection.adapter).to eq(Faraday::Adapter::NetHttp) + expect(faraday_connection.builder.handlers).to_not include(Faraday::Response::Logger) + + config.configure_connection(faraday_connection) + + expect(faraday_connection.adapter).to eq(CustomAdapter) + expect(faraday_connection.builder.handlers).to include(Faraday::Response::Logger) + end + + it 'supports multiple configuration blocks' do + config.configure_faraday_connection do |conn| + conn.adapter AnotherCustomAdapter + end + + expect(faraday_connection.adapter).to eq(Faraday::Adapter::NetHttp) + expect(faraday_connection.builder.handlers).to_not include(Faraday::Response::Logger) + + config.configure_connection(faraday_connection) + + expect(faraday_connection.adapter).to eq(AnotherCustomAdapter) + expect(faraday_connection.builder.handlers).to include(Faraday::Response::Logger) + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 43a55a5..1bb0648 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,13 +1,118 @@ -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -$LOAD_PATH.unshift(File.dirname(__FILE__)) -require 'rspec' -require 'pry' -require 'conekta' +=begin +#Conekta API + +#Conekta sdk -# Requires supporting files with custom matchers and macros, etc, -# in ./support/ and its subdirectories. -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 +=end + +# load the gem +require_relative './api/base_test' +require 'conekta' + +# The following was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| - config.before(:all) { Conekta.api_key = 'key_ZLy4aP2szht1HqzkCezDEA' } + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + # run before each test + Conekta.configure do |config| + config.host = BaseTest.host + config.access_token = 'key_xxxxxx' + config.scheme = BaseTest.scheme + end + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end end diff --git a/spec/support/fixtures/orders.json b/spec/support/fixtures/orders.json deleted file mode 100644 index e3caa40..0000000 --- a/spec/support/fixtures/orders.json +++ /dev/null @@ -1,1148 +0,0 @@ -{ - "next_page_url":"https://api.conekta.io/orders?next=ord_2sxFzrTJEnMdcj8ZG", - "has_more":true, - "total":228527, - "object":"list", - "data":[ - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpvsLVUTxCH8GS1N", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxK9Gff9ywBqZdj9", - "metadata":{ - - }, - "created_at":1670098325, - "updated_at":1670098327, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638bad95d1ed69000147645c", - "livemode":false, - "created_at":1670098325, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670098327, - "fee":387, - "customer_id":"cus_2rpvsLVUTxCH8GS1N", - "order_id":"ord_2sxK9Gff9ywBqZdj9" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpvsKDcA14GR3xH7", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxK9GTWr2hrTxAyu", - "metadata":{ - - }, - "created_at":1670098325, - "updated_at":1670098328, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638bad958953d9000195e080", - "livemode":false, - "created_at":1670098325, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670098327, - "fee":387, - "customer_id":"cus_2rpvsKDcA14GR3xH7", - "order_id":"ord_2sxK9GTWr2hrTxAyu" - } - ] - } - }, - { - "livemode":false, - "amount":10000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpvsK1qRZ4ysj71i", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxK98PzMdDCa2Sk7", - "metadata":{ - - }, - "created_at":1670098314, - "updated_at":1670098316, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638bad8a9e2c910001e91c60", - "livemode":false, - "created_at":1670098314, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":10000, - "paid_at":1670098316, - "fee":742, - "customer_id":"cus_2rpvsK1qRZ4ysj71i", - "order_id":"ord_2sxK98PzMdDCa2Sk7" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpu371eASBKovcKM", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxHJypyFE1HV7FLC", - "metadata":{ - - }, - "created_at":1670089975, - "updated_at":1670089977, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b8cf75e3f460001c8b381", - "livemode":false, - "created_at":1670089975, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670089976, - "fee":387, - "customer_id":"cus_2rpu371eASBKovcKM", - "order_id":"ord_2sxHJypyFE1HV7FLC" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpu37t18ji4EKnVz", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxHJynBvQxiV7iVG", - "metadata":{ - - }, - "created_at":1670089975, - "updated_at":1670089977, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b8cf74d9e3100017888bb", - "livemode":false, - "created_at":1670089975, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670089976, - "fee":387, - "customer_id":"cus_2rpu37t18ji4EKnVz", - "order_id":"ord_2sxHJynBvQxiV7iVG" - } - ] - } - }, - { - "livemode":false, - "amount":10000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpu36CbMtbUN3giz", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxHJv66KR9UMmQ2Y", - "metadata":{ - - }, - "created_at":1670089970, - "updated_at":1670089972, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b8cf24d9e310001788895", - "livemode":false, - "created_at":1670089970, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":10000, - "paid_at":1670089971, - "fee":742, - "customer_id":"cus_2rpu36CbMtbUN3giz", - "order_id":"ord_2sxHJv66KR9UMmQ2Y" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rptxFjUnUiAX1h26", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxHE6nqQRnufQEJe", - "metadata":{ - - }, - "created_at":1670089591, - "updated_at":1670089594, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b8b77fc9664000104f58b", - "livemode":false, - "created_at":1670089591, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670089593, - "fee":387, - "customer_id":"cus_2rptxFjUnUiAX1h26", - "order_id":"ord_2sxHE6nqQRnufQEJe" - } - ] - } - }, - { - "livemode":false, - "amount":10000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rptxEFqk5asMXuFL", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxHE5C4WNN2pJ6h1", - "metadata":{ - - }, - "created_at":1670089589, - "updated_at":1670089591, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b8b75d1ed69000146e9bc", - "livemode":false, - "created_at":1670089589, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":10000, - "paid_at":1670089591, - "fee":742, - "customer_id":"cus_2rptxEFqk5asMXuFL", - "order_id":"ord_2sxHE5C4WNN2pJ6h1" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rptxFfFW8gxcGzPM", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxHE4ovwTgK6sYt2", - "metadata":{ - - }, - "created_at":1670089589, - "updated_at":1670089592, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b8b754d9e31000178820b", - "livemode":false, - "created_at":1670089589, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670089591, - "fee":387, - "customer_id":"cus_2rptxFfFW8gxcGzPM", - "order_id":"ord_2sxHE4ovwTgK6sYt2" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rptojE5P1XcHofHs", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxH5aPSeVDczjuE6", - "metadata":{ - - }, - "created_at":1670088922, - "updated_at":1670088924, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b88da4d9e310001787647", - "livemode":false, - "created_at":1670088922, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670088924, - "fee":387, - "customer_id":"cus_2rptojE5P1XcHofHs", - "order_id":"ord_2sxH5aPSeVDczjuE6" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rptoiMiQhzszru6w", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxH5YQTadgYSnZdw", - "metadata":{ - - }, - "created_at":1670088919, - "updated_at":1670088921, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b88d79e2c910001e89196", - "livemode":false, - "created_at":1670088919, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670088921, - "fee":387, - "customer_id":"cus_2rptoiMiQhzszru6w", - "order_id":"ord_2sxH5YQTadgYSnZdw" - } - ] - } - }, - { - "livemode":false, - "amount":10000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rptohYfcAR2VwVRV", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxH5YLyLqz4Tjz8A", - "metadata":{ - - }, - "created_at":1670088919, - "updated_at":1670088921, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b88d78953d900019550f3", - "livemode":false, - "created_at":1670088919, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":10000, - "paid_at":1670088921, - "fee":742, - "customer_id":"cus_2rptohYfcAR2VwVRV", - "order_id":"ord_2sxH5YLyLqz4Tjz8A" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpsqEc9soMLTwNcT", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxG74snQEb4B5tuB", - "metadata":{ - - }, - "created_at":1670084482, - "updated_at":1670084484, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b7782d1ed690001469c1e", - "livemode":false, - "created_at":1670084482, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670084484, - "fee":387, - "customer_id":"cus_2rpsqEc9soMLTwNcT", - "order_id":"ord_2sxG74snQEb4B5tuB" - } - ] - } - }, - { - "livemode":false, - "amount":10000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpsqDsLMbngoncrb", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxG74j8L54CnWzE3", - "metadata":{ - - }, - "created_at":1670084482, - "updated_at":1670084485, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b77829e2c910001e845f0", - "livemode":false, - "created_at":1670084482, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":10000, - "paid_at":1670084484, - "fee":742, - "customer_id":"cus_2rpsqDsLMbngoncrb", - "order_id":"ord_2sxG74j8L54CnWzE3" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpsqG5nvCUdgbcLh", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxG74VeqKuLTfLnm", - "metadata":{ - - }, - "created_at":1670084482, - "updated_at":1670084485, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b77824d9e31000178307a", - "livemode":false, - "created_at":1670084482, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670084484, - "fee":387, - "customer_id":"cus_2rpsqG5nvCUdgbcLh", - "order_id":"ord_2sxG74VeqKuLTfLnm" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpsm966x45jeJWaQ", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxG32ENgVtLumeuX", - "metadata":{ - - }, - "created_at":1670084164, - "updated_at":1670084166, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b7644fc96640001049cda", - "livemode":false, - "created_at":1670084164, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670084166, - "fee":387, - "customer_id":"cus_2rpsm966x45jeJWaQ", - "order_id":"ord_2sxG32ENgVtLumeuX" - } - ] - } - }, - { - "livemode":false, - "amount":10000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpsm7cTuexSSqLhp", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxG31xAc94dGYVfh", - "metadata":{ - - }, - "created_at":1670084164, - "updated_at":1670084168, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b76449baf5d00015c01bc", - "livemode":false, - "created_at":1670084164, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":10000, - "paid_at":1670084167, - "fee":742, - "customer_id":"cus_2rpsm7cTuexSSqLhp", - "order_id":"ord_2sxG31xAc94dGYVfh" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpsm8AcVzJY6NUuJ", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxG31xAc94dGYVfc", - "metadata":{ - - }, - "created_at":1670084164, - "updated_at":1670084168, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b76449baf5d00015c01b7", - "livemode":false, - "created_at":1670084164, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670084167, - "fee":387, - "customer_id":"cus_2rpsm8AcVzJY6NUuJ", - "order_id":"ord_2sxG31xAc94dGYVfc" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpsj36F7Hz9cwc48", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxG115ezRxYo7T3z", - "metadata":{ - - }, - "created_at":1670084006, - "updated_at":1670084008, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b75a64d9e310001782945", - "livemode":false, - "created_at":1670084006, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670084008, - "fee":387, - "customer_id":"cus_2rpsj36F7Hz9cwc48", - "order_id":"ord_2sxG115ezRxYo7T3z" - } - ] - } - }, - { - "livemode":false, - "amount":1000, - "currency":"MXN", - "payment_status":"paid", - "amount_refunded":0, - "customer_info":{ - "email":"test@test.com", - "name":"test name", - "corporate":false, - "customer_id":"cus_2rpsj359JiDQvRA5i", - "object":"customer_info" - }, - "object":"order", - "id":"ord_2sxFzrTJEnMdcj8ZG", - "metadata":{ - - }, - "created_at":1670083994, - "updated_at":1670083997, - "charges":{ - "object":"list", - "has_more":false, - "total":1, - "data":[ - { - "id":"638b759a9e2c910001e83e0b", - "livemode":false, - "created_at":1670083994, - "currency":"MXN", - "payment_method":{ - "name":"Jorge Lopez", - "exp_month":"05", - "exp_year":"23", - "auth_code":"000000", - "object":"card_payment", - "type":"credit", - "last4":"4242", - "brand":"visa", - "issuer":"banamex", - "account_type":"BANAMEX", - "country":"MX", - "fraud_indicators":[ - - ] - }, - "object":"charge", - "status":"paid", - "amount":1000, - "paid_at":1670083996, - "fee":387, - "customer_id":"cus_2rpsj359JiDQvRA5i", - "order_id":"ord_2sxFzrTJEnMdcj8ZG" - } - ] - } - } - ] -} \ No newline at end of file diff --git a/spec/support/shared_context.rb b/spec/support/shared_context.rb deleted file mode 100644 index b86b6cb..0000000 --- a/spec/support/shared_context.rb +++ /dev/null @@ -1,49 +0,0 @@ -shared_context "API 2.0.0" do - before(:all) do - Conekta.api_version = "2.0.0" - end - - after(:all) do - Conekta.api_version = "1.0.0" - end -end - -shared_context "API 1.0.0" do - before(:all) do - Conekta.api_version = "1.0.0" - end - - after(:all) do - Conekta.api_version = "2.0.0" - end -end - -shared_context "order" do - let(:line_items) do - [{ - name: "Box of Cohiba S1s", - description: "Imported From Mex.", - unit_price: 35000, - quantity: 1, - tags: ["food", "mexican food"], - type: "physical" - }] - end - - let(:order_data) do - { - currency: 'mxn', - line_items: line_items - } - end -end - -shared_context "customer" do - let(:customer_data) do - { - email: "hola@hola.com", - name: "John Constantine", - payment_sources: [ { token_id: "tok_test_visa_4242", type: "card" }] - } - end -end