apimaticcalculatortest 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +14717 -0
- data/lib/beaver.rb +384 -0
- data/lib/beaver/api_helper.rb +289 -0
- data/lib/beaver/client.rb +31 -0
- data/lib/beaver/configuration.rb +115 -0
- data/lib/beaver/controllers/api_controller.rb +5756 -0
- data/lib/beaver/controllers/base_controller.rb +49 -0
- data/lib/beaver/exceptions/api_exception.rb +20 -0
- data/lib/beaver/http/auth/custom_header_auth.rb +16 -0
- data/lib/beaver/http/faraday_client.rb +67 -0
- data/lib/beaver/http/http_call_back.rb +24 -0
- data/lib/beaver/http/http_client.rb +104 -0
- data/lib/beaver/http/http_method_enum.rb +13 -0
- data/lib/beaver/http/http_request.rb +50 -0
- data/lib/beaver/http/http_response.rb +29 -0
- data/lib/beaver/models/account_resp.rb +193 -0
- data/lib/beaver/models/account_type_enum.rb +17 -0
- data/lib/beaver/models/accounts_capabilities_request.rb +44 -0
- data/lib/beaver/models/accounts_request.rb +144 -0
- data/lib/beaver/models/accounts_request1.rb +135 -0
- data/lib/beaver/models/accounts_response.rb +69 -0
- data/lib/beaver/models/additional_representative_req.rb +121 -0
- data/lib/beaver/models/additional_representative_resp.rb +120 -0
- data/lib/beaver/models/additional_representatives.rb +66 -0
- data/lib/beaver/models/additional_representatives1.rb +66 -0
- data/lib/beaver/models/additional_representatives_req.rb +70 -0
- data/lib/beaver/models/additional_representatives_resp.rb +70 -0
- data/lib/beaver/models/address_legal_entities_nullable.rb +80 -0
- data/lib/beaver/models/address_nullable.rb +80 -0
- data/lib/beaver/models/address_payments_req.rb +80 -0
- data/lib/beaver/models/address_payments_resp.rb +80 -0
- data/lib/beaver/models/address_rbit.rb +73 -0
- data/lib/beaver/models/address_rbits.rb +80 -0
- data/lib/beaver/models/address_terminals_req.rb +80 -0
- data/lib/beaver/models/address_terminals_resp.rb +80 -0
- data/lib/beaver/models/address_type_enum.rb +26 -0
- data/lib/beaver/models/adjustments.rb +136 -0
- data/lib/beaver/models/adjustments_request.rb +51 -0
- data/lib/beaver/models/adjustments_response.rb +69 -0
- data/lib/beaver/models/amount_guide_type_enum.rb +21 -0
- data/lib/beaver/models/application_block.rb +35 -0
- data/lib/beaver/models/application_block4.rb +44 -0
- data/lib/beaver/models/associated_phone.rb +44 -0
- data/lib/beaver/models/associated_resource.rb +44 -0
- data/lib/beaver/models/auto_billing.rb +71 -0
- data/lib/beaver/models/balances.rb +36 -0
- data/lib/beaver/models/base_model.rb +36 -0
- data/lib/beaver/models/billing_statement.rb +116 -0
- data/lib/beaver/models/billing_statements_interchange_fees_response.rb +69 -0
- data/lib/beaver/models/billing_statements_response.rb +69 -0
- data/lib/beaver/models/billing_statements_transactions_summary_response.rb +69 -0
- data/lib/beaver/models/business_description.rb +53 -0
- data/lib/beaver/models/business_name.rb +44 -0
- data/lib/beaver/models/buyer.rb +54 -0
- data/lib/beaver/models/ca.rb +35 -0
- data/lib/beaver/models/ca1.rb +37 -0
- data/lib/beaver/models/ca4.rb +44 -0
- data/lib/beaver/models/cad.rb +53 -0
- data/lib/beaver/models/cad1.rb +62 -0
- data/lib/beaver/models/cad2.rb +44 -0
- data/lib/beaver/models/capabilities_resp.rb +89 -0
- data/lib/beaver/models/capture_amounts.rb +53 -0
- data/lib/beaver/models/card_brand2_enum.rb +23 -0
- data/lib/beaver/models/card_brand_enum.rb +29 -0
- data/lib/beaver/models/card_entry_type_enum.rb +14 -0
- data/lib/beaver/models/code_type_enum.rb +21 -0
- data/lib/beaver/models/contactless_payments.rb +47 -0
- data/lib/beaver/models/contactless_payments_req.rb +48 -0
- data/lib/beaver/models/controller.rb +37 -0
- data/lib/beaver/models/controller1.rb +37 -0
- data/lib/beaver/models/controller_req.rb +112 -0
- data/lib/beaver/models/controller_resp.rb +111 -0
- data/lib/beaver/models/countries_opted_out_methods.rb +35 -0
- data/lib/beaver/models/country_code_enum.rb +758 -0
- data/lib/beaver/models/country_opted_out_methods.rb +35 -0
- data/lib/beaver/models/credit_card.rb +47 -0
- data/lib/beaver/models/credit_card1.rb +153 -0
- data/lib/beaver/models/credit_card2.rb +117 -0
- data/lib/beaver/models/credit_card4.rb +44 -0
- data/lib/beaver/models/credit_debit_preference1_enum.rb +23 -0
- data/lib/beaver/models/credit_debit_preference_enum.rb +20 -0
- data/lib/beaver/models/currencies.rb +53 -0
- data/lib/beaver/models/currencies1.rb +53 -0
- data/lib/beaver/models/currencies2.rb +53 -0
- data/lib/beaver/models/currencies3.rb +53 -0
- data/lib/beaver/models/currency_enum.rb +20 -0
- data/lib/beaver/models/currency_nullable_enum.rb +20 -0
- data/lib/beaver/models/current_issue.rb +83 -0
- data/lib/beaver/models/current_issue2.rb +72 -0
- data/lib/beaver/models/date_of_birth.rb +53 -0
- data/lib/beaver/models/deferred_authorization.rb +87 -0
- data/lib/beaver/models/delivery_type_enum.rb +35 -0
- data/lib/beaver/models/detail.rb +44 -0
- data/lib/beaver/models/detail1.rb +44 -0
- data/lib/beaver/models/detail10.rb +44 -0
- data/lib/beaver/models/detail2.rb +44 -0
- data/lib/beaver/models/detail3.rb +44 -0
- data/lib/beaver/models/detail4.rb +44 -0
- data/lib/beaver/models/detail5.rb +44 -0
- data/lib/beaver/models/detail6.rb +44 -0
- data/lib/beaver/models/detail7.rb +44 -0
- data/lib/beaver/models/detail8.rb +44 -0
- data/lib/beaver/models/detail9.rb +44 -0
- data/lib/beaver/models/detail_code10_enum.rb +26 -0
- data/lib/beaver/models/detail_code1_enum.rb +20 -0
- data/lib/beaver/models/detail_code2_enum.rb +29 -0
- data/lib/beaver/models/detail_code3_enum.rb +17 -0
- data/lib/beaver/models/detail_code4_enum.rb +50 -0
- data/lib/beaver/models/detail_code5_enum.rb +329 -0
- data/lib/beaver/models/detail_code6_enum.rb +17 -0
- data/lib/beaver/models/detail_code7_enum.rb +272 -0
- data/lib/beaver/models/detail_code8_enum.rb +17 -0
- data/lib/beaver/models/detail_code9_enum.rb +59 -0
- data/lib/beaver/models/detail_code_enum.rb +17 -0
- data/lib/beaver/models/dispute_reason.rb +60 -0
- data/lib/beaver/models/disputes.rb +239 -0
- data/lib/beaver/models/disputes_request.rb +61 -0
- data/lib/beaver/models/disputes_response.rb +69 -0
- data/lib/beaver/models/document.rb +99 -0
- data/lib/beaver/models/documentation.rb +44 -0
- data/lib/beaver/models/documentation1.rb +44 -0
- data/lib/beaver/models/embedded_rbit.rb +183 -0
- data/lib/beaver/models/entity_country_info.rb +53 -0
- data/lib/beaver/models/entity_verification.rb +35 -0
- data/lib/beaver/models/entity_verification1.rb +67 -0
- data/lib/beaver/models/errant_field_enum.rb +20 -0
- data/lib/beaver/models/external_account.rb +135 -0
- data/lib/beaver/models/fee_type_enum.rb +32 -0
- data/lib/beaver/models/flat_guide.rb +53 -0
- data/lib/beaver/models/fundraising_event.rb +116 -0
- data/lib/beaver/models/fundraising_update.rb +44 -0
- data/lib/beaver/models/gb.rb +44 -0
- data/lib/beaver/models/gbp.rb +53 -0
- data/lib/beaver/models/gbp1.rb +62 -0
- data/lib/beaver/models/gbp2.rb +44 -0
- data/lib/beaver/models/holder_req.rb +67 -0
- data/lib/beaver/models/holder_resp.rb +63 -0
- data/lib/beaver/models/human_name_full_nullable.rb +71 -0
- data/lib/beaver/models/incoming_payments_req.rb +37 -0
- data/lib/beaver/models/incoming_payments_resp.rb +46 -0
- data/lib/beaver/models/industry.rb +44 -0
- data/lib/beaver/models/industry_code.rb +53 -0
- data/lib/beaver/models/initiated_by_req_enum.rb +17 -0
- data/lib/beaver/models/initiated_by_resp_enum.rb +20 -0
- data/lib/beaver/models/interchange_fee.rb +137 -0
- data/lib/beaver/models/interchange_plus.rb +45 -0
- data/lib/beaver/models/issue_type4_enum.rb +20 -0
- data/lib/beaver/models/issue_type_enum.rb +47 -0
- data/lib/beaver/models/item_nullable_req.rb +159 -0
- data/lib/beaver/models/item_nullable_resp.rb +188 -0
- data/lib/beaver/models/item_req.rb +159 -0
- data/lib/beaver/models/item_resp.rb +197 -0
- data/lib/beaver/models/itemized_receipt.rb +89 -0
- data/lib/beaver/models/items_response.rb +69 -0
- data/lib/beaver/models/legal_entities_request.rb +158 -0
- data/lib/beaver/models/legal_entities_response.rb +69 -0
- data/lib/beaver/models/legal_entities_verifications_request.rb +58 -0
- data/lib/beaver/models/legal_entities_verifications_response.rb +103 -0
- data/lib/beaver/models/legal_entity.rb +167 -0
- data/lib/beaver/models/legal_entity_resp.rb +196 -0
- data/lib/beaver/models/legal_form1_enum.rb +32 -0
- data/lib/beaver/models/legal_form_enum.rb +41 -0
- data/lib/beaver/models/line_item.rb +152 -0
- data/lib/beaver/models/line_item1.rb +152 -0
- data/lib/beaver/models/mfa_action_enum.rb +20 -0
- data/lib/beaver/models/mfa_rbit.rb +45 -0
- data/lib/beaver/models/mode_enum.rb +23 -0
- data/lib/beaver/models/model1_enum.rb +17 -0
- data/lib/beaver/models/model_enum.rb +17 -0
- data/lib/beaver/models/name.rb +44 -0
- data/lib/beaver/models/name_type_enum.rb +17 -0
- data/lib/beaver/models/notification_preferences_request.rb +44 -0
- data/lib/beaver/models/notification_preferences_request1.rb +35 -0
- data/lib/beaver/models/notification_preferences_response.rb +69 -0
- data/lib/beaver/models/notification_preferences_response1.rb +107 -0
- data/lib/beaver/models/notification_preferences_response2.rb +107 -0
- data/lib/beaver/models/notifications_response.rb +69 -0
- data/lib/beaver/models/notifications_response1.rb +98 -0
- data/lib/beaver/models/opted_out_methods.rb +36 -0
- data/lib/beaver/models/order_non_expanded.rb +53 -0
- data/lib/beaver/models/order_req.rb +288 -0
- data/lib/beaver/models/order_resp.rb +327 -0
- data/lib/beaver/models/orders_response.rb +69 -0
- data/lib/beaver/models/owner16.rb +53 -0
- data/lib/beaver/models/owner20.rb +53 -0
- data/lib/beaver/models/owner3.rb +53 -0
- data/lib/beaver/models/owner_accounts.rb +53 -0
- data/lib/beaver/models/owner_applications.rb +53 -0
- data/lib/beaver/models/owner_is_account.rb +53 -0
- data/lib/beaver/models/owner_legal_entities.rb +53 -0
- data/lib/beaver/models/owner_legal_entities_nullable.rb +53 -0
- data/lib/beaver/models/owner_of_items.rb +53 -0
- data/lib/beaver/models/partner_service.rb +53 -0
- data/lib/beaver/models/partner_service_rbit.rb +69 -0
- data/lib/beaver/models/payment_bank.rb +44 -0
- data/lib/beaver/models/payment_bank_us.rb +54 -0
- data/lib/beaver/models/payment_bank_us_req.rb +63 -0
- data/lib/beaver/models/payment_failure_reason.rb +60 -0
- data/lib/beaver/models/payment_method_for_payments.rb +93 -0
- data/lib/beaver/models/payment_method_non_expanded.rb +53 -0
- data/lib/beaver/models/payment_method_req.rb +89 -0
- data/lib/beaver/models/payment_method_resp.rb +127 -0
- data/lib/beaver/models/payment_method_type_enum.rb +17 -0
- data/lib/beaver/models/payment_methods_request.rb +83 -0
- data/lib/beaver/models/payment_methods_response.rb +69 -0
- data/lib/beaver/models/payment_methods_verify_bank_deposits_request.rb +35 -0
- data/lib/beaver/models/payment_non_expanded.rb +53 -0
- data/lib/beaver/models/payment_pending_reason.rb +60 -0
- data/lib/beaver/models/payments.rb +60 -0
- data/lib/beaver/models/payments1.rb +37 -0
- data/lib/beaver/models/payments_cancel_request.rb +51 -0
- data/lib/beaver/models/payments_capture_request.rb +35 -0
- data/lib/beaver/models/payments_request.rb +143 -0
- data/lib/beaver/models/payments_request1.rb +69 -0
- data/lib/beaver/models/payments_response.rb +69 -0
- data/lib/beaver/models/payments_v30.rb +247 -0
- data/lib/beaver/models/payout.rb +184 -0
- data/lib/beaver/models/payout_bank_ca.rb +44 -0
- data/lib/beaver/models/payout_bank_ca1.rb +62 -0
- data/lib/beaver/models/payout_bank_gb.rb +35 -0
- data/lib/beaver/models/payout_bank_gb1.rb +44 -0
- data/lib/beaver/models/payout_bank_us.rb +44 -0
- data/lib/beaver/models/payout_bank_us1.rb +53 -0
- data/lib/beaver/models/payout_failure_reason.rb +60 -0
- data/lib/beaver/models/payout_method_non_expanded.rb +53 -0
- data/lib/beaver/models/payout_method_req.rb +117 -0
- data/lib/beaver/models/payout_method_resp.rb +137 -0
- data/lib/beaver/models/payout_method_type_enum.rb +20 -0
- data/lib/beaver/models/payout_methods_request.rb +51 -0
- data/lib/beaver/models/payout_methods_response.rb +69 -0
- data/lib/beaver/models/payout_pending_reason.rb +60 -0
- data/lib/beaver/models/payout_req.rb +45 -0
- data/lib/beaver/models/payout_resp.rb +45 -0
- data/lib/beaver/models/payouts.rb +60 -0
- data/lib/beaver/models/payouts1.rb +37 -0
- data/lib/beaver/models/payouts_request.rb +51 -0
- data/lib/beaver/models/payouts_response.rb +69 -0
- data/lib/beaver/models/percentage_guide.rb +64 -0
- data/lib/beaver/models/period_enum.rb +20 -0
- data/lib/beaver/models/person_rbit.rb +54 -0
- data/lib/beaver/models/personal_country_info.rb +53 -0
- data/lib/beaver/models/personal_country_info1.rb +53 -0
- data/lib/beaver/models/personal_verification.rb +35 -0
- data/lib/beaver/models/personal_verification5.rb +67 -0
- data/lib/beaver/models/phone.rb +53 -0
- data/lib/beaver/models/phone1.rb +53 -0
- data/lib/beaver/models/phone_legal_entities_nullable.rb +44 -0
- data/lib/beaver/models/phone_rbit.rb +53 -0
- data/lib/beaver/models/phone_type_enum.rb +20 -0
- data/lib/beaver/models/pricing.rb +36 -0
- data/lib/beaver/models/pricing_by_currency.rb +46 -0
- data/lib/beaver/models/quick_chip.rb +35 -0
- data/lib/beaver/models/rbit_source_enum.rb +47 -0
- data/lib/beaver/models/rbit_types_enum.rb +50 -0
- data/lib/beaver/models/rbits_request.rb +194 -0
- data/lib/beaver/models/rbits_response.rb +246 -0
- data/lib/beaver/models/rbits_response1.rb +69 -0
- data/lib/beaver/models/reason.rb +60 -0
- data/lib/beaver/models/reason_code1_enum.rb +20 -0
- data/lib/beaver/models/reason_code2_enum.rb +29 -0
- data/lib/beaver/models/reason_code3_enum.rb +17 -0
- data/lib/beaver/models/reason_code4_enum.rb +23 -0
- data/lib/beaver/models/reason_code5_enum.rb +32 -0
- data/lib/beaver/models/reason_code6_enum.rb +17 -0
- data/lib/beaver/models/reason_code7_enum.rb +32 -0
- data/lib/beaver/models/reason_code8_enum.rb +17 -0
- data/lib/beaver/models/reason_code9_enum.rb +29 -0
- data/lib/beaver/models/reason_code_enum.rb +17 -0
- data/lib/beaver/models/recoveries.rb +185 -0
- data/lib/beaver/models/recoveries_request.rb +51 -0
- data/lib/beaver/models/recoveries_response.rb +69 -0
- data/lib/beaver/models/recovery_failure_reason.rb +60 -0
- data/lib/beaver/models/recovery_pending_reason.rb +60 -0
- data/lib/beaver/models/refund_amounts.rb +53 -0
- data/lib/beaver/models/refund_failure_reason.rb +60 -0
- data/lib/beaver/models/refund_pending_reason.rb +60 -0
- data/lib/beaver/models/refund_req.rb +96 -0
- data/lib/beaver/models/refund_resp.rb +203 -0
- data/lib/beaver/models/refunds_request.rb +60 -0
- data/lib/beaver/models/refunds_response.rb +69 -0
- data/lib/beaver/models/reject_reason.rb +60 -0
- data/lib/beaver/models/representative0.rb +37 -0
- data/lib/beaver/models/representative01.rb +37 -0
- data/lib/beaver/models/resolution.rb +44 -0
- data/lib/beaver/models/resource1_enum.rb +29 -0
- data/lib/beaver/models/resource2_enum.rb +20 -0
- data/lib/beaver/models/resource_accounts_enum.rb +14 -0
- data/lib/beaver/models/resource_capabilities_enum.rb +14 -0
- data/lib/beaver/models/resource_enum.rb +14 -0
- data/lib/beaver/models/resource_legal_entities_enum.rb +14 -0
- data/lib/beaver/models/resource_notifications_enum.rb +14 -0
- data/lib/beaver/models/resource_payments_enum.rb +14 -0
- data/lib/beaver/models/resource_types_rbit_enum.rb +35 -0
- data/lib/beaver/models/resource_verifications_enum.rb +14 -0
- data/lib/beaver/models/result.rb +98 -0
- data/lib/beaver/models/result1.rb +107 -0
- data/lib/beaver/models/result2.rb +246 -0
- data/lib/beaver/models/role_enum.rb +23 -0
- data/lib/beaver/models/service_billing_method_enum.rb +35 -0
- data/lib/beaver/models/setup_by_enum.rb +17 -0
- data/lib/beaver/models/shipping_info.rb +80 -0
- data/lib/beaver/models/shipping_status.rb +80 -0
- data/lib/beaver/models/shipping_status1.rb +80 -0
- data/lib/beaver/models/standard.rb +62 -0
- data/lib/beaver/models/state_enum.rb +17 -0
- data/lib/beaver/models/status20_enum.rb +20 -0
- data/lib/beaver/models/status2_enum.rb +23 -0
- data/lib/beaver/models/status3_enum.rb +23 -0
- data/lib/beaver/models/status4_enum.rb +20 -0
- data/lib/beaver/models/status5_enum.rb +23 -0
- data/lib/beaver/models/status8_enum.rb +20 -0
- data/lib/beaver/models/status_enum.rb +20 -0
- data/lib/beaver/models/supported_card_entry_mode_enum.rb +23 -0
- data/lib/beaver/models/target.rb +53 -0
- data/lib/beaver/models/terminal_configuration.rb +137 -0
- data/lib/beaver/models/terminal_configuration1.rb +138 -0
- data/lib/beaver/models/terminal_configuration2.rb +138 -0
- data/lib/beaver/models/terminal_display.rb +62 -0
- data/lib/beaver/models/terminal_resp.rb +148 -0
- data/lib/beaver/models/terminals_request.rb +75 -0
- data/lib/beaver/models/terminals_request1.rb +48 -0
- data/lib/beaver/models/terminals_response.rb +69 -0
- data/lib/beaver/models/terminals_status_enum.rb +23 -0
- data/lib/beaver/models/terminals_supported_card_brand_enum.rb +23 -0
- data/lib/beaver/models/terminals_tip.rb +51 -0
- data/lib/beaver/models/terms.rb +44 -0
- data/lib/beaver/models/terms_nullable.rb +44 -0
- data/lib/beaver/models/terms_of_service.rb +44 -0
- data/lib/beaver/models/timezone_enum.rb +50 -0
- data/lib/beaver/models/token.rb +44 -0
- data/lib/beaver/models/tokens_request.rb +65 -0
- data/lib/beaver/models/tokens_response.rb +93 -0
- data/lib/beaver/models/topic1_enum.rb +115 -0
- data/lib/beaver/models/topic_enum.rb +151 -0
- data/lib/beaver/models/transaction_details.rb +132 -0
- data/lib/beaver/models/transaction_record.rb +125 -0
- data/lib/beaver/models/transaction_record_non_expanded.rb +53 -0
- data/lib/beaver/models/transaction_records_response.rb +69 -0
- data/lib/beaver/models/transactions_summary.rb +96 -0
- data/lib/beaver/models/transactions_summary_summaries.rb +62 -0
- data/lib/beaver/models/type12_enum.rb +17 -0
- data/lib/beaver/models/type15_enum.rb +74 -0
- data/lib/beaver/models/type27_enum.rb +14 -0
- data/lib/beaver/models/type2_enum.rb +20 -0
- data/lib/beaver/models/type3_enum.rb +17 -0
- data/lib/beaver/models/type4_enum.rb +26 -0
- data/lib/beaver/models/type5_enum.rb +20 -0
- data/lib/beaver/models/type6_enum.rb +17 -0
- data/lib/beaver/models/type7_enum.rb +17 -0
- data/lib/beaver/models/type8_enum.rb +53 -0
- data/lib/beaver/models/type9_enum.rb +23 -0
- data/lib/beaver/models/type_enum.rb +20 -0
- data/lib/beaver/models/units_enum.rb +17 -0
- data/lib/beaver/models/upcoming_issue.rb +83 -0
- data/lib/beaver/models/us.rb +46 -0
- data/lib/beaver/models/us1.rb +49 -0
- data/lib/beaver/models/us4.rb +45 -0
- data/lib/beaver/models/usd.rb +53 -0
- data/lib/beaver/models/usd1.rb +62 -0
- data/lib/beaver/models/usd2.rb +44 -0
- data/lib/beaver/models/virtual_terminal_mode_enum.rb +17 -0
- data/lib/beaver/models/weight.rb +44 -0
- data/lib/beaver/utilities/file_wrapper.rb +17 -0
- metadata +489 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Beaver
|
7
|
+
# BaseController.
|
8
|
+
class BaseController
|
9
|
+
attr_accessor :config, :http_call_back
|
10
|
+
|
11
|
+
def initialize(config, http_call_back: nil)
|
12
|
+
@config = config
|
13
|
+
@http_call_back = http_call_back
|
14
|
+
|
15
|
+
@global_headers = {
|
16
|
+
'user-agent' => 'APIMATIC 2.0'
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def validate_parameters(args)
|
21
|
+
args.each do |_name, value|
|
22
|
+
if value.nil?
|
23
|
+
raise ArgumentError, "Required parameter #{_name} cannot be nil."
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def execute_request(request, binary: false)
|
29
|
+
@http_call_back.on_before_request(request) if @http_call_back
|
30
|
+
|
31
|
+
APIHelper.clean_hash(request.headers)
|
32
|
+
request.headers.merge!(@global_headers)
|
33
|
+
|
34
|
+
response = if binary
|
35
|
+
config.http_client.execute_as_binary(request)
|
36
|
+
else
|
37
|
+
config.http_client.execute_as_string(request)
|
38
|
+
end
|
39
|
+
@http_call_back.on_after_response(response) if @http_call_back
|
40
|
+
|
41
|
+
response
|
42
|
+
end
|
43
|
+
|
44
|
+
def validate_response(response)
|
45
|
+
raise APIException.new 'HTTP Response Not OK', response unless
|
46
|
+
response.status_code.between?(200, 208) # [200,208] = HTTP OK
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Beaver
|
7
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
8
|
+
class APIException < StandardError
|
9
|
+
attr_reader :response, :response_code
|
10
|
+
|
11
|
+
# The constructor.
|
12
|
+
# @param [String] The reason for raising an exception.
|
13
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
14
|
+
def initialize(reason, response)
|
15
|
+
super(reason)
|
16
|
+
@response = response
|
17
|
+
@response_code = response.status_code
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Beaver
|
7
|
+
# Utility class for custom header authorization.
|
8
|
+
class CustomHeaderAuth
|
9
|
+
# Add custom authentication to the request.
|
10
|
+
# @param [HttpRequest] The HttpRequest object to which authentication will
|
11
|
+
# be added.
|
12
|
+
def self.apply(config, http_request)
|
13
|
+
http_request.add_header('App-Token', config.app_token)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'faraday/http_cache'
|
7
|
+
require 'faraday_middleware'
|
8
|
+
|
9
|
+
module Beaver
|
10
|
+
# An implementation of HttpClient.
|
11
|
+
class FaradayClient < HttpClient
|
12
|
+
# The constructor.
|
13
|
+
def initialize(timeout:, max_retries:, retry_interval:,
|
14
|
+
backoff_factor:, cache: false, verify: true)
|
15
|
+
@connection = Faraday.new do |faraday|
|
16
|
+
faraday.use Faraday::HttpCache, serializer: Marshal if cache
|
17
|
+
faraday.use FaradayMiddleware::FollowRedirects
|
18
|
+
faraday.use :gzip
|
19
|
+
faraday.request :multipart
|
20
|
+
faraday.request :url_encoded
|
21
|
+
faraday.ssl[:ca_file] = Certifi.where
|
22
|
+
faraday.ssl[:verify] = verify
|
23
|
+
faraday.request :retry, max: max_retries, interval: retry_interval,
|
24
|
+
backoff_factor: backoff_factor
|
25
|
+
faraday.adapter Faraday.default_adapter
|
26
|
+
faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
|
27
|
+
faraday.options[:timeout] = timeout if timeout > 0
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Method overridden from HttpClient.
|
32
|
+
def execute_as_string(http_request)
|
33
|
+
response = @connection.send(
|
34
|
+
http_request.http_method.downcase,
|
35
|
+
http_request.query_url
|
36
|
+
) do |request|
|
37
|
+
request.headers = http_request.headers
|
38
|
+
unless http_request.http_method == HttpMethodEnum::GET &&
|
39
|
+
http_request.parameters.empty?
|
40
|
+
request.body = http_request.parameters
|
41
|
+
end
|
42
|
+
end
|
43
|
+
convert_response(response, http_request)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Method overridden from HttpClient.
|
47
|
+
def execute_as_binary(http_request)
|
48
|
+
response = @connection.send(
|
49
|
+
http_request.http_method.downcase,
|
50
|
+
http_request.query_url
|
51
|
+
) do |request|
|
52
|
+
request.headers = http_request.headers
|
53
|
+
unless http_request.http_method == HttpMethodEnum::GET &&
|
54
|
+
http_request.parameters.empty?
|
55
|
+
request.body = http_request.parameters
|
56
|
+
end
|
57
|
+
end
|
58
|
+
convert_response(response, http_request)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Method overridden from HttpClient.
|
62
|
+
def convert_response(response, http_request)
|
63
|
+
HttpResponse.new(response.status, response.reason_phrase,
|
64
|
+
response.headers, response.body, http_request)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Beaver
|
7
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
8
|
+
class HttpCallBack
|
9
|
+
# A controller will call this method before making an HTTP Request.
|
10
|
+
# @param [HttpRequest] The HttpRequest object which the HttpClient
|
11
|
+
# will execute.
|
12
|
+
def on_before_request(_http_request)
|
13
|
+
raise NotImplementedError, 'This method needs
|
14
|
+
to be implemented in a child class.'
|
15
|
+
end
|
16
|
+
|
17
|
+
# A controller will call this method after making an HTTP Request.
|
18
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
19
|
+
def on_after_response(_http_response)
|
20
|
+
raise NotImplementedError, 'This method needs
|
21
|
+
to be implemented in a child class.'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Beaver
|
7
|
+
# An interface for the methods that an HTTP Client must implement.
|
8
|
+
#
|
9
|
+
# This class should not be instantiated but should be used as a base class
|
10
|
+
# for HTTP Client classes.
|
11
|
+
class HttpClient
|
12
|
+
# Execute an HttpRequest when the response is expected to be a string.
|
13
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
14
|
+
def execute_as_string(_http_request)
|
15
|
+
raise NotImplementedError, 'This method needs
|
16
|
+
to be implemented in a child class.'
|
17
|
+
end
|
18
|
+
|
19
|
+
# Execute an HttpRequest when the response is expected to be binary.
|
20
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
21
|
+
def execute_as_binary(_http_request)
|
22
|
+
raise NotImplementedError, 'This method needs
|
23
|
+
to be implemented in a child class.'
|
24
|
+
end
|
25
|
+
|
26
|
+
# Converts the HTTP Response from the client to an HttpResponse object.
|
27
|
+
# @param [Dynamic] The response object received from the client.
|
28
|
+
def convert_response(_response)
|
29
|
+
raise NotImplementedError, 'This method needs
|
30
|
+
to be implemented in a child class.'
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get a GET HttpRequest object.
|
34
|
+
# @param [String] The URL to send the request to.
|
35
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
36
|
+
def get(query_url,
|
37
|
+
headers: {})
|
38
|
+
HttpRequest.new(HttpMethodEnum::GET,
|
39
|
+
query_url,
|
40
|
+
headers: headers)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Get a HEAD HttpRequest object.
|
44
|
+
# @param [String] The URL to send the request to.
|
45
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
46
|
+
def head(query_url,
|
47
|
+
headers: {})
|
48
|
+
HttpRequest.new(HttpMethodEnum::HEAD,
|
49
|
+
query_url,
|
50
|
+
headers: headers)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Get a POST HttpRequest object.
|
54
|
+
# @param [String] The URL to send the request to.
|
55
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
56
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
57
|
+
def post(query_url,
|
58
|
+
headers: {},
|
59
|
+
parameters: {})
|
60
|
+
HttpRequest.new(HttpMethodEnum::POST,
|
61
|
+
query_url,
|
62
|
+
headers: headers,
|
63
|
+
parameters: parameters)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Get a PUT HttpRequest object.
|
67
|
+
# @param [String] The URL to send the request to.
|
68
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
69
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
70
|
+
def put(query_url,
|
71
|
+
headers: {},
|
72
|
+
parameters: {})
|
73
|
+
HttpRequest.new(HttpMethodEnum::PUT,
|
74
|
+
query_url,
|
75
|
+
headers: headers,
|
76
|
+
parameters: parameters)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Get a PATCH HttpRequest object.
|
80
|
+
# @param [String] The URL to send the request to.
|
81
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
82
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
83
|
+
def patch(query_url,
|
84
|
+
headers: {},
|
85
|
+
parameters: {})
|
86
|
+
HttpRequest.new(HttpMethodEnum::PATCH,
|
87
|
+
query_url,
|
88
|
+
headers: headers,
|
89
|
+
parameters: parameters)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Get a DELETE HttpRequest object.
|
93
|
+
# @param [String] The URL to send the request to.
|
94
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
95
|
+
def delete(query_url,
|
96
|
+
headers: {},
|
97
|
+
parameters: {})
|
98
|
+
HttpRequest.new(HttpMethodEnum::DELETE,
|
99
|
+
query_url,
|
100
|
+
headers: headers,
|
101
|
+
parameters: parameters)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Beaver
|
7
|
+
# HTTP Methods Enumeration.
|
8
|
+
class HttpMethodEnum
|
9
|
+
HTTPMETHODENUM = [GET = 'GET'.freeze, POST = 'POST'.freeze,
|
10
|
+
PUT = 'PUT'.freeze, PATCH = 'PATCH'.freeze,
|
11
|
+
DELETE = 'DELETE'.freeze, HEAD = 'HEAD'.freeze].freeze
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Beaver
|
7
|
+
# Represents a single Http Request.
|
8
|
+
class HttpRequest
|
9
|
+
attr_accessor :http_method, :query_url, :headers,
|
10
|
+
:parameters, :username, :password
|
11
|
+
|
12
|
+
# The constructor.
|
13
|
+
# @param [HttpMethodEnum] The HTTP method.
|
14
|
+
# @param [String] The URL to send the request to.
|
15
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
16
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
17
|
+
def initialize(http_method,
|
18
|
+
query_url,
|
19
|
+
headers: {},
|
20
|
+
parameters: {})
|
21
|
+
@http_method = http_method
|
22
|
+
@query_url = query_url
|
23
|
+
@headers = headers
|
24
|
+
@parameters = parameters
|
25
|
+
end
|
26
|
+
|
27
|
+
# Add a header to the HttpRequest.
|
28
|
+
# @param [String] The name of the header.
|
29
|
+
# @param [String] The value of the header.
|
30
|
+
def add_header(name, value)
|
31
|
+
@headers[name] = value
|
32
|
+
end
|
33
|
+
|
34
|
+
# Add a parameter to the HttpRequest.
|
35
|
+
# @param [String] The name of the parameter.
|
36
|
+
# @param [String] The value of the parameter.
|
37
|
+
def add_parameter(name, value)
|
38
|
+
@parameters[name] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
# Add a query parameter to the HttpRequest.
|
42
|
+
# @param [String] The name of the query parameter.
|
43
|
+
# @param [String] The value of the query parameter.
|
44
|
+
def add_query_parameter(name, value)
|
45
|
+
@query_url = APIHelper.append_url_with_query_parameters(@query_url,
|
46
|
+
name => value)
|
47
|
+
@query_url = APIHelper.clean_url(@query_url)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Beaver
|
7
|
+
# Http response received.
|
8
|
+
class HttpResponse
|
9
|
+
attr_reader :status_code, :reason_phrase, :headers, :raw_body, :request
|
10
|
+
|
11
|
+
# The constructor
|
12
|
+
# @param [Integer] The status code returned by the server.
|
13
|
+
# @param [String] The reason phrase returned by the server.
|
14
|
+
# @param [Hash] The headers sent by the server in the response.
|
15
|
+
# @param [String] The raw body of the response.
|
16
|
+
# @param [HttpRequest] The request that resulted in this response.
|
17
|
+
def initialize(status_code,
|
18
|
+
reason_phrase,
|
19
|
+
headers,
|
20
|
+
raw_body,
|
21
|
+
request)
|
22
|
+
@status_code = status_code
|
23
|
+
@reason_phrase = reason_phrase
|
24
|
+
@headers = headers
|
25
|
+
@raw_body = raw_body
|
26
|
+
@request = request
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,193 @@
|
|
1
|
+
# beaver
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Beaver
|
7
|
+
# AccountResp Model.
|
8
|
+
class AccountResp < BaseModel
|
9
|
+
# TODO: Write general description for this method
|
10
|
+
# @return [Balances]
|
11
|
+
attr_accessor :balances
|
12
|
+
|
13
|
+
# TODO: Write general description for this method
|
14
|
+
# @return [OwnerLegalEntities]
|
15
|
+
attr_accessor :beneficiary
|
16
|
+
|
17
|
+
# TODO: Write general description for this method
|
18
|
+
# @return [Integer]
|
19
|
+
attr_accessor :create_time
|
20
|
+
|
21
|
+
# TODO: Write general description for this method
|
22
|
+
# @return [Object]
|
23
|
+
attr_accessor :custom_data
|
24
|
+
|
25
|
+
# TODO: Write general description for this method
|
26
|
+
# @return [String]
|
27
|
+
attr_accessor :description
|
28
|
+
|
29
|
+
# TODO: Write general description for this method
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :enhanced_review
|
32
|
+
|
33
|
+
# TODO: Write general description for this method
|
34
|
+
# @return [String]
|
35
|
+
attr_accessor :id
|
36
|
+
|
37
|
+
# TODO: Write general description for this method
|
38
|
+
# @return [IncomingPaymentsResp]
|
39
|
+
attr_accessor :incoming_payments
|
40
|
+
|
41
|
+
# TODO: Write general description for this method
|
42
|
+
# @return [Industry]
|
43
|
+
attr_accessor :industry
|
44
|
+
|
45
|
+
# A non-empty string that does not contain the word wepay.
|
46
|
+
# @return [String]
|
47
|
+
attr_accessor :name
|
48
|
+
|
49
|
+
# A non-empty string that does not contain the word wepay.
|
50
|
+
# @return [OwnerLegalEntities]
|
51
|
+
attr_accessor :owner
|
52
|
+
|
53
|
+
# A non-empty string that does not contain the word wepay.
|
54
|
+
# @return [String]
|
55
|
+
attr_accessor :path
|
56
|
+
|
57
|
+
# A non-empty string that does not contain the word wepay.
|
58
|
+
# @return [PayoutResp]
|
59
|
+
attr_accessor :payout
|
60
|
+
|
61
|
+
# The pricing strategy to collect payment fees for each merchant.
|
62
|
+
# @return [Pricing]
|
63
|
+
attr_accessor :pricing
|
64
|
+
|
65
|
+
# The pricing strategy to collect payment fees for each merchant.
|
66
|
+
# @return [String]
|
67
|
+
attr_accessor :reference_id
|
68
|
+
|
69
|
+
# The pricing strategy to collect payment fees for each merchant.
|
70
|
+
# @return [String]
|
71
|
+
attr_accessor :resource
|
72
|
+
|
73
|
+
# A non-empty ASCII printable string does not contain the word wepay that
|
74
|
+
# appears on the merchants’ customers’ credit card statement.
|
75
|
+
# @return [String]
|
76
|
+
attr_accessor :statement_description
|
77
|
+
|
78
|
+
# A non-empty ASCII printable string does not contain the word wepay that
|
79
|
+
# appears on the merchants’ customers’ credit card statement.
|
80
|
+
# @return [String]
|
81
|
+
attr_accessor :api_version
|
82
|
+
|
83
|
+
# A mapping from model property names to API property names.
|
84
|
+
def self.names
|
85
|
+
@_hash = {} if @_hash.nil?
|
86
|
+
@_hash['balances'] = 'balances'
|
87
|
+
@_hash['beneficiary'] = 'beneficiary'
|
88
|
+
@_hash['create_time'] = 'create_time'
|
89
|
+
@_hash['custom_data'] = 'custom_data'
|
90
|
+
@_hash['description'] = 'description'
|
91
|
+
@_hash['enhanced_review'] = 'enhanced_review'
|
92
|
+
@_hash['id'] = 'id'
|
93
|
+
@_hash['incoming_payments'] = 'incoming_payments'
|
94
|
+
@_hash['industry'] = 'industry'
|
95
|
+
@_hash['name'] = 'name'
|
96
|
+
@_hash['owner'] = 'owner'
|
97
|
+
@_hash['path'] = 'path'
|
98
|
+
@_hash['payout'] = 'payout'
|
99
|
+
@_hash['pricing'] = 'pricing'
|
100
|
+
@_hash['reference_id'] = 'reference_id'
|
101
|
+
@_hash['resource'] = 'resource'
|
102
|
+
@_hash['statement_description'] = 'statement_description'
|
103
|
+
@_hash['api_version'] = 'api_version'
|
104
|
+
@_hash
|
105
|
+
end
|
106
|
+
|
107
|
+
def initialize(create_time = nil,
|
108
|
+
id = nil,
|
109
|
+
owner = nil,
|
110
|
+
path = nil,
|
111
|
+
pricing = nil,
|
112
|
+
resource = nil,
|
113
|
+
api_version = nil,
|
114
|
+
balances = nil,
|
115
|
+
beneficiary = nil,
|
116
|
+
custom_data = nil,
|
117
|
+
description = nil,
|
118
|
+
enhanced_review = nil,
|
119
|
+
incoming_payments = nil,
|
120
|
+
industry = nil,
|
121
|
+
name = nil,
|
122
|
+
payout = nil,
|
123
|
+
reference_id = nil,
|
124
|
+
statement_description = nil)
|
125
|
+
@balances = balances
|
126
|
+
@beneficiary = beneficiary
|
127
|
+
@create_time = create_time
|
128
|
+
@custom_data = custom_data
|
129
|
+
@description = description
|
130
|
+
@enhanced_review = enhanced_review
|
131
|
+
@id = id
|
132
|
+
@incoming_payments = incoming_payments
|
133
|
+
@industry = industry
|
134
|
+
@name = name
|
135
|
+
@owner = owner
|
136
|
+
@path = path
|
137
|
+
@payout = payout
|
138
|
+
@pricing = pricing
|
139
|
+
@reference_id = reference_id
|
140
|
+
@resource = resource
|
141
|
+
@statement_description = statement_description
|
142
|
+
@api_version = api_version
|
143
|
+
end
|
144
|
+
|
145
|
+
# Creates an instance of the object from a hash.
|
146
|
+
def self.from_hash(hash)
|
147
|
+
return nil unless hash
|
148
|
+
|
149
|
+
# Extract variables from the hash.
|
150
|
+
create_time = hash['create_time']
|
151
|
+
id = hash['id']
|
152
|
+
owner = OwnerLegalEntities.from_hash(hash['owner']) if hash['owner']
|
153
|
+
path = hash['path']
|
154
|
+
pricing = Pricing.from_hash(hash['pricing']) if hash['pricing']
|
155
|
+
resource = hash['resource']
|
156
|
+
api_version = hash['api_version']
|
157
|
+
balances = Balances.from_hash(hash['balances']) if hash['balances']
|
158
|
+
beneficiary = OwnerLegalEntities.from_hash(hash['beneficiary']) if
|
159
|
+
hash['beneficiary']
|
160
|
+
custom_data = hash['custom_data']
|
161
|
+
description = hash['description']
|
162
|
+
enhanced_review = hash['enhanced_review']
|
163
|
+
if hash['incoming_payments']
|
164
|
+
incoming_payments = IncomingPaymentsResp.from_hash(hash['incoming_payments'])
|
165
|
+
end
|
166
|
+
industry = Industry.from_hash(hash['industry']) if hash['industry']
|
167
|
+
name = hash['name']
|
168
|
+
payout = PayoutResp.from_hash(hash['payout']) if hash['payout']
|
169
|
+
reference_id = hash['reference_id']
|
170
|
+
statement_description = hash['statement_description']
|
171
|
+
|
172
|
+
# Create object from extracted values.
|
173
|
+
AccountResp.new(create_time,
|
174
|
+
id,
|
175
|
+
owner,
|
176
|
+
path,
|
177
|
+
pricing,
|
178
|
+
resource,
|
179
|
+
api_version,
|
180
|
+
balances,
|
181
|
+
beneficiary,
|
182
|
+
custom_data,
|
183
|
+
description,
|
184
|
+
enhanced_review,
|
185
|
+
incoming_payments,
|
186
|
+
industry,
|
187
|
+
name,
|
188
|
+
payout,
|
189
|
+
reference_id,
|
190
|
+
statement_description)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|