plaid 13.2.0 → 14.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +73 -9
- data/CONTRIBUTING.md +2 -32
- data/Dockerfile +11 -0
- data/Gemfile.lock +45 -40
- data/LICENSE.txt +1 -1
- data/PUBLISH.md +0 -1
- data/README.md +99 -93
- data/Rakefile +8 -79
- data/UPGRADING.md +4 -0
- data/docs/ACHClass.md +15 -0
- data/docs/APR.md +24 -0
- data/docs/AccountAssets.md +40 -0
- data/docs/AccountAssetsAllOf.md +24 -0
- data/docs/AccountBalance.md +26 -0
- data/docs/AccountBase.md +32 -0
- data/docs/AccountFiltersResponse.md +24 -0
- data/docs/AccountIdentity.md +34 -0
- data/docs/AccountIdentityAllOf.md +18 -0
- data/docs/AccountSubtype.md +15 -0
- data/docs/AccountType.md +15 -0
- data/docs/AccountsBalanceGetRequest.md +24 -0
- data/docs/AccountsBalanceGetRequestOptions.md +18 -0
- data/docs/AccountsGetRequest.md +24 -0
- data/docs/AccountsGetRequestOptions.md +18 -0
- data/docs/AccountsGetResponse.md +22 -0
- data/docs/Address.md +20 -0
- data/docs/AddressData.md +26 -0
- data/docs/Amount.md +20 -0
- data/docs/AssetReport.md +28 -0
- data/docs/AssetReportAuditCopyCreateRequest.md +24 -0
- data/docs/AssetReportAuditCopyCreateResponse.md +20 -0
- data/docs/AssetReportAuditCopyGetRequest.md +22 -0
- data/docs/AssetReportAuditCopyRemoveRequest.md +22 -0
- data/docs/AssetReportAuditCopyRemoveResponse.md +20 -0
- data/docs/AssetReportCreateRequest.md +26 -0
- data/docs/AssetReportCreateRequestOptions.md +22 -0
- data/docs/AssetReportCreateResponse.md +22 -0
- data/docs/AssetReportFilterRequest.md +24 -0
- data/docs/AssetReportFilterResponse.md +22 -0
- data/docs/AssetReportGetRequest.md +24 -0
- data/docs/AssetReportGetResponse.md +22 -0
- data/docs/AssetReportItem.md +26 -0
- data/docs/AssetReportPDFGetRequest.md +22 -0
- data/docs/AssetReportRefreshRequest.md +26 -0
- data/docs/AssetReportRefreshRequestOptions.md +22 -0
- data/docs/AssetReportRefreshResponse.md +22 -0
- data/docs/AssetReportRemoveRequest.md +22 -0
- data/docs/AssetReportRemoveResponse.md +20 -0
- data/docs/AssetReportTransaction.md +58 -0
- data/docs/AssetReportTransactionAllOf.md +20 -0
- data/docs/AssetReportUser.md +30 -0
- data/docs/AssetsErrorWebhook.md +24 -0
- data/docs/AssetsProductReadyWebhook.md +22 -0
- data/docs/AuthGetNumbers.md +24 -0
- data/docs/AuthGetRequest.md +24 -0
- data/docs/AuthGetRequestOptions.md +18 -0
- data/docs/AuthGetResponse.md +24 -0
- data/docs/AutomaticallyVerifiedWebhook.md +24 -0
- data/docs/BankTransfer.md +50 -0
- data/docs/BankTransferBalance.md +20 -0
- data/docs/BankTransferBalanceGetRequest.md +22 -0
- data/docs/BankTransferBalanceGetResponse.md +22 -0
- data/docs/BankTransferCancelRequest.md +22 -0
- data/docs/BankTransferCancelResponse.md +18 -0
- data/docs/BankTransferCreateRequest.md +46 -0
- data/docs/BankTransferCreateResponse.md +20 -0
- data/docs/BankTransferDirection.md +15 -0
- data/docs/BankTransferEvent.md +40 -0
- data/docs/BankTransferEventListRequest.md +40 -0
- data/docs/BankTransferEventListResponse.md +20 -0
- data/docs/BankTransferEventSyncRequest.md +24 -0
- data/docs/BankTransferEventSyncResponse.md +20 -0
- data/docs/BankTransferEventType.md +15 -0
- data/docs/BankTransferFailure.md +20 -0
- data/docs/BankTransferGetRequest.md +22 -0
- data/docs/BankTransferGetResponse.md +20 -0
- data/docs/BankTransferListRequest.md +32 -0
- data/docs/BankTransferListResponse.md +20 -0
- data/docs/BankTransferMigrateAccountRequest.md +26 -0
- data/docs/BankTransferMigrateAccountResponse.md +22 -0
- data/docs/BankTransferNetwork.md +15 -0
- data/docs/BankTransferReceiverDetails.md +18 -0
- data/docs/BankTransferStatus.md +15 -0
- data/docs/BankTransferType.md +15 -0
- data/docs/BankTransferUser.md +22 -0
- data/docs/CategoriesGetResponse.md +20 -0
- data/docs/Category.md +22 -0
- data/docs/Cause.md +20 -0
- data/docs/CountryCode.md +15 -0
- data/docs/CreditCardLiability.md +34 -0
- data/docs/CreditFilter.md +18 -0
- data/docs/DefaultUpdateWebhook.md +26 -0
- data/docs/DepositSwitchAddressData.md +26 -0
- data/docs/DepositSwitchAltCreateRequest.md +24 -0
- data/docs/DepositSwitchAltCreateResponse.md +20 -0
- data/docs/DepositSwitchCreateRequest.md +24 -0
- data/docs/DepositSwitchCreateResponse.md +20 -0
- data/docs/DepositSwitchGetRequest.md +22 -0
- data/docs/DepositSwitchGetResponse.md +38 -0
- data/docs/DepositSwitchTargetAccount.md +24 -0
- data/docs/DepositSwitchTargetUser.md +28 -0
- data/docs/DepositSwitchTokenCreateRequest.md +22 -0
- data/docs/DepositSwitchTokenCreateResponse.md +22 -0
- data/docs/DepositoryFilter.md +18 -0
- data/docs/Email.md +22 -0
- data/docs/Employee.md +22 -0
- data/docs/EmployeeIncomeSummaryFieldString.md +20 -0
- data/docs/Employer.md +24 -0
- data/docs/EmployerIncomeSummaryFieldString.md +20 -0
- data/docs/EmployersSearchRequest.md +24 -0
- data/docs/EmployersSearchResponse.md +20 -0
- data/docs/Error.md +34 -0
- data/docs/ExternalPaymentSchedule.md +24 -0
- data/docs/HealthIncident.md +24 -0
- data/docs/HistoricalBalance.md +24 -0
- data/docs/HistoricalUpdateWebhook.md +26 -0
- data/docs/Holding.md +34 -0
- data/docs/HoldingsDefaultUpdateWebhook.md +28 -0
- data/docs/IdentityGetRequest.md +24 -0
- data/docs/IdentityGetRequestOptions.md +18 -0
- data/docs/IdentityGetResponse.md +22 -0
- data/docs/IncidentUpdate.md +22 -0
- data/docs/IncomeBreakdown.md +24 -0
- data/docs/IncomeSummary.md +30 -0
- data/docs/IncomeSummaryFieldNumber.md +20 -0
- data/docs/IncomeSummaryFieldString.md +20 -0
- data/docs/IncomeVerificationCreateRequest.md +22 -0
- data/docs/IncomeVerificationCreateResponse.md +20 -0
- data/docs/IncomeVerificationDocumentsDownloadRequest.md +22 -0
- data/docs/IncomeVerificationDocumentsDownloadResponse.md +18 -0
- data/docs/IncomeVerificationPaystubGetRequest.md +22 -0
- data/docs/IncomeVerificationPaystubGetResponse.md +20 -0
- data/docs/IncomeVerificationStatusWebhook.md +24 -0
- data/docs/IncomeVerificationSummaryGetRequest.md +22 -0
- data/docs/IncomeVerificationSummaryGetResponse.md +20 -0
- data/docs/IncomeVerificationWebhookStatus.md +18 -0
- data/docs/InflowModel.md +26 -0
- data/docs/InitialUpdateWebhook.md +26 -0
- data/docs/Institution.md +36 -0
- data/docs/InstitutionStatus.md +30 -0
- data/docs/InstitutionsGetByIdRequest.md +26 -0
- data/docs/InstitutionsGetByIdRequestOptions.md +20 -0
- data/docs/InstitutionsGetByIdResponse.md +20 -0
- data/docs/InstitutionsGetRequest.md +28 -0
- data/docs/InstitutionsGetRequestOptions.md +24 -0
- data/docs/InstitutionsGetResponse.md +22 -0
- data/docs/InstitutionsSearchAccountFilter.md +24 -0
- data/docs/InstitutionsSearchRequest.md +28 -0
- data/docs/InstitutionsSearchRequestOptions.md +22 -0
- data/docs/InstitutionsSearchResponse.md +20 -0
- data/docs/InvestmentFilter.md +18 -0
- data/docs/InvestmentHoldingsGetRequestOptions.md +18 -0
- data/docs/InvestmentTransaction.md +44 -0
- data/docs/InvestmentsDefaultUpdateWebhook.md +28 -0
- data/docs/InvestmentsHoldingsGetRequest.md +24 -0
- data/docs/InvestmentsHoldingsGetResponse.md +26 -0
- data/docs/InvestmentsTransactionsGetRequest.md +28 -0
- data/docs/InvestmentsTransactionsGetRequestOptions.md +22 -0
- data/docs/InvestmentsTransactionsGetResponse.md +28 -0
- data/docs/Item.md +32 -0
- data/docs/ItemAccessTokenInvalidateRequest.md +22 -0
- data/docs/ItemAccessTokenInvalidateResponse.md +20 -0
- data/docs/ItemErrorWebhook.md +24 -0
- data/docs/ItemGetRequest.md +22 -0
- data/docs/ItemGetResponse.md +24 -0
- data/docs/ItemImportRequest.md +26 -0
- data/docs/ItemImportRequestOptions.md +18 -0
- data/docs/ItemImportRequestUserAuth.md +20 -0
- data/docs/ItemImportResponse.md +20 -0
- data/docs/ItemProductReadyWebhook.md +24 -0
- data/docs/ItemPublicTokenCreateRequest.md +22 -0
- data/docs/ItemPublicTokenCreateResponse.md +22 -0
- data/docs/ItemPublicTokenExchangeRequest.md +22 -0
- data/docs/ItemPublicTokenExchangeResponse.md +22 -0
- data/docs/ItemRemoveRequest.md +22 -0
- data/docs/ItemRemoveResponse.md +18 -0
- data/docs/ItemStatus.md +22 -0
- data/docs/ItemStatusInvestments.md +20 -0
- data/docs/ItemStatusLastWebhook.md +20 -0
- data/docs/ItemStatusTransactions.md +20 -0
- data/docs/ItemWebhookUpdateRequest.md +24 -0
- data/docs/ItemWebhookUpdateResponse.md +20 -0
- data/docs/JWKPublicKey.md +34 -0
- data/docs/JWTHeader.md +18 -0
- data/docs/LiabilitiesGetRequest.md +24 -0
- data/docs/LiabilitiesGetRequestOptions.md +18 -0
- data/docs/LiabilitiesGetResponse.md +24 -0
- data/docs/LiabilitiesObject.md +22 -0
- data/docs/LiabilityOverride.md +66 -0
- data/docs/LinkTokenAccountFilters.md +24 -0
- data/docs/LinkTokenCreateRequest.md +48 -0
- data/docs/LinkTokenCreateRequestAccountSubtypes.md +24 -0
- data/docs/LinkTokenCreateRequestAccountSubtypesCredit.md +18 -0
- data/docs/LinkTokenCreateRequestAccountSubtypesDepository.md +18 -0
- data/docs/LinkTokenCreateRequestAccountSubtypesInvestment.md +18 -0
- data/docs/LinkTokenCreateRequestAccountSubtypesLoan.md +18 -0
- data/docs/LinkTokenCreateRequestDepositSwitch.md +18 -0
- data/docs/LinkTokenCreateRequestIncomeVerification.md +20 -0
- data/docs/LinkTokenCreateRequestPaymentInitiation.md +18 -0
- data/docs/LinkTokenCreateRequestUser.md +32 -0
- data/docs/LinkTokenCreateResponse.md +22 -0
- data/docs/LinkTokenGetMetadataResponse.md +30 -0
- data/docs/LinkTokenGetRequest.md +22 -0
- data/docs/LinkTokenGetResponse.md +26 -0
- data/docs/LoanFilter.md +18 -0
- data/docs/Location.md +32 -0
- data/docs/MFA.md +26 -0
- data/docs/Meta.md +22 -0
- data/docs/MortgageInterestRate.md +20 -0
- data/docs/MortgageLiability.md +56 -0
- data/docs/MortgagePropertyAddress.md +26 -0
- data/docs/NullableAccessToken.md +15 -0
- data/docs/NullableAddress.md +20 -0
- data/docs/NullableAddressData.md +26 -0
- data/docs/NullableItemStatus.md +22 -0
- data/docs/NullableNumbersACH.md +24 -0
- data/docs/NullableNumbersBACS.md +22 -0
- data/docs/NullableNumbersEFT.md +24 -0
- data/docs/NullableNumbersInternational.md +22 -0
- data/docs/NullableRecipientBACS.md +20 -0
- data/docs/Numbers.md +32 -0
- data/docs/NumbersACH.md +24 -0
- data/docs/NumbersBACS.md +22 -0
- data/docs/NumbersEFT.md +24 -0
- data/docs/NumbersInternational.md +22 -0
- data/docs/OverrideAccounts.md +38 -0
- data/docs/Owner.md +24 -0
- data/docs/OwnerOverride.md +24 -0
- data/docs/PSLFStatus.md +22 -0
- data/docs/PayFrequency.md +20 -0
- data/docs/PayPeriodDetails.md +26 -0
- data/docs/PaymentAmount.md +20 -0
- data/docs/PaymentInitiationAddress.md +24 -0
- data/docs/PaymentInitiationPaymentCreateRequest.md +28 -0
- data/docs/PaymentInitiationPaymentCreateResponse.md +22 -0
- data/docs/PaymentInitiationPaymentGetRequest.md +22 -0
- data/docs/PaymentInitiationPaymentGetResponse.md +32 -0
- data/docs/PaymentInitiationPaymentListRequest.md +24 -0
- data/docs/PaymentInitiationPaymentListResponse.md +22 -0
- data/docs/PaymentInitiationPaymentTokenCreateRequest.md +22 -0
- data/docs/PaymentInitiationPaymentTokenCreateResponse.md +22 -0
- data/docs/PaymentInitiationRecipient.md +26 -0
- data/docs/PaymentInitiationRecipientBacs.md +20 -0
- data/docs/PaymentInitiationRecipientCreateRequest.md +28 -0
- data/docs/PaymentInitiationRecipientCreateResponse.md +20 -0
- data/docs/PaymentInitiationRecipientGetRequest.md +22 -0
- data/docs/PaymentInitiationRecipientGetResponse.md +28 -0
- data/docs/PaymentInitiationRecipientListRequest.md +20 -0
- data/docs/PaymentInitiationRecipientListResponse.md +20 -0
- data/docs/PaymentMeta.md +32 -0
- data/docs/PaymentStatusUpdateWebhook.md +30 -0
- data/docs/Paystub.md +30 -0
- data/docs/PaystubDeduction.md +22 -0
- data/docs/PaystubYTDDetails.md +20 -0
- data/docs/PendingExpirationWebhook.md +24 -0
- data/docs/PhoneNumber.md +22 -0
- data/docs/PlaidApi.md +5580 -0
- data/docs/ProcessorApexProcessorTokenCreateRequest.md +24 -0
- data/docs/ProcessorAuthGetRequest.md +22 -0
- data/docs/ProcessorAuthGetResponse.md +22 -0
- data/docs/ProcessorBalanceGetRequest.md +22 -0
- data/docs/ProcessorBalanceGetResponse.md +20 -0
- data/docs/ProcessorIdentityGetRequest.md +22 -0
- data/docs/ProcessorIdentityGetResponse.md +20 -0
- data/docs/ProcessorNumber.md +24 -0
- data/docs/ProcessorStripeBankAccountTokenCreateRequest.md +24 -0
- data/docs/ProcessorStripeBankAccountTokenCreateResponse.md +20 -0
- data/docs/ProcessorTokenCreateRequest.md +26 -0
- data/docs/ProcessorTokenCreateResponse.md +20 -0
- data/docs/ProductStatus.md +22 -0
- data/docs/ProductStatusBreakdown.md +24 -0
- data/docs/Products.md +15 -0
- data/docs/ProjectedIncomeSummaryFieldNumber.md +20 -0
- data/docs/RecaptchaRequiredError.md +30 -0
- data/docs/RecipientBACS.md +20 -0
- data/docs/SandboxBankTransferSimulateRequest.md +26 -0
- data/docs/SandboxBankTransferSimulateResponse.md +18 -0
- data/docs/SandboxItemFireWebhookRequest.md +24 -0
- data/docs/SandboxItemFireWebhookResponse.md +20 -0
- data/docs/SandboxItemResetLoginRequest.md +22 -0
- data/docs/SandboxItemResetLoginResponse.md +20 -0
- data/docs/SandboxItemSetVerificationStatusRequest.md +26 -0
- data/docs/SandboxItemSetVerificationStatusResponse.md +18 -0
- data/docs/SandboxProcessorTokenCreateRequest.md +24 -0
- data/docs/SandboxProcessorTokenCreateRequestOptions.md +20 -0
- data/docs/SandboxProcessorTokenCreateResponse.md +20 -0
- data/docs/SandboxPublicTokenCreateRequest.md +26 -0
- data/docs/SandboxPublicTokenCreateRequestOptions.md +24 -0
- data/docs/SandboxPublicTokenCreateRequestOptionsTransactions.md +20 -0
- data/docs/SandboxPublicTokenCreateResponse.md +20 -0
- data/docs/Security.md +46 -0
- data/docs/ServicerAddressData.md +26 -0
- data/docs/StandaloneAccountType.md +26 -0
- data/docs/StandaloneCurrencyCodeList.md +20 -0
- data/docs/StandaloneInvestmentTransactionSubtype.md +104 -0
- data/docs/StandaloneInvestmentTransactionType.md +28 -0
- data/docs/StudentLoan.md +66 -0
- data/docs/StudentLoanRepaymentModel.md +22 -0
- data/docs/StudentLoanStatus.md +20 -0
- data/docs/StudentRepaymentPlan.md +20 -0
- data/docs/Transaction.md +54 -0
- data/docs/TransactionCode.md +15 -0
- data/docs/TransactionData.md +26 -0
- data/docs/TransactionOverride.md +26 -0
- data/docs/TransactionsGetRequest.md +28 -0
- data/docs/TransactionsGetRequestOptions.md +22 -0
- data/docs/TransactionsGetResponse.md +26 -0
- data/docs/TransactionsRefreshRequest.md +22 -0
- data/docs/TransactionsRefreshResponse.md +18 -0
- data/docs/TransactionsRemovedWebhook.md +26 -0
- data/docs/UserCustomPassword.md +28 -0
- data/docs/UserPermissionRevokedWebhook.md +24 -0
- data/docs/VerificationExpiredWebhook.md +24 -0
- data/docs/VerificationStatus.md +15 -0
- data/docs/Warning.md +22 -0
- data/docs/WebhookUpdateAcknowledgedWebhook.md +26 -0
- data/docs/WebhookVerificationKeyGetRequest.md +22 -0
- data/docs/WebhookVerificationKeyGetResponse.md +20 -0
- data/docs/YTDGrossIncomeSummaryFieldNumber.md +20 -0
- data/docs/YTDNetIncomeSummaryFieldNumber.md +20 -0
- data/lib/plaid.rb +343 -61
- data/lib/plaid/api/plaid_api.rb +4414 -0
- data/lib/plaid/api_client.rb +383 -0
- data/lib/plaid/api_error.rb +57 -0
- data/lib/plaid/configuration.rb +297 -0
- data/lib/plaid/models/account_assets.rb +406 -0
- data/lib/plaid/models/account_assets_all_of.rb +263 -0
- data/lib/plaid/models/account_balance.rb +269 -0
- data/lib/plaid/models/account_base.rb +345 -0
- data/lib/plaid/models/account_filters_response.rb +246 -0
- data/lib/plaid/models/account_identity.rb +369 -0
- data/lib/plaid/models/account_identity_all_of.rb +226 -0
- data/lib/plaid/models/account_subtype.rb +101 -0
- data/lib/plaid/models/account_type.rb +41 -0
- data/lib/plaid/models/accounts_balance_get_request.rb +254 -0
- data/lib/plaid/models/accounts_balance_get_request_options.rb +222 -0
- data/lib/plaid/models/accounts_get_request.rb +254 -0
- data/lib/plaid/models/accounts_get_request_options.rb +222 -0
- data/lib/plaid/models/accounts_get_response.rb +256 -0
- data/lib/plaid/models/ach_class.rb +50 -0
- data/lib/plaid/models/address.rb +235 -0
- data/lib/plaid/models/address_data.rb +277 -0
- data/lib/plaid/models/amount.rb +274 -0
- data/lib/plaid/models/apr.rb +296 -0
- data/lib/plaid/models/asset_report.rb +301 -0
- data/lib/plaid/models/asset_report_audit_copy_create_request.rb +260 -0
- data/lib/plaid/models/asset_report_audit_copy_create_response.rb +240 -0
- data/lib/plaid/models/asset_report_audit_copy_get_request.rb +245 -0
- data/lib/plaid/models/asset_report_audit_copy_remove_request.rb +245 -0
- data/lib/plaid/models/asset_report_audit_copy_remove_response.rb +240 -0
- data/lib/plaid/models/asset_report_create_request.rb +299 -0
- data/lib/plaid/models/asset_report_create_request_options.rb +239 -0
- data/lib/plaid/models/asset_report_create_response.rb +255 -0
- data/lib/plaid/models/asset_report_filter_request.rb +262 -0
- data/lib/plaid/models/asset_report_filter_response.rb +255 -0
- data/lib/plaid/models/asset_report_get_request.rb +255 -0
- data/lib/plaid/models/asset_report_get_response.rb +256 -0
- data/lib/plaid/models/asset_report_item.rb +287 -0
- data/lib/plaid/models/asset_report_pdf_get_request.rb +245 -0
- data/lib/plaid/models/asset_report_refresh_request.rb +288 -0
- data/lib/plaid/models/asset_report_refresh_request_options.rb +239 -0
- data/lib/plaid/models/asset_report_refresh_response.rb +255 -0
- data/lib/plaid/models/asset_report_remove_request.rb +245 -0
- data/lib/plaid/models/asset_report_remove_response.rb +240 -0
- data/lib/plaid/models/asset_report_transaction.rb +511 -0
- data/lib/plaid/models/asset_report_transaction_all_of.rb +235 -0
- data/lib/plaid/models/asset_report_user.rb +287 -0
- data/lib/plaid/models/assets_error_webhook.rb +265 -0
- data/lib/plaid/models/assets_product_ready_webhook.rb +255 -0
- data/lib/plaid/models/auth_get_numbers.rb +258 -0
- data/lib/plaid/models/auth_get_request.rb +254 -0
- data/lib/plaid/models/auth_get_request_options.rb +222 -0
- data/lib/plaid/models/auth_get_response.rb +270 -0
- data/lib/plaid/models/automatically_verified_webhook.rb +270 -0
- data/lib/plaid/models/bank_transfer.rb +444 -0
- data/lib/plaid/models/bank_transfer_balance.rb +239 -0
- data/lib/plaid/models/bank_transfer_balance_get_request.rb +241 -0
- data/lib/plaid/models/bank_transfer_balance_get_response.rb +250 -0
- data/lib/plaid/models/bank_transfer_cancel_request.rb +245 -0
- data/lib/plaid/models/bank_transfer_cancel_response.rb +225 -0
- data/lib/plaid/models/bank_transfer_create_request.rb +459 -0
- data/lib/plaid/models/bank_transfer_create_response.rb +239 -0
- data/lib/plaid/models/bank_transfer_direction.rb +37 -0
- data/lib/plaid/models/bank_transfer_event.rb +388 -0
- data/lib/plaid/models/bank_transfer_event_list_request.rb +418 -0
- data/lib/plaid/models/bank_transfer_event_list_response.rb +241 -0
- data/lib/plaid/models/bank_transfer_event_sync_request.rb +301 -0
- data/lib/plaid/models/bank_transfer_event_sync_response.rb +241 -0
- data/lib/plaid/models/bank_transfer_event_type.rb +42 -0
- data/lib/plaid/models/bank_transfer_failure.rb +231 -0
- data/lib/plaid/models/bank_transfer_get_request.rb +245 -0
- data/lib/plaid/models/bank_transfer_get_response.rb +239 -0
- data/lib/plaid/models/bank_transfer_list_request.rb +336 -0
- data/lib/plaid/models/bank_transfer_list_response.rb +241 -0
- data/lib/plaid/models/bank_transfer_migrate_account_request.rb +275 -0
- data/lib/plaid/models/bank_transfer_migrate_account_response.rb +255 -0
- data/lib/plaid/models/bank_transfer_network.rb +38 -0
- data/lib/plaid/models/bank_transfer_receiver_details.rb +255 -0
- data/lib/plaid/models/bank_transfer_status.rb +40 -0
- data/lib/plaid/models/bank_transfer_type.rb +37 -0
- data/lib/plaid/models/bank_transfer_user.rb +246 -0
- data/lib/plaid/models/categories_get_response.rb +242 -0
- data/lib/plaid/models/category.rb +257 -0
- data/lib/plaid/models/cause.rb +235 -0
- data/lib/plaid/models/country_code.rb +42 -0
- data/lib/plaid/models/credit_card_liability.rb +339 -0
- data/lib/plaid/models/credit_filter.rb +227 -0
- data/lib/plaid/models/default_update_webhook.rb +280 -0
- data/lib/plaid/models/deposit_switch_address_data.rb +285 -0
- data/lib/plaid/models/deposit_switch_alt_create_request.rb +258 -0
- data/lib/plaid/models/deposit_switch_alt_create_response.rb +240 -0
- data/lib/plaid/models/deposit_switch_create_request.rb +260 -0
- data/lib/plaid/models/deposit_switch_create_response.rb +240 -0
- data/lib/plaid/models/deposit_switch_get_request.rb +245 -0
- data/lib/plaid/models/deposit_switch_get_response.rb +381 -0
- data/lib/plaid/models/deposit_switch_target_account.rb +303 -0
- data/lib/plaid/models/deposit_switch_target_user.rb +288 -0
- data/lib/plaid/models/deposit_switch_token_create_request.rb +245 -0
- data/lib/plaid/models/deposit_switch_token_create_response.rb +255 -0
- data/lib/plaid/models/depository_filter.rb +227 -0
- data/lib/plaid/models/email.rb +289 -0
- data/lib/plaid/models/employee.rb +242 -0
- data/lib/plaid/models/employee_income_summary_field_string.rb +245 -0
- data/lib/plaid/models/employer.rb +261 -0
- data/lib/plaid/models/employer_income_summary_field_string.rb +245 -0
- data/lib/plaid/models/employers_search_request.rb +262 -0
- data/lib/plaid/models/employers_search_response.rb +242 -0
- data/lib/plaid/models/error.rb +360 -0
- data/lib/plaid/models/external_payment_schedule.rb +265 -0
- data/lib/plaid/models/health_incident.rb +253 -0
- data/lib/plaid/models/historical_balance.rb +262 -0
- data/lib/plaid/models/historical_update_webhook.rb +280 -0
- data/lib/plaid/models/holding.rb +329 -0
- data/lib/plaid/models/holdings_default_update_webhook.rb +295 -0
- data/lib/plaid/models/identity_get_request.rb +254 -0
- data/lib/plaid/models/identity_get_request_options.rb +222 -0
- data/lib/plaid/models/identity_get_response.rb +256 -0
- data/lib/plaid/models/incident_update.rb +273 -0
- data/lib/plaid/models/income_breakdown.rb +253 -0
- data/lib/plaid/models/income_summary.rb +275 -0
- data/lib/plaid/models/income_summary_field_number.rb +238 -0
- data/lib/plaid/models/income_summary_field_string.rb +238 -0
- data/lib/plaid/models/income_verification_create_request.rb +245 -0
- data/lib/plaid/models/income_verification_create_response.rb +240 -0
- data/lib/plaid/models/income_verification_documents_download_request.rb +245 -0
- data/lib/plaid/models/income_verification_documents_download_response.rb +224 -0
- data/lib/plaid/models/income_verification_paystub_get_request.rb +245 -0
- data/lib/plaid/models/income_verification_paystub_get_response.rb +229 -0
- data/lib/plaid/models/income_verification_status_webhook.rb +270 -0
- data/lib/plaid/models/income_verification_summary_get_request.rb +245 -0
- data/lib/plaid/models/income_verification_summary_get_response.rb +242 -0
- data/lib/plaid/models/income_verification_webhook_status.rb +223 -0
- data/lib/plaid/models/inflow_model.rb +285 -0
- data/lib/plaid/models/initial_update_webhook.rb +281 -0
- data/lib/plaid/models/institution.rb +344 -0
- data/lib/plaid/models/institution_status.rb +307 -0
- data/lib/plaid/models/institutions_get_by_id_request.rb +271 -0
- data/lib/plaid/models/institutions_get_by_id_request_options.rb +234 -0
- data/lib/plaid/models/institutions_get_by_id_response.rb +239 -0
- data/lib/plaid/models/institutions_get_request.rb +305 -0
- data/lib/plaid/models/institutions_get_request_options.rb +254 -0
- data/lib/plaid/models/institutions_get_response.rb +257 -0
- data/lib/plaid/models/institutions_search_account_filter.rb +253 -0
- data/lib/plaid/models/institutions_search_request.rb +288 -0
- data/lib/plaid/models/institutions_search_request_options.rb +239 -0
- data/lib/plaid/models/institutions_search_response.rb +242 -0
- data/lib/plaid/models/investment_filter.rb +227 -0
- data/lib/plaid/models/investment_holdings_get_request_options.rb +222 -0
- data/lib/plaid/models/investment_transaction.rb +445 -0
- data/lib/plaid/models/investments_default_update_webhook.rb +295 -0
- data/lib/plaid/models/investments_holdings_get_request.rb +254 -0
- data/lib/plaid/models/investments_holdings_get_response.rb +290 -0
- data/lib/plaid/models/investments_transactions_get_request.rb +284 -0
- data/lib/plaid/models/investments_transactions_get_request_options.rb +285 -0
- data/lib/plaid/models/investments_transactions_get_response.rb +305 -0
- data/lib/plaid/models/item.rb +311 -0
- data/lib/plaid/models/item_access_token_invalidate_request.rb +245 -0
- data/lib/plaid/models/item_access_token_invalidate_response.rb +240 -0
- data/lib/plaid/models/item_error_webhook.rb +265 -0
- data/lib/plaid/models/item_get_request.rb +245 -0
- data/lib/plaid/models/item_get_response.rb +259 -0
- data/lib/plaid/models/item_import_request.rb +270 -0
- data/lib/plaid/models/item_import_request_options.rb +220 -0
- data/lib/plaid/models/item_import_request_user_auth.rb +240 -0
- data/lib/plaid/models/item_import_response.rb +240 -0
- data/lib/plaid/models/item_product_ready_webhook.rb +265 -0
- data/lib/plaid/models/item_public_token_create_request.rb +245 -0
- data/lib/plaid/models/item_public_token_create_response.rb +249 -0
- data/lib/plaid/models/item_public_token_exchange_request.rb +245 -0
- data/lib/plaid/models/item_public_token_exchange_response.rb +255 -0
- data/lib/plaid/models/item_remove_request.rb +245 -0
- data/lib/plaid/models/item_remove_response.rb +225 -0
- data/lib/plaid/models/item_status.rb +240 -0
- data/lib/plaid/models/item_status_investments.rb +232 -0
- data/lib/plaid/models/item_status_last_webhook.rb +232 -0
- data/lib/plaid/models/item_status_transactions.rb +232 -0
- data/lib/plaid/models/item_webhook_update_request.rb +260 -0
- data/lib/plaid/models/item_webhook_update_response.rb +239 -0
- data/lib/plaid/models/jwk_public_key.rb +299 -0
- data/lib/plaid/models/jwt_header.rb +224 -0
- data/lib/plaid/models/liabilities_get_request.rb +254 -0
- data/lib/plaid/models/liabilities_get_request_options.rb +222 -0
- data/lib/plaid/models/liabilities_get_response.rb +270 -0
- data/lib/plaid/models/liabilities_object.rb +249 -0
- data/lib/plaid/models/liability_override.rb +583 -0
- data/lib/plaid/models/link_token_account_filters.rb +246 -0
- data/lib/plaid/models/link_token_create_request.rb +390 -0
- data/lib/plaid/models/link_token_create_request_account_subtypes.rb +246 -0
- data/lib/plaid/models/link_token_create_request_account_subtypes_credit.rb +222 -0
- data/lib/plaid/models/link_token_create_request_account_subtypes_depository.rb +222 -0
- data/lib/plaid/models/link_token_create_request_account_subtypes_investment.rb +222 -0
- data/lib/plaid/models/link_token_create_request_account_subtypes_loan.rb +222 -0
- data/lib/plaid/models/link_token_create_request_deposit_switch.rb +225 -0
- data/lib/plaid/models/link_token_create_request_income_verification.rb +236 -0
- data/lib/plaid/models/link_token_create_request_payment_initiation.rb +225 -0
- data/lib/plaid/models/link_token_create_request_user.rb +295 -0
- data/lib/plaid/models/link_token_create_response.rb +255 -0
- data/lib/plaid/models/link_token_get_metadata_response.rb +287 -0
- data/lib/plaid/models/link_token_get_request.rb +245 -0
- data/lib/plaid/models/link_token_get_response.rb +266 -0
- data/lib/plaid/models/loan_filter.rb +227 -0
- data/lib/plaid/models/location.rb +298 -0
- data/lib/plaid/models/meta.rb +255 -0
- data/lib/plaid/models/mfa.rb +285 -0
- data/lib/plaid/models/mortgage_interest_rate.rb +232 -0
- data/lib/plaid/models/mortgage_liability.rb +430 -0
- data/lib/plaid/models/mortgage_property_address.rb +265 -0
- data/lib/plaid/models/nullable_access_token.rb +209 -0
- data/lib/plaid/models/nullable_address.rb +241 -0
- data/lib/plaid/models/nullable_address_data.rb +283 -0
- data/lib/plaid/models/nullable_item_status.rb +246 -0
- data/lib/plaid/models/nullable_numbers_ach.rb +272 -0
- data/lib/plaid/models/nullable_numbers_bacs.rb +261 -0
- data/lib/plaid/models/nullable_numbers_eft.rb +276 -0
- data/lib/plaid/models/nullable_numbers_international.rb +261 -0
- data/lib/plaid/models/nullable_recipient_bacs.rb +236 -0
- data/lib/plaid/models/numbers.rb +330 -0
- data/lib/plaid/models/numbers_ach.rb +266 -0
- data/lib/plaid/models/numbers_bacs.rb +255 -0
- data/lib/plaid/models/numbers_eft.rb +270 -0
- data/lib/plaid/models/numbers_international.rb +255 -0
- data/lib/plaid/models/override_accounts.rb +366 -0
- data/lib/plaid/models/owner.rb +278 -0
- data/lib/plaid/models/owner_override.rb +278 -0
- data/lib/plaid/models/pay_frequency.rb +272 -0
- data/lib/plaid/models/pay_period_details.rb +265 -0
- data/lib/plaid/models/payment_amount.rb +240 -0
- data/lib/plaid/models/payment_initiation_address.rb +252 -0
- data/lib/plaid/models/payment_initiation_payment_create_request.rb +284 -0
- data/lib/plaid/models/payment_initiation_payment_create_response.rb +255 -0
- data/lib/plaid/models/payment_initiation_payment_get_request.rb +245 -0
- data/lib/plaid/models/payment_initiation_payment_get_response.rb +353 -0
- data/lib/plaid/models/payment_initiation_payment_list_request.rb +267 -0
- data/lib/plaid/models/payment_initiation_payment_list_response.rb +257 -0
- data/lib/plaid/models/payment_initiation_payment_token_create_request.rb +245 -0
- data/lib/plaid/models/payment_initiation_payment_token_create_response.rb +255 -0
- data/lib/plaid/models/payment_initiation_recipient.rb +271 -0
- data/lib/plaid/models/payment_initiation_recipient_bacs.rb +237 -0
- data/lib/plaid/models/payment_initiation_recipient_create_request.rb +275 -0
- data/lib/plaid/models/payment_initiation_recipient_create_response.rb +240 -0
- data/lib/plaid/models/payment_initiation_recipient_get_request.rb +245 -0
- data/lib/plaid/models/payment_initiation_recipient_get_response.rb +286 -0
- data/lib/plaid/models/payment_initiation_recipient_list_request.rb +230 -0
- data/lib/plaid/models/payment_initiation_recipient_list_response.rb +242 -0
- data/lib/plaid/models/payment_meta.rb +298 -0
- data/lib/plaid/models/payment_status_update_webhook.rb +356 -0
- data/lib/plaid/models/paystub.rb +306 -0
- data/lib/plaid/models/paystub_deduction.rb +242 -0
- data/lib/plaid/models/paystub_ytd_details.rb +239 -0
- data/lib/plaid/models/pending_expiration_webhook.rb +270 -0
- data/lib/plaid/models/phone_number.rb +281 -0
- data/lib/plaid/models/processor_apex_processor_token_create_request.rb +260 -0
- data/lib/plaid/models/processor_auth_get_request.rb +245 -0
- data/lib/plaid/models/processor_auth_get_response.rb +253 -0
- data/lib/plaid/models/processor_balance_get_request.rb +245 -0
- data/lib/plaid/models/processor_balance_get_response.rb +239 -0
- data/lib/plaid/models/processor_identity_get_request.rb +245 -0
- data/lib/plaid/models/processor_identity_get_response.rb +239 -0
- data/lib/plaid/models/processor_number.rb +250 -0
- data/lib/plaid/models/processor_stripe_bank_account_token_create_request.rb +260 -0
- data/lib/plaid/models/processor_stripe_bank_account_token_create_response.rb +240 -0
- data/lib/plaid/models/processor_token_create_request.rb +275 -0
- data/lib/plaid/models/processor_token_create_response.rb +240 -0
- data/lib/plaid/models/product_status.rb +288 -0
- data/lib/plaid/models/product_status_breakdown.rb +300 -0
- data/lib/plaid/models/products.rb +45 -0
- data/lib/plaid/models/projected_income_summary_field_number.rb +245 -0
- data/lib/plaid/models/pslf_status.rb +243 -0
- data/lib/plaid/models/recaptcha_required_error.rb +314 -0
- data/lib/plaid/models/recipient_bacs.rb +230 -0
- data/lib/plaid/models/sandbox_bank_transfer_simulate_request.rb +270 -0
- data/lib/plaid/models/sandbox_bank_transfer_simulate_response.rb +225 -0
- data/lib/plaid/models/sandbox_item_fire_webhook_request.rb +289 -0
- data/lib/plaid/models/sandbox_item_fire_webhook_response.rb +240 -0
- data/lib/plaid/models/sandbox_item_reset_login_request.rb +245 -0
- data/lib/plaid/models/sandbox_item_reset_login_response.rb +240 -0
- data/lib/plaid/models/sandbox_item_set_verification_status_request.rb +309 -0
- data/lib/plaid/models/sandbox_item_set_verification_status_response.rb +225 -0
- data/lib/plaid/models/sandbox_processor_token_create_request.rb +253 -0
- data/lib/plaid/models/sandbox_processor_token_create_request_options.rb +236 -0
- data/lib/plaid/models/sandbox_processor_token_create_response.rb +239 -0
- data/lib/plaid/models/sandbox_public_token_create_request.rb +271 -0
- data/lib/plaid/models/sandbox_public_token_create_request_options.rb +255 -0
- data/lib/plaid/models/sandbox_public_token_create_request_options_transactions.rb +230 -0
- data/lib/plaid/models/sandbox_public_token_create_response.rb +240 -0
- data/lib/plaid/models/security.rb +382 -0
- data/lib/plaid/models/servicer_address_data.rb +265 -0
- data/lib/plaid/models/standalone_account_type.rb +285 -0
- data/lib/plaid/models/standalone_currency_code_list.rb +240 -0
- data/lib/plaid/models/standalone_investment_transaction_subtype.rb +650 -0
- data/lib/plaid/models/standalone_investment_transaction_type.rb +300 -0
- data/lib/plaid/models/student_loan.rb +483 -0
- data/lib/plaid/models/student_loan_repayment_model.rb +255 -0
- data/lib/plaid/models/student_loan_status.rb +266 -0
- data/lib/plaid/models/student_repayment_plan.rb +266 -0
- data/lib/plaid/models/transaction.rb +478 -0
- data/lib/plaid/models/transaction_code.rb +48 -0
- data/lib/plaid/models/transaction_data.rb +285 -0
- data/lib/plaid/models/transaction_override.rb +280 -0
- data/lib/plaid/models/transactions_get_request.rb +284 -0
- data/lib/plaid/models/transactions_get_request_options.rb +285 -0
- data/lib/plaid/models/transactions_get_response.rb +288 -0
- data/lib/plaid/models/transactions_refresh_request.rb +240 -0
- data/lib/plaid/models/transactions_refresh_response.rb +225 -0
- data/lib/plaid/models/transactions_removed_webhook.rb +282 -0
- data/lib/plaid/models/user_custom_password.rb +297 -0
- data/lib/plaid/models/user_permission_revoked_webhook.rb +265 -0
- data/lib/plaid/models/verification_expired_webhook.rb +270 -0
- data/lib/plaid/models/verification_status.rb +40 -0
- data/lib/plaid/models/warning.rb +254 -0
- data/lib/plaid/models/webhook_update_acknowledged_webhook.rb +280 -0
- data/lib/plaid/models/webhook_verification_key_get_request.rb +245 -0
- data/lib/plaid/models/webhook_verification_key_get_response.rb +239 -0
- data/lib/plaid/models/ytd_gross_income_summary_field_number.rb +245 -0
- data/lib/plaid/models/ytd_net_income_summary_field_number.rb +245 -0
- data/lib/plaid/version.rb +13 -2
- data/plaid.gemspec +44 -49
- data/templates/ruby/api_client.mustache +266 -0
- data/templates/ruby/api_client_faraday_partial.mustache +120 -0
- data/templates/ruby/configuration.mustache +353 -0
- data/templates/ruby/gemspec.mustache +41 -0
- data/test/test_accounts.rb +103 -0
- data/test/test_asset_report.rb +147 -0
- data/test/test_auth.rb +61 -0
- data/test/test_bank_transfers.rb +219 -0
- data/test/test_categories.rb +10 -0
- data/test/test_configuration.rb +26 -0
- data/test/test_deposit_switch.rb +73 -0
- data/test/test_helper.rb +109 -0
- data/test/test_identity.rb +38 -0
- data/test/test_institutions.rb +159 -0
- data/test/test_investments.rb +205 -0
- data/test/test_item.rb +285 -0
- data/test/test_liabilities.rb +45 -0
- data/test/test_link_token.rb +97 -0
- data/test/test_payment_initiation.rb +95 -0
- data/test/test_processor.rb +67 -0
- data/test/test_transactions.rb +165 -0
- data/test/test_webhooks.rb +22 -0
- metadata +687 -99
- data/.circleci/config.yml +0 -21
- data/.env.sample +0 -3
- data/.github/workflows/add_to_project.yml +0 -21
- data/.rubocop.yml +0 -18
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/plaid/client.rb +0 -190
- data/lib/plaid/errors.rb +0 -89
- data/lib/plaid/middleware.rb +0 -31
- data/lib/plaid/models.rb +0 -2221
- data/lib/plaid/products/accounts.rb +0 -63
- data/lib/plaid/products/asset_report.rb +0 -199
- data/lib/plaid/products/auth.rb +0 -42
- data/lib/plaid/products/base_product.rb +0 -64
- data/lib/plaid/products/categories.rb +0 -21
- data/lib/plaid/products/credit_details.rb +0 -40
- data/lib/plaid/products/deposit_switch.rb +0 -99
- data/lib/plaid/products/identity.rb +0 -31
- data/lib/plaid/products/income.rb +0 -31
- data/lib/plaid/products/institutions.rb +0 -91
- data/lib/plaid/products/investments.rb +0 -127
- data/lib/plaid/products/item.rb +0 -209
- data/lib/plaid/products/liabilities.rb +0 -39
- data/lib/plaid/products/link_token.rb +0 -74
- data/lib/plaid/products/payment_initiation.rb +0 -251
- data/lib/plaid/products/processor.rb +0 -190
- data/lib/plaid/products/sandbox.rb +0 -148
- data/lib/plaid/products/transactions.rb +0 -81
- data/lib/plaid/products/webhooks.rb +0 -23
@@ -0,0 +1,383 @@
|
|
1
|
+
=begin
|
2
|
+
#The Plaid API
|
3
|
+
|
4
|
+
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2020-09-14_1.5.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'json'
|
15
|
+
require 'logger'
|
16
|
+
require 'tempfile'
|
17
|
+
require 'faraday'
|
18
|
+
|
19
|
+
module Plaid
|
20
|
+
class ApiClient
|
21
|
+
# The Configuration object holding settings to be used in the API client.
|
22
|
+
attr_accessor :config
|
23
|
+
|
24
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
25
|
+
#
|
26
|
+
# @return [Hash]
|
27
|
+
attr_accessor :default_headers
|
28
|
+
|
29
|
+
# Initializes the ApiClient
|
30
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
31
|
+
def initialize(config = Configuration.default)
|
32
|
+
@config = config
|
33
|
+
@user_agent = "Plaid Ruby v#{VERSION}"
|
34
|
+
@default_headers = {
|
35
|
+
'Content-Type' => 'application/json',
|
36
|
+
'User-Agent' => @user_agent,
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.default
|
41
|
+
@@default ||= ApiClient.new
|
42
|
+
end
|
43
|
+
|
44
|
+
# Call an API with given options.
|
45
|
+
#
|
46
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
47
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
48
|
+
def call_api(http_method, path, opts = {})
|
49
|
+
connection = Faraday.new(:url => config.base_url) do |conn|
|
50
|
+
if opts[:header_params]["Content-Type"] == "multipart/form-data"
|
51
|
+
conn.request :multipart
|
52
|
+
conn.request :url_encoded
|
53
|
+
end
|
54
|
+
conn.adapter(Faraday.default_adapter)
|
55
|
+
end
|
56
|
+
|
57
|
+
begin
|
58
|
+
response = connection.public_send(http_method.to_sym.downcase) do |req|
|
59
|
+
build_request(http_method, path, req, opts)
|
60
|
+
end
|
61
|
+
|
62
|
+
if @config.debugging
|
63
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
64
|
+
end
|
65
|
+
|
66
|
+
unless response.success?
|
67
|
+
if response.status == 0
|
68
|
+
# Errors from libcurl will be made visible here
|
69
|
+
fail ApiError.new(:code => 0,
|
70
|
+
:message => response.return_message)
|
71
|
+
else
|
72
|
+
fail ApiError.new(:code => response.status,
|
73
|
+
:response_headers => response.headers,
|
74
|
+
:response_body => response.body),
|
75
|
+
response.reason_phrase
|
76
|
+
end
|
77
|
+
end
|
78
|
+
rescue Faraday::TimeoutError
|
79
|
+
fail ApiError.new('Connection timed out')
|
80
|
+
end
|
81
|
+
|
82
|
+
if opts[:return_type]
|
83
|
+
prepare_file(response) if opts[:return_type] == 'File'
|
84
|
+
data = deserialize(response, opts[:return_type])
|
85
|
+
else
|
86
|
+
data = nil
|
87
|
+
end
|
88
|
+
return data, response.status, response.headers
|
89
|
+
end
|
90
|
+
|
91
|
+
# Builds the HTTP request
|
92
|
+
#
|
93
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
94
|
+
# @param [String] path URL path (e.g. /account/new)
|
95
|
+
# @option opts [Hash] :header_params Header parameters
|
96
|
+
# @option opts [Hash] :query_params Query parameters
|
97
|
+
# @option opts [Hash] :form_params Query parameters
|
98
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
99
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
100
|
+
def build_request(http_method, path, request, opts = {})
|
101
|
+
url = build_request_url(path)
|
102
|
+
http_method = http_method.to_sym.downcase
|
103
|
+
|
104
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
105
|
+
query_params = opts[:query_params] || {}
|
106
|
+
form_params = opts[:form_params] || {}
|
107
|
+
|
108
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
109
|
+
|
110
|
+
req_opts = {
|
111
|
+
:method => http_method,
|
112
|
+
:headers => header_params,
|
113
|
+
:params => query_params,
|
114
|
+
:params_encoding => @config.params_encoding,
|
115
|
+
:timeout => @config.timeout,
|
116
|
+
:verbose => @config.debugging
|
117
|
+
}
|
118
|
+
|
119
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
120
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
121
|
+
req_opts.update :body => req_body
|
122
|
+
if @config.debugging
|
123
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
request.headers = header_params
|
127
|
+
request.body = req_body
|
128
|
+
request.url url
|
129
|
+
request.params = query_params
|
130
|
+
request
|
131
|
+
end
|
132
|
+
|
133
|
+
# Builds the HTTP request body
|
134
|
+
#
|
135
|
+
# @param [Hash] header_params Header parameters
|
136
|
+
# @param [Hash] form_params Query parameters
|
137
|
+
# @param [Object] body HTTP body (JSON/XML)
|
138
|
+
# @return [String] HTTP body data in the form of string
|
139
|
+
def build_request_body(header_params, form_params, body)
|
140
|
+
# http form
|
141
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
|
142
|
+
data = URI.encode_www_form(form_params)
|
143
|
+
elsif header_params['Content-Type'] == 'multipart/form-data'
|
144
|
+
data = {}
|
145
|
+
form_params.each do |key, value|
|
146
|
+
case value
|
147
|
+
when ::File, ::Tempfile
|
148
|
+
# TODO hardcode to application/octet-stream, need better way to detect content type
|
149
|
+
data[key] = Faraday::UploadIO.new(value.path, 'application/octet-stream', value.path)
|
150
|
+
when ::Array, nil
|
151
|
+
# let Faraday handle Array and nil parameters
|
152
|
+
data[key] = value
|
153
|
+
else
|
154
|
+
data[key] = value.to_s
|
155
|
+
end
|
156
|
+
end
|
157
|
+
elsif body
|
158
|
+
data = body.is_a?(String) ? body : body.to_json
|
159
|
+
else
|
160
|
+
data = nil
|
161
|
+
end
|
162
|
+
data
|
163
|
+
end
|
164
|
+
# Check if the given MIME is a JSON MIME.
|
165
|
+
# JSON MIME examples:
|
166
|
+
# application/json
|
167
|
+
# application/json; charset=UTF8
|
168
|
+
# APPLICATION/JSON
|
169
|
+
# */*
|
170
|
+
# @param [String] mime MIME
|
171
|
+
# @return [Boolean] True if the MIME is application/json
|
172
|
+
def json_mime?(mime)
|
173
|
+
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
174
|
+
end
|
175
|
+
|
176
|
+
# Deserialize the response to the given return type.
|
177
|
+
#
|
178
|
+
# @param [Response] response HTTP response
|
179
|
+
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
180
|
+
def deserialize(response, return_type)
|
181
|
+
body = response.body
|
182
|
+
|
183
|
+
# handle file downloading - return the File instance processed in request callbacks
|
184
|
+
# note that response body is empty when the file is written in chunks in request on_body callback
|
185
|
+
return @tempfile if return_type == 'File'
|
186
|
+
|
187
|
+
return nil if body.nil? || body.empty?
|
188
|
+
|
189
|
+
# return response body directly for String return type
|
190
|
+
return body if return_type == 'String'
|
191
|
+
|
192
|
+
# ensuring a default content type
|
193
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
194
|
+
|
195
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
196
|
+
|
197
|
+
begin
|
198
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
199
|
+
rescue JSON::ParserError => e
|
200
|
+
if %w(String Date DateTime).include?(return_type)
|
201
|
+
data = body
|
202
|
+
else
|
203
|
+
raise e
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
convert_to_type data, return_type
|
208
|
+
end
|
209
|
+
|
210
|
+
# Convert data to the given return type.
|
211
|
+
# @param [Object] data Data to be converted
|
212
|
+
# @param [String] return_type Return type
|
213
|
+
# @return [Mixed] Data in a particular type
|
214
|
+
def convert_to_type(data, return_type)
|
215
|
+
return nil if data.nil?
|
216
|
+
case return_type
|
217
|
+
when 'String'
|
218
|
+
data.to_s
|
219
|
+
when 'Integer'
|
220
|
+
data.to_i
|
221
|
+
when 'Float'
|
222
|
+
data.to_f
|
223
|
+
when 'Boolean'
|
224
|
+
data == true
|
225
|
+
when 'DateTime'
|
226
|
+
# parse date time (expecting ISO 8601 format)
|
227
|
+
DateTime.parse data
|
228
|
+
when 'Date'
|
229
|
+
# parse date time (expecting ISO 8601 format)
|
230
|
+
Date.parse data
|
231
|
+
when 'Object'
|
232
|
+
# generic object (usually a Hash), return directly
|
233
|
+
data
|
234
|
+
when /\AArray<(.+)>\z/
|
235
|
+
# e.g. Array<Pet>
|
236
|
+
sub_type = $1
|
237
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
238
|
+
when /\AHash\<String, (.+)\>\z/
|
239
|
+
# e.g. Hash<String, Integer>
|
240
|
+
sub_type = $1
|
241
|
+
{}.tap do |hash|
|
242
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
243
|
+
end
|
244
|
+
else
|
245
|
+
# models, e.g. Pet
|
246
|
+
Plaid.const_get(return_type).build_from_hash(data)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
251
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
252
|
+
# The response body is written to the file in chunks in order to handle files which
|
253
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
254
|
+
# process can use.
|
255
|
+
#
|
256
|
+
# @see Configuration#temp_folder_path
|
257
|
+
def prepare_file(response)
|
258
|
+
content_disposition = response.headers["Content-Disposition"]
|
259
|
+
if content_disposition && content_disposition =~ /filename=/i
|
260
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
261
|
+
prefix = sanitize_filename(filename)
|
262
|
+
else
|
263
|
+
prefix = "download-"
|
264
|
+
end
|
265
|
+
prefix = prefix + "-" unless prefix.end_with?("-")
|
266
|
+
encoding = response.body.encoding
|
267
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
268
|
+
@tempfile = tempfile
|
269
|
+
tempfile.write(response.body)
|
270
|
+
tempfile.close if tempfile
|
271
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder " \
|
272
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file " \
|
273
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file " \
|
274
|
+
"explicitly with `tempfile.delete`"
|
275
|
+
end
|
276
|
+
|
277
|
+
# Sanitize filename by removing path.
|
278
|
+
# e.g. ../../sun.gif becomes sun.gif
|
279
|
+
#
|
280
|
+
# @param [String] filename the filename to be sanitized
|
281
|
+
# @return [String] the sanitized filename
|
282
|
+
def sanitize_filename(filename)
|
283
|
+
filename.gsub(/.*[\/\\]/, '')
|
284
|
+
end
|
285
|
+
|
286
|
+
def build_request_url(path)
|
287
|
+
# Add leading and trailing slashes to path
|
288
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
289
|
+
@config.base_url + path
|
290
|
+
end
|
291
|
+
|
292
|
+
# Update hearder and query params based on authentication settings.
|
293
|
+
#
|
294
|
+
# @param [Hash] header_params Header parameters
|
295
|
+
# @param [Hash] query_params Query parameters
|
296
|
+
# @param [String] auth_names Authentication scheme name
|
297
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
298
|
+
Array(auth_names).each do |auth_name|
|
299
|
+
auth_setting = @config.auth_settings[auth_name]
|
300
|
+
next unless auth_setting
|
301
|
+
case auth_setting[:in]
|
302
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
303
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
304
|
+
else fail ArgumentError, 'Authentication token must be in `query` of `header`'
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
# Sets user agent in HTTP header
|
310
|
+
#
|
311
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
312
|
+
def user_agent=(user_agent)
|
313
|
+
@user_agent = user_agent
|
314
|
+
@default_headers['User-Agent'] = @user_agent
|
315
|
+
end
|
316
|
+
|
317
|
+
# Return Accept header based on an array of accepts provided.
|
318
|
+
# @param [Array] accepts array for Accept
|
319
|
+
# @return [String] the Accept header (e.g. application/json)
|
320
|
+
def select_header_accept(accepts)
|
321
|
+
return nil if accepts.nil? || accepts.empty?
|
322
|
+
# use JSON when present, otherwise use all of the provided
|
323
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
324
|
+
json_accept || accepts.join(',')
|
325
|
+
end
|
326
|
+
|
327
|
+
# Return Content-Type header based on an array of content types provided.
|
328
|
+
# @param [Array] content_types array for Content-Type
|
329
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
330
|
+
def select_header_content_type(content_types)
|
331
|
+
# use application/json by default
|
332
|
+
return 'application/json' if content_types.nil? || content_types.empty?
|
333
|
+
# use JSON when present, otherwise use the first one
|
334
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
335
|
+
json_content_type || content_types.first
|
336
|
+
end
|
337
|
+
|
338
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
339
|
+
# @param [Object] model object to be converted into JSON string
|
340
|
+
# @return [String] JSON string representation of the object
|
341
|
+
def object_to_http_body(model)
|
342
|
+
return model if model.nil? || model.is_a?(String)
|
343
|
+
local_body = nil
|
344
|
+
if model.is_a?(Array)
|
345
|
+
local_body = model.map { |m| object_to_hash(m) }
|
346
|
+
else
|
347
|
+
local_body = object_to_hash(model)
|
348
|
+
end
|
349
|
+
local_body.to_json
|
350
|
+
end
|
351
|
+
|
352
|
+
# Convert object(non-array) to hash.
|
353
|
+
# @param [Object] obj object to be converted into JSON string
|
354
|
+
# @return [String] JSON string representation of the object
|
355
|
+
def object_to_hash(obj)
|
356
|
+
if obj.respond_to?(:to_hash)
|
357
|
+
obj.to_hash
|
358
|
+
else
|
359
|
+
obj
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
# Build parameter value according to the given collection format.
|
364
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
365
|
+
def build_collection_param(param, collection_format)
|
366
|
+
case collection_format
|
367
|
+
when :csv
|
368
|
+
param.join(',')
|
369
|
+
when :ssv
|
370
|
+
param.join(' ')
|
371
|
+
when :tsv
|
372
|
+
param.join("\t")
|
373
|
+
when :pipes
|
374
|
+
param.join('|')
|
375
|
+
when :multi
|
376
|
+
# return the array directly as typhoeus will handle it as expected
|
377
|
+
param
|
378
|
+
else
|
379
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
=begin
|
2
|
+
#The Plaid API
|
3
|
+
|
4
|
+
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2020-09-14_1.5.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module Plaid
|
14
|
+
class ApiError < StandardError
|
15
|
+
attr_reader :code, :response_headers, :response_body
|
16
|
+
|
17
|
+
# Usage examples:
|
18
|
+
# ApiError.new
|
19
|
+
# ApiError.new("message")
|
20
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
21
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
22
|
+
def initialize(arg = nil)
|
23
|
+
if arg.is_a? Hash
|
24
|
+
if arg.key?(:message) || arg.key?('message')
|
25
|
+
super(arg[:message] || arg['message'])
|
26
|
+
else
|
27
|
+
super arg
|
28
|
+
end
|
29
|
+
|
30
|
+
arg.each do |k, v|
|
31
|
+
instance_variable_set "@#{k}", v
|
32
|
+
end
|
33
|
+
else
|
34
|
+
super arg
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Override to_s to display a friendly error message
|
39
|
+
def to_s
|
40
|
+
message
|
41
|
+
end
|
42
|
+
|
43
|
+
def message
|
44
|
+
if @message.nil?
|
45
|
+
msg = "Error message: the server returns an error"
|
46
|
+
else
|
47
|
+
msg = @message
|
48
|
+
end
|
49
|
+
|
50
|
+
msg += "\nHTTP status code: #{code}" if code
|
51
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
52
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
53
|
+
|
54
|
+
msg
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,297 @@
|
|
1
|
+
=begin
|
2
|
+
#The Plaid API
|
3
|
+
|
4
|
+
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2020-09-14_1.5.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module Plaid
|
14
|
+
|
15
|
+
class Configuration
|
16
|
+
# Plaid Environment mapping
|
17
|
+
# production, development, sandbox
|
18
|
+
Environment = { "production" => 0, "development" => 1, "sandbox" => 2 }
|
19
|
+
|
20
|
+
# Defines url scheme
|
21
|
+
attr_accessor :scheme
|
22
|
+
|
23
|
+
# Defines url host
|
24
|
+
attr_accessor :host
|
25
|
+
|
26
|
+
# Defines url base path
|
27
|
+
attr_accessor :base_path
|
28
|
+
|
29
|
+
# Define server configuration index
|
30
|
+
attr_accessor :server_index
|
31
|
+
|
32
|
+
# Define server operation configuration index
|
33
|
+
attr_accessor :server_operation_index
|
34
|
+
|
35
|
+
# Default server variables
|
36
|
+
attr_accessor :server_variables
|
37
|
+
|
38
|
+
# Default server operation variables
|
39
|
+
attr_accessor :server_operation_variables
|
40
|
+
|
41
|
+
# Defines API keys used with API Key authentications.
|
42
|
+
#
|
43
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
44
|
+
#
|
45
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
46
|
+
# config.api_key['api_key'] = 'xxx'
|
47
|
+
attr_accessor :api_key
|
48
|
+
|
49
|
+
# Defines API key prefixes used with API Key authentications.
|
50
|
+
#
|
51
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
52
|
+
#
|
53
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
54
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
55
|
+
attr_accessor :api_key_prefix
|
56
|
+
|
57
|
+
# Defines the username used with HTTP basic authentication.
|
58
|
+
#
|
59
|
+
# @return [String]
|
60
|
+
attr_accessor :username
|
61
|
+
|
62
|
+
# Defines the password used with HTTP basic authentication.
|
63
|
+
#
|
64
|
+
# @return [String]
|
65
|
+
attr_accessor :password
|
66
|
+
|
67
|
+
# Defines the access token (Bearer) used with OAuth2.
|
68
|
+
attr_accessor :access_token
|
69
|
+
|
70
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
71
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
72
|
+
# Default to false.
|
73
|
+
#
|
74
|
+
# @return [true, false]
|
75
|
+
attr_accessor :debugging
|
76
|
+
|
77
|
+
# Defines the logger used for debugging.
|
78
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
79
|
+
#
|
80
|
+
# @return [#debug]
|
81
|
+
attr_accessor :logger
|
82
|
+
|
83
|
+
# Defines the temporary folder to store downloaded files
|
84
|
+
# (for API endpoints that have file response).
|
85
|
+
# Default to use `Tempfile`.
|
86
|
+
#
|
87
|
+
# @return [String]
|
88
|
+
attr_accessor :temp_folder_path
|
89
|
+
|
90
|
+
# The time limit for HTTP request in seconds.
|
91
|
+
# Default to 0 (never times out).
|
92
|
+
attr_accessor :timeout
|
93
|
+
|
94
|
+
# Set this to false to skip client side validation in the operation.
|
95
|
+
# Default to true.
|
96
|
+
# @return [true, false]
|
97
|
+
attr_accessor :client_side_validation
|
98
|
+
|
99
|
+
### TLS/SSL setting
|
100
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
101
|
+
# Default to true.
|
102
|
+
#
|
103
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
104
|
+
#
|
105
|
+
# @return [true, false]
|
106
|
+
attr_accessor :ssl_verify
|
107
|
+
|
108
|
+
### TLS/SSL setting
|
109
|
+
# Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
|
110
|
+
#
|
111
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
112
|
+
#
|
113
|
+
attr_accessor :ssl_verify_mode
|
114
|
+
|
115
|
+
### TLS/SSL setting
|
116
|
+
# Set this to customize the certificate file to verify the peer.
|
117
|
+
#
|
118
|
+
# @return [String] the path to the certificate file
|
119
|
+
attr_accessor :ssl_ca_file
|
120
|
+
|
121
|
+
### TLS/SSL setting
|
122
|
+
# Client certificate file (for client certificate)
|
123
|
+
attr_accessor :ssl_client_cert
|
124
|
+
|
125
|
+
### TLS/SSL setting
|
126
|
+
# Client private key file (for client certificate)
|
127
|
+
attr_accessor :ssl_client_key
|
128
|
+
|
129
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
130
|
+
# Default to nil.
|
131
|
+
#
|
132
|
+
# @see The params_encoding option of Ethon. Related source code:
|
133
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
134
|
+
attr_accessor :params_encoding
|
135
|
+
|
136
|
+
attr_accessor :inject_format
|
137
|
+
|
138
|
+
attr_accessor :force_ending_format
|
139
|
+
|
140
|
+
def initialize
|
141
|
+
@scheme = 'https'
|
142
|
+
@host = 'production.plaid.com'
|
143
|
+
@base_path = ''
|
144
|
+
@server_index = 0
|
145
|
+
@server_operation_index = {}
|
146
|
+
@server_variables = {}
|
147
|
+
@server_operation_variables = {}
|
148
|
+
@api_key = {}
|
149
|
+
@api_key_prefix = {}
|
150
|
+
@timeout = 0
|
151
|
+
@client_side_validation = true
|
152
|
+
@ssl_verify = true
|
153
|
+
@ssl_verify_mode = nil
|
154
|
+
@ssl_ca_file = nil
|
155
|
+
@ssl_client_cert = nil
|
156
|
+
@ssl_client_key = nil
|
157
|
+
@debugging = false
|
158
|
+
@inject_format = false
|
159
|
+
@force_ending_format = false
|
160
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
161
|
+
|
162
|
+
yield(self) if block_given?
|
163
|
+
end
|
164
|
+
|
165
|
+
# The default Configuration object.
|
166
|
+
def self.default
|
167
|
+
@@default ||= Configuration.new
|
168
|
+
end
|
169
|
+
|
170
|
+
def configure
|
171
|
+
yield(self) if block_given?
|
172
|
+
end
|
173
|
+
|
174
|
+
def scheme=(scheme)
|
175
|
+
# remove :// from scheme
|
176
|
+
@scheme = scheme.sub(/:\/\//, '')
|
177
|
+
end
|
178
|
+
|
179
|
+
def host=(host)
|
180
|
+
# remove http(s):// and anything after a slash
|
181
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
182
|
+
end
|
183
|
+
|
184
|
+
def base_path=(base_path)
|
185
|
+
# Add leading and trailing slashes to base_path
|
186
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
187
|
+
@base_path = '' if @base_path == '/'
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns base URL for specified operation based on server settings
|
191
|
+
def base_url(operation = nil)
|
192
|
+
index = server_operation_index.fetch(operation, server_index)
|
193
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
194
|
+
|
195
|
+
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
196
|
+
end
|
197
|
+
|
198
|
+
# Gets API key (with prefix if set).
|
199
|
+
# @param [String] param_name the parameter name of API key auth
|
200
|
+
def api_key_with_prefix(param_name)
|
201
|
+
if @api_key_prefix[param_name]
|
202
|
+
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
203
|
+
else
|
204
|
+
@api_key[param_name]
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
# Gets Basic Auth token string
|
209
|
+
def basic_auth_token
|
210
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns Auth Settings hash for api client.
|
214
|
+
def auth_settings
|
215
|
+
{
|
216
|
+
'clientId' =>
|
217
|
+
{
|
218
|
+
type: 'api_key',
|
219
|
+
in: 'header',
|
220
|
+
key: 'PLAID-CLIENT-ID',
|
221
|
+
value: api_key_with_prefix('PLAID-CLIENT-ID')
|
222
|
+
},
|
223
|
+
'plaidVersion' =>
|
224
|
+
{
|
225
|
+
type: 'api_key',
|
226
|
+
in: 'header',
|
227
|
+
key: 'Plaid-Version',
|
228
|
+
value: api_key_with_prefix('Plaid-Version')
|
229
|
+
},
|
230
|
+
'secret' =>
|
231
|
+
{
|
232
|
+
type: 'api_key',
|
233
|
+
in: 'header',
|
234
|
+
key: 'PLAID-SECRET',
|
235
|
+
value: api_key_with_prefix('PLAID-SECRET')
|
236
|
+
},
|
237
|
+
}
|
238
|
+
end
|
239
|
+
|
240
|
+
# Returns an array of Server setting
|
241
|
+
def server_settings
|
242
|
+
[
|
243
|
+
{
|
244
|
+
url: "https://production.plaid.com",
|
245
|
+
description: "Production",
|
246
|
+
},
|
247
|
+
{
|
248
|
+
url: "https://development.plaid.com",
|
249
|
+
description: "Development",
|
250
|
+
},
|
251
|
+
{
|
252
|
+
url: "https://sandbox.plaid.com",
|
253
|
+
description: "Sandbox",
|
254
|
+
}
|
255
|
+
]
|
256
|
+
end
|
257
|
+
|
258
|
+
def operation_server_settings
|
259
|
+
{
|
260
|
+
}
|
261
|
+
end
|
262
|
+
|
263
|
+
# Returns URL based on server settings
|
264
|
+
#
|
265
|
+
# @param index array index of the server settings
|
266
|
+
# @param variables hash of variable and the corresponding value
|
267
|
+
def server_url(index, variables = {}, servers = nil)
|
268
|
+
servers = server_settings if servers == nil
|
269
|
+
|
270
|
+
# check array index out of bound
|
271
|
+
if (index < 0 || index >= servers.size)
|
272
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
273
|
+
end
|
274
|
+
|
275
|
+
server = servers[index]
|
276
|
+
url = server[:url]
|
277
|
+
|
278
|
+
return url unless server.key? :variables
|
279
|
+
|
280
|
+
# go through variable and assign a value
|
281
|
+
server[:variables].each do |name, variable|
|
282
|
+
if variables.key?(name)
|
283
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
284
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
285
|
+
else
|
286
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
287
|
+
end
|
288
|
+
else
|
289
|
+
# use default value
|
290
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
url
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|