plaid 13.0.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 +74 -1
- data/CONTRIBUTING.md +2 -32
- data/Dockerfile +11 -0
- data/Gemfile.lock +45 -36
- data/LICENSE.txt +1 -1
- data/PUBLISH.md +0 -1
- data/README.md +99 -91
- 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 -2144
- 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 -237
- 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,10 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
# Internal: The test for Plaid::CategoriesGet.
|
4
|
+
class PlaidCategoriesTest < PlaidTest
|
5
|
+
def test_get
|
6
|
+
response = client.categories_get({})
|
7
|
+
assert_instance_of(Plaid::CategoriesGetResponse, response)
|
8
|
+
refute_empty(response.to_hash)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
require_relative "test_helper"
|
3
|
+
|
4
|
+
# Internal: The test for Plaid::Configuration.
|
5
|
+
class PlaidConfigurationTest < PlaidTest
|
6
|
+
def test_api_host
|
7
|
+
configuration = Plaid::Configuration.new
|
8
|
+
configuration.server_index = 2
|
9
|
+
|
10
|
+
assert_equal "https://sandbox.plaid.com",
|
11
|
+
configuration.base_url
|
12
|
+
|
13
|
+
configuration.server_index = 1
|
14
|
+
assert_equal "https://development.plaid.com",
|
15
|
+
configuration.base_url
|
16
|
+
|
17
|
+
configuration.server_index = 0
|
18
|
+
assert_equal "https://production.plaid.com",
|
19
|
+
configuration.base_url
|
20
|
+
|
21
|
+
assert_raises(ArgumentError) do
|
22
|
+
configuration.server_index = 3
|
23
|
+
configuration.base_url
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
class PlaidDepositSwitchTest < PlaidTest
|
4
|
+
# rubocop:disable Metrics/MethodLength
|
5
|
+
def test_all_routes
|
6
|
+
# import item
|
7
|
+
item_import_request = Plaid::ItemImportRequest.new
|
8
|
+
|
9
|
+
item_import_request.products = %w[identity auth]
|
10
|
+
item_import_request.user_auth = {
|
11
|
+
user_id: "user_good",
|
12
|
+
auth_token: "pass_good",
|
13
|
+
}
|
14
|
+
|
15
|
+
import_response = client.item_import(
|
16
|
+
item_import_request
|
17
|
+
)
|
18
|
+
|
19
|
+
refute_empty(import_response.access_token)
|
20
|
+
access_token = import_response.access_token
|
21
|
+
assert_kind_of(Plaid::ItemImportResponse, import_response)
|
22
|
+
|
23
|
+
# get account id
|
24
|
+
accounts_get_request = Plaid::AccountsGetRequest.new
|
25
|
+
accounts_get_request.access_token = access_token
|
26
|
+
|
27
|
+
get_accounts_response = client.accounts_get(accounts_get_request)
|
28
|
+
refute_empty(get_accounts_response.accounts)
|
29
|
+
assert_kind_of(Plaid::AccountsGetResponse, get_accounts_response)
|
30
|
+
|
31
|
+
depository_accounts = get_accounts_response.accounts.select do |account|
|
32
|
+
account.type == "depository"
|
33
|
+
end
|
34
|
+
account_id = depository_accounts[0].account_id
|
35
|
+
|
36
|
+
# create deposit switch
|
37
|
+
deposit_switch_create_request = Plaid::DepositSwitchCreateRequest.new
|
38
|
+
deposit_switch_create_request.target_account_id = account_id
|
39
|
+
deposit_switch_create_request.target_access_token = access_token
|
40
|
+
|
41
|
+
create_response = client.deposit_switch_create(
|
42
|
+
deposit_switch_create_request
|
43
|
+
)
|
44
|
+
assert_kind_of(Plaid::DepositSwitchCreateResponse, create_response)
|
45
|
+
|
46
|
+
refute_empty(create_response.deposit_switch_id)
|
47
|
+
deposit_switch_id = create_response.deposit_switch_id
|
48
|
+
|
49
|
+
# get deposit switch
|
50
|
+
deposit_switch_get_request = Plaid::DepositSwitchGetRequest.new()
|
51
|
+
deposit_switch_get_request.deposit_switch_id = deposit_switch_id
|
52
|
+
|
53
|
+
get_response = client.deposit_switch_get(deposit_switch_get_request)
|
54
|
+
assert_kind_of(Plaid::DepositSwitchGetResponse, get_response)
|
55
|
+
|
56
|
+
refute_empty(get_response.deposit_switch_id)
|
57
|
+
refute_empty(get_response.target_item_id)
|
58
|
+
refute_empty(get_response.target_account_id)
|
59
|
+
refute_empty(get_response.state)
|
60
|
+
refute_nil(get_response.date_created)
|
61
|
+
|
62
|
+
# create deposit switch token
|
63
|
+
deposit_switch_create_token_request = Plaid::DepositSwitchTokenCreateRequest.new
|
64
|
+
deposit_switch_create_token_request.deposit_switch_id = deposit_switch_id
|
65
|
+
|
66
|
+
create_token_response = client.deposit_switch_token_create(deposit_switch_create_token_request)
|
67
|
+
|
68
|
+
refute_empty(create_token_response.deposit_switch_token)
|
69
|
+
refute_empty(create_token_response.deposit_switch_token_expiration_time)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# rubocop:enable Metrics/MethodLength
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "minitest/around/unit"
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
require_relative "../lib/plaid"
|
6
|
+
|
7
|
+
# Internal: Default read timeout for HTTP calls in seconds.
|
8
|
+
NETWORK_TIMEOUT = 600
|
9
|
+
|
10
|
+
class PlaidTest < MiniTest::Test
|
11
|
+
attr_reader :client, :item, :access_token
|
12
|
+
|
13
|
+
def create_client
|
14
|
+
configuration = Plaid::Configuration.new
|
15
|
+
configuration.server_index = Plaid::Configuration::Environment["sandbox"]
|
16
|
+
configuration.timeout = NETWORK_TIMEOUT
|
17
|
+
configuration.api_key["PLAID-CLIENT-ID"] = ENV["PLAID_RUBY_CLIENT_ID"]
|
18
|
+
configuration.api_key["PLAID-SECRET"] = ENV["PLAID_RUBY_SECRET"]
|
19
|
+
configuration.api_key["Plaid-Version"] = "2020-09-14"
|
20
|
+
|
21
|
+
api_client = Plaid::ApiClient.new(
|
22
|
+
configuration
|
23
|
+
)
|
24
|
+
|
25
|
+
@client = Plaid::PlaidApi.new(api_client)
|
26
|
+
@client_id = ENV["PLAID_RUBY_CLIENT_ID"]
|
27
|
+
end
|
28
|
+
|
29
|
+
# Helper used to create a test item with given products
|
30
|
+
def create_item(institution_id: SANDBOX_INSTITUTION,
|
31
|
+
initial_products: [:transactions],
|
32
|
+
transactions_start_date: nil,
|
33
|
+
transactions_end_date: nil,
|
34
|
+
webhook: nil,
|
35
|
+
options: nil)
|
36
|
+
sandbox_public_token_create_request = Plaid::SandboxPublicTokenCreateRequest.new
|
37
|
+
|
38
|
+
options_payload = {}
|
39
|
+
options_payload[:webhook] = webhook unless webhook.nil?
|
40
|
+
options_payload[:transactions] = {
|
41
|
+
start_date: transactions_start_date.is_a?(String) ? transactions_start_date : transactions_start_date.to_date.strftime("%Y-%m-%d"),
|
42
|
+
end_date: transactions_end_date.is_a?(String) ? transactions_end_date : transactions_end_date.to_date.strftime("%Y-%m-%d"),
|
43
|
+
} unless transactions_start_date.nil? || transactions_end_date.nil?
|
44
|
+
options_payload = options_payload.merge(options) unless options.nil?
|
45
|
+
|
46
|
+
sandbox_public_token_create_request.options = options_payload
|
47
|
+
sandbox_public_token_create_request.institution_id = institution_id
|
48
|
+
sandbox_public_token_create_request.initial_products = initial_products
|
49
|
+
|
50
|
+
begin
|
51
|
+
public_token_response = @client.sandbox_public_token_create(sandbox_public_token_create_request)
|
52
|
+
end
|
53
|
+
|
54
|
+
# public_token must be present
|
55
|
+
refute_empty(public_token_response.to_hash)
|
56
|
+
|
57
|
+
public_token = public_token_response.public_token
|
58
|
+
|
59
|
+
# exchange public_token for access_token
|
60
|
+
item_public_token_exchange_request = Plaid::ItemPublicTokenExchangeRequest.new
|
61
|
+
item_public_token_exchange_request.public_token = public_token
|
62
|
+
|
63
|
+
exchange_token_response = client.item_public_token_exchange(item_public_token_exchange_request)
|
64
|
+
|
65
|
+
@access_token = exchange_token_response.access_token
|
66
|
+
refute_empty(@access_token)
|
67
|
+
|
68
|
+
item_get_request = Plaid::ItemGetRequest.new
|
69
|
+
item_get_request.access_token = @access_token
|
70
|
+
|
71
|
+
@item = client.item_get(item_get_request)
|
72
|
+
refute_empty(@item.to_hash)
|
73
|
+
end
|
74
|
+
|
75
|
+
# If create_item was used, remove the item
|
76
|
+
def teardown
|
77
|
+
if access_token
|
78
|
+
item_remove_request = Plaid::ItemRemoveRequest.new
|
79
|
+
item_remove_request.access_token = access_token
|
80
|
+
|
81
|
+
begin
|
82
|
+
@client.item_remove(item_remove_request)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# This method is called around every test method.
|
88
|
+
def around
|
89
|
+
create_client
|
90
|
+
yield
|
91
|
+
end
|
92
|
+
|
93
|
+
BAD_STRING = "ABCDEFG1234567".freeze
|
94
|
+
|
95
|
+
BAD_ARRAY = ["ABCDEFG1234567"].freeze
|
96
|
+
|
97
|
+
SANDBOX_INSTITUTION = "ins_109508".freeze
|
98
|
+
|
99
|
+
SANDBOX_INSTITUTION_NAME = "First Platypus Bank".freeze
|
100
|
+
|
101
|
+
SANDBOX_INSTITUTIONS = %w[ins_109508 ins_109509 ins_109510
|
102
|
+
ins_109511 ins_109512].freeze
|
103
|
+
|
104
|
+
# NOTE: Data is only generated over the past 2 years. Ensure that the date
|
105
|
+
# range used for transactions/get is within 2 years old or otherwise the tests will not work properly
|
106
|
+
|
107
|
+
START_DATE = "2020-01-01".freeze
|
108
|
+
END_DATE = "2021-01-01".freeze
|
109
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
# Internal: The test for Plaid::Identity.
|
4
|
+
class PlaidIdentityTest < PlaidTest
|
5
|
+
def test_get
|
6
|
+
create_item initial_products: [:identity]
|
7
|
+
|
8
|
+
identity_get_request = Plaid::IdentityGetRequest.new
|
9
|
+
identity_get_request.access_token = access_token
|
10
|
+
|
11
|
+
response = client.identity_get(identity_get_request)
|
12
|
+
assert_kind_of(Plaid::IdentityGetResponse, response)
|
13
|
+
|
14
|
+
refute_empty(response.accounts)
|
15
|
+
|
16
|
+
response.accounts.each do |account|
|
17
|
+
refute_empty(account.owners)
|
18
|
+
account.owners.each do |identity|
|
19
|
+
refute_empty(identity.addresses)
|
20
|
+
refute_empty(identity.emails)
|
21
|
+
refute_empty(identity.names)
|
22
|
+
refute_empty(identity.phone_numbers)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_get_invalid_access_token
|
28
|
+
identity_get_request = Plaid::IdentityGetRequest.new
|
29
|
+
identity_get_request.access_token = BAD_STRING
|
30
|
+
|
31
|
+
begin
|
32
|
+
client.identity_get(identity_get_request)
|
33
|
+
rescue Plaid::ApiError => e
|
34
|
+
json_response = JSON.parse(e.response_body)
|
35
|
+
assert_equal(json_response["error_code"], "INVALID_ACCESS_TOKEN")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
# Internal: The test for Plaid::Institutions.
|
4
|
+
class PlaidInstitutionsTest < PlaidTest
|
5
|
+
def test_get
|
6
|
+
institutions_get_request = Plaid::InstitutionsGetRequest.new({
|
7
|
+
:count => 3,
|
8
|
+
:offset => 1,
|
9
|
+
:country_codes => ["US"],
|
10
|
+
})
|
11
|
+
|
12
|
+
response = client.institutions_get(institutions_get_request)
|
13
|
+
assert_equal(3, response.to_hash[:institutions].length)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_get_with_options
|
17
|
+
institutions_get_request = Plaid::InstitutionsGetRequest.new({
|
18
|
+
:count => 3,
|
19
|
+
:offset => 1,
|
20
|
+
:country_codes => ["US"],
|
21
|
+
:options => {
|
22
|
+
products: ["transactions"],
|
23
|
+
include_optional_metadata: true,
|
24
|
+
},
|
25
|
+
})
|
26
|
+
response = client.institutions_get institutions_get_request
|
27
|
+
|
28
|
+
assert_kind_of(Plaid::InstitutionsGetResponse, response)
|
29
|
+
assert_equal(3, response.institutions.length)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_get_invalid_parameters
|
33
|
+
assert_raises(ArgumentError) do
|
34
|
+
institutions_get_request = Plaid::InstitutionsGetRequest.new({
|
35
|
+
:count => BAD_STRING,
|
36
|
+
:offset => BAD_STRING,
|
37
|
+
:country_codes => ["XX"],
|
38
|
+
})
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_get_by_id
|
43
|
+
institutions_get_by_id_request = Plaid::InstitutionsGetByIdRequest.new({
|
44
|
+
:institution_id => SANDBOX_INSTITUTION,
|
45
|
+
:country_codes => ["US"],
|
46
|
+
})
|
47
|
+
|
48
|
+
response = client.institutions_get_by_id(institutions_get_by_id_request)
|
49
|
+
|
50
|
+
assert_equal(SANDBOX_INSTITUTION, response.institution.institution_id)
|
51
|
+
assert_equal(["US"], response.institution.country_codes)
|
52
|
+
assert_kind_of(Plaid::InstitutionsGetByIdResponse, response)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_get_by_id_invalid_parameters
|
56
|
+
institutions_get_by_id_request = Plaid::InstitutionsGetByIdRequest.new({
|
57
|
+
:institution_id => BAD_STRING,
|
58
|
+
:country_codes => ["US"],
|
59
|
+
})
|
60
|
+
|
61
|
+
begin
|
62
|
+
client.institutions_get_by_id institutions_get_by_id_request
|
63
|
+
rescue Plaid::ApiError => e
|
64
|
+
json_response = JSON.parse(e.response_body)
|
65
|
+
assert_equal(json_response["error_code"], "INVALID_INSTITUTION")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_get_by_id_include_optional_metadata
|
70
|
+
institutions_get_by_id_request = Plaid::InstitutionsGetByIdRequest.new({
|
71
|
+
:institution_id => SANDBOX_INSTITUTION,
|
72
|
+
:country_codes => ["US"],
|
73
|
+
:options => { include_optional_metadata: true },
|
74
|
+
})
|
75
|
+
|
76
|
+
response = client.institutions_get_by_id(institutions_get_by_id_request)
|
77
|
+
assert_equal(SANDBOX_INSTITUTION, response.institution.institution_id)
|
78
|
+
assert_kind_of(Plaid::InstitutionsGetByIdResponse, response)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_get_by_id_include_status_false
|
82
|
+
institutions_get_by_id_request = Plaid::InstitutionsGetByIdRequest.new({
|
83
|
+
:institution_id => SANDBOX_INSTITUTION,
|
84
|
+
:country_codes => ["US"],
|
85
|
+
})
|
86
|
+
|
87
|
+
response = client.institutions_get_by_id(institutions_get_by_id_request)
|
88
|
+
assert_equal(SANDBOX_INSTITUTION, response.institution.institution_id)
|
89
|
+
assert_nil(response.institution.status)
|
90
|
+
assert_kind_of(Plaid::InstitutionsGetByIdResponse, response)
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_search
|
94
|
+
institutions_search_request = Plaid::InstitutionsSearchRequest.new({
|
95
|
+
:query => SANDBOX_INSTITUTION_NAME,
|
96
|
+
:products => [:transactions],
|
97
|
+
:country_codes => ["US"],
|
98
|
+
})
|
99
|
+
|
100
|
+
response = client.institutions_search(institutions_search_request)
|
101
|
+
refute_empty(response.institutions)
|
102
|
+
assert_kind_of(Plaid::InstitutionsSearchResponse, response)
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_search_with_include_optional_metadata
|
106
|
+
institutions_search_request = Plaid::InstitutionsSearchRequest.new({
|
107
|
+
:query => SANDBOX_INSTITUTION_NAME,
|
108
|
+
:products => [:transactions],
|
109
|
+
:country_codes => ["US"],
|
110
|
+
:options => { include_optional_metadata: true },
|
111
|
+
})
|
112
|
+
|
113
|
+
response = client.institutions_search institutions_search_request
|
114
|
+
refute_empty(response.institutions)
|
115
|
+
assert_kind_of(Plaid::InstitutionsSearchResponse, response)
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_search_with_products
|
119
|
+
institutions_search_request = Plaid::InstitutionsSearchRequest.new({
|
120
|
+
:query => SANDBOX_INSTITUTION_NAME,
|
121
|
+
:products => [:transactions],
|
122
|
+
:country_codes => ["US"],
|
123
|
+
})
|
124
|
+
|
125
|
+
response = client.institutions_search institutions_search_request
|
126
|
+
refute_empty(response.institutions)
|
127
|
+
assert_kind_of(Plaid::InstitutionsSearchResponse, response)
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_search_invalid_products
|
131
|
+
institutions_search_request = Plaid::InstitutionsSearchRequest.new({
|
132
|
+
:query => SANDBOX_INSTITUTION_NAME,
|
133
|
+
:products => BAD_ARRAY,
|
134
|
+
:country_codes => ["XX"],
|
135
|
+
})
|
136
|
+
|
137
|
+
begin
|
138
|
+
client.institutions_search institutions_search_request
|
139
|
+
rescue Plaid::ApiError => e
|
140
|
+
json_response = JSON.parse(e.response_body)
|
141
|
+
assert_equal(json_response["error_code"], "INVALID_PRODUCT")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_search_bad_products
|
146
|
+
institutions_search_request = Plaid::InstitutionsSearchRequest.new({
|
147
|
+
:query => SANDBOX_INSTITUTION_NAME,
|
148
|
+
:products => BAD_STRING,
|
149
|
+
:country_codes => ["XX"],
|
150
|
+
})
|
151
|
+
|
152
|
+
begin
|
153
|
+
client.institutions_search institutions_search_request
|
154
|
+
rescue Plaid::ApiError => e
|
155
|
+
json_response = JSON.parse(e.response_body)
|
156
|
+
assert_equal(json_response["error_type"], "INVALID_REQUEST")
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,205 @@
|
|
1
|
+
require "date"
|
2
|
+
|
3
|
+
require_relative "test_helper"
|
4
|
+
|
5
|
+
# Internal: The test for Plaid::Investments.
|
6
|
+
class PlaidInvestmentsTest < PlaidTest # rubocop:disable Metrics/ClassLength
|
7
|
+
def setup
|
8
|
+
create_item initial_products: [:investments],
|
9
|
+
transactions_start_date: START_DATE,
|
10
|
+
transactions_end_date: END_DATE
|
11
|
+
end
|
12
|
+
|
13
|
+
# rubocop:disable Metrics/MethodLength
|
14
|
+
|
15
|
+
def test_investment_transactions_get
|
16
|
+
investments_transactions_get_request = Plaid::InvestmentsTransactionsGetRequest.new
|
17
|
+
investments_transactions_get_request.access_token = access_token
|
18
|
+
investments_transactions_get_request.start_date = START_DATE
|
19
|
+
investments_transactions_get_request.end_date = END_DATE
|
20
|
+
|
21
|
+
response = client.investments_transactions_get(investments_transactions_get_request)
|
22
|
+
|
23
|
+
refute_empty(response.accounts)
|
24
|
+
refute_empty(response.investment_transactions)
|
25
|
+
assert_kind_of(Plaid::InvestmentsTransactionsGetResponse, response)
|
26
|
+
|
27
|
+
investment_account = response.accounts.find do |account|
|
28
|
+
account.type == "investment"
|
29
|
+
end
|
30
|
+
|
31
|
+
account_ids = [investment_account.account_id]
|
32
|
+
options_payload = {}
|
33
|
+
options_payload[:account_ids] = account_ids
|
34
|
+
|
35
|
+
investments_transactions_get_request = Plaid::InvestmentsTransactionsGetRequest.new
|
36
|
+
investments_transactions_get_request.access_token = access_token
|
37
|
+
investments_transactions_get_request.options = options_payload
|
38
|
+
investments_transactions_get_request.start_date = START_DATE
|
39
|
+
investments_transactions_get_request.end_date = END_DATE
|
40
|
+
|
41
|
+
response = client.investments_transactions_get(investments_transactions_get_request)
|
42
|
+
|
43
|
+
refute_empty(response.investment_transactions)
|
44
|
+
assert_kind_of(Plaid::InvestmentsTransactionsGetResponse, response)
|
45
|
+
|
46
|
+
response.investment_transactions.each do |transaction|
|
47
|
+
refute_nil(transaction.investment_transaction_id)
|
48
|
+
refute_nil(transaction.account_id)
|
49
|
+
refute_nil(transaction.date)
|
50
|
+
refute_nil(transaction.name)
|
51
|
+
refute_nil(transaction.amount)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# rubocop:enable Metrics/MethodLength
|
56
|
+
|
57
|
+
def test_investment_transactions_get_date_objects
|
58
|
+
investments_transactions_get_request = Plaid::InvestmentsTransactionsGetRequest.new
|
59
|
+
investments_transactions_get_request.access_token = access_token
|
60
|
+
investments_transactions_get_request.start_date = START_DATE
|
61
|
+
investments_transactions_get_request.end_date = END_DATE
|
62
|
+
|
63
|
+
response = client.investments_transactions_get(investments_transactions_get_request)
|
64
|
+
|
65
|
+
refute_empty(response.accounts)
|
66
|
+
refute_empty(response.investment_transactions)
|
67
|
+
assert_kind_of(Plaid::InvestmentsTransactionsGetResponse, response)
|
68
|
+
|
69
|
+
investment_account = response.accounts.find do |account|
|
70
|
+
account.type == "investment"
|
71
|
+
end
|
72
|
+
|
73
|
+
account_ids = [investment_account.account_id]
|
74
|
+
options_payload = {}
|
75
|
+
options_payload[:account_ids] = account_ids
|
76
|
+
|
77
|
+
investments_transactions_get_request = Plaid::InvestmentsTransactionsGetRequest.new
|
78
|
+
investments_transactions_get_request.access_token = access_token
|
79
|
+
investments_transactions_get_request.options = options_payload
|
80
|
+
investments_transactions_get_request.start_date = Date.parse(START_DATE)
|
81
|
+
investments_transactions_get_request.end_date = Date.parse(END_DATE)
|
82
|
+
|
83
|
+
response = client.investments_transactions_get(investments_transactions_get_request)
|
84
|
+
refute_empty(response.investment_transactions)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_investment_transactions_get_invalid_access_token
|
88
|
+
begin
|
89
|
+
investments_transactions_get_request = Plaid::InvestmentsTransactionsGetRequest.new
|
90
|
+
investments_transactions_get_request.access_token = BAD_STRING
|
91
|
+
investments_transactions_get_request.start_date = START_DATE
|
92
|
+
investments_transactions_get_request.end_date = END_DATE
|
93
|
+
|
94
|
+
client.investments_transactions_get(investments_transactions_get_request)
|
95
|
+
rescue Plaid::ApiError => e
|
96
|
+
json_response = JSON.parse(e.response_body)
|
97
|
+
assert_equal(json_response["error_code"], "INVALID_ACCESS_TOKEN")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_investment_transactions_get_invalid_dates
|
102
|
+
begin
|
103
|
+
investments_transactions_get_request = Plaid::InvestmentsTransactionsGetRequest.new
|
104
|
+
investments_transactions_get_request.access_token = access_token
|
105
|
+
investments_transactions_get_request.start_date = BAD_STRING
|
106
|
+
investments_transactions_get_request.end_date = BAD_STRING
|
107
|
+
|
108
|
+
client.investments_transactions_get(investments_transactions_get_request)
|
109
|
+
rescue Plaid::ApiError => e
|
110
|
+
json_response = JSON.parse(e.response_body)
|
111
|
+
assert_equal(json_response["error_code"], "INVALID_FIELD")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_investment_transactions_get_with_options
|
116
|
+
options_payload = {}
|
117
|
+
options_payload[:count] = 2
|
118
|
+
options_payload[:offset] = 1
|
119
|
+
|
120
|
+
investments_transactions_get_request = Plaid::InvestmentsTransactionsGetRequest.new
|
121
|
+
investments_transactions_get_request.access_token = access_token
|
122
|
+
investments_transactions_get_request.options = options_payload
|
123
|
+
investments_transactions_get_request.start_date = START_DATE
|
124
|
+
investments_transactions_get_request.end_date = END_DATE
|
125
|
+
|
126
|
+
response = client.investments_transactions_get(investments_transactions_get_request)
|
127
|
+
assert_equal(2, response.investment_transactions.length)
|
128
|
+
assert_kind_of(Plaid::InvestmentsTransactionsGetResponse, response)
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_investment_transactions_get_invalid_options
|
132
|
+
begin
|
133
|
+
options_payload = {}
|
134
|
+
options_payload[:count] = BAD_STRING
|
135
|
+
options_payload[:offset] = BAD_STRING
|
136
|
+
|
137
|
+
investments_transactions_get_request = Plaid::InvestmentsTransactionsGetRequest.new
|
138
|
+
investments_transactions_get_request.access_token = access_token
|
139
|
+
investments_transactions_get_request.start_date = BAD_STRING
|
140
|
+
investments_transactions_get_request.end_date = BAD_STRING
|
141
|
+
|
142
|
+
client.investments_transactions_get(investments_transactions_get_request)
|
143
|
+
rescue Plaid::ApiError => e
|
144
|
+
json_response = JSON.parse(e.response_body)
|
145
|
+
assert_equal(json_response["error_code"], "INVALID_FIELD")
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_holdings_get
|
150
|
+
investments_holdings_get_request = Plaid::InvestmentsHoldingsGetRequest.new
|
151
|
+
investments_holdings_get_request.access_token = access_token
|
152
|
+
|
153
|
+
response = client.investments_holdings_get(investments_holdings_get_request)
|
154
|
+
|
155
|
+
refute_empty(response.accounts)
|
156
|
+
refute_empty(response.holdings)
|
157
|
+
refute_empty(response.securities)
|
158
|
+
|
159
|
+
investment_account = response.accounts.find do |account|
|
160
|
+
account.type == "investment"
|
161
|
+
end
|
162
|
+
|
163
|
+
account_id = investment_account.account_id
|
164
|
+
investments_holdings_get_request = Plaid::InvestmentsHoldingsGetRequest.new
|
165
|
+
investments_holdings_get_request.access_token = access_token
|
166
|
+
|
167
|
+
options_payload = {}
|
168
|
+
options_payload[:account_ids] = [account_id]
|
169
|
+
investments_holdings_get_request.options = options_payload
|
170
|
+
|
171
|
+
response = client.investments_holdings_get(investments_holdings_get_request)
|
172
|
+
|
173
|
+
response.holdings.each do |holding|
|
174
|
+
assert_equal account_id, holding.account_id
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_holdings_get_invalid_access_token
|
179
|
+
investments_holdings_get_request = Plaid::InvestmentsHoldingsGetRequest.new
|
180
|
+
investments_holdings_get_request.access_token = BAD_STRING
|
181
|
+
|
182
|
+
begin
|
183
|
+
response = client.investments_holdings_get(investments_holdings_get_request)
|
184
|
+
rescue Plaid::ApiError => e
|
185
|
+
json_response = JSON.parse(e.response_body)
|
186
|
+
assert_equal(json_response["error_code"], "INVALID_ACCESS_TOKEN")
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_holdings_get_invalid_options
|
191
|
+
investments_holdings_get_request = Plaid::InvestmentsHoldingsGetRequest.new
|
192
|
+
investments_holdings_get_request.access_token = access_token
|
193
|
+
|
194
|
+
options_payload = {}
|
195
|
+
options_payload[:account_ids] = [BAD_STRING]
|
196
|
+
investments_holdings_get_request.options = options_payload
|
197
|
+
|
198
|
+
begin
|
199
|
+
response = client.investments_holdings_get(investments_holdings_get_request)
|
200
|
+
rescue Plaid::ApiError => e
|
201
|
+
json_response = JSON.parse(e.response_body)
|
202
|
+
assert_equal(json_response["error_code"], "INVALID_FIELD")
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|