Class: Airwallex::ConnectedAccount
- Inherits:
-
APIResource
- Object
- APIResource
- Airwallex::ConnectedAccount
- Extended by:
- APIOperations::Create, APIOperations::List, APIOperations::Retrieve
- Includes:
- APIOperations::Update
- Defined in:
- lib/airwallex/resources/connected_account.rb
Overview
Represents a Connected Account (Scale product) — a sub-account container used to onboard and track funds for a platform's connected entities.
Constant Summary collapse
- CURRENT_ACCOUNT_PATH =
Not nested under /accounts/APIResource#id — these endpoints are implicitly scoped to whichever account the request is authenticated as (the platform's own account, or a connected account via x-on-behalf-of).
"/api/v1/account"- WALLET_INFO_PATH =
"/api/v1/account/wallet_info"
Instance Attribute Summary
Attributes inherited from APIResource
Class Method Summary collapse
-
.current(params = {}) ⇒ ConnectedAccount
Retrieve whichever account the current request is authenticated as.
-
.resource_path ⇒ String
API resource path for connected accounts.
-
.wallet_info(params = {}) ⇒ Hash
Retrieve wallet info for whichever account the current request is authenticated as.
Instance Method Summary collapse
-
#agree_to_terms_and_conditions(params = {}) ⇒ ConnectedAccount
Agree to Airwallex's terms and conditions on behalf of this account.
-
#legal_entity_id ⇒ String?
The legal_entity_id needed by BillingCustomer.create's default_legal_entity_id and BillingSubscription.create's legal_entity_id — nested inside account_details on this account's own response, not a separate resource.
-
#reactivate(params = {}) ⇒ ConnectedAccount
Reactivate a suspended account.
-
#submit(params = {}) ⇒ ConnectedAccount
Submit the account for KYC/KYB verification.
-
#suspend(params = {}) ⇒ ConnectedAccount
Suspend this account.
Methods included from APIOperations::Create
Methods included from APIOperations::Retrieve
Methods included from APIOperations::List
Methods included from APIOperations::Update
Methods inherited from APIResource
#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, #to_hash, #to_json, #to_s
Constructor Details
This class inherits a constructor from Airwallex::APIResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Airwallex::APIResource
Class Method Details
.current(params = {}) ⇒ ConnectedAccount
Retrieve whichever account the current request is authenticated as
69 70 71 72 |
# File 'lib/airwallex/resources/connected_account.rb', line 69 def self.current(params = {}) response = Airwallex.client.get(CURRENT_ACCOUNT_PATH, params) new(response) end |
.resource_path ⇒ String
Returns API resource path for connected accounts.
61 62 63 |
# File 'lib/airwallex/resources/connected_account.rb', line 61 def self.resource_path "/api/v1/accounts" end |
.wallet_info(params = {}) ⇒ Hash
Retrieve wallet info for whichever account the current request is authenticated as
79 80 81 |
# File 'lib/airwallex/resources/connected_account.rb', line 79 def self.wallet_info(params = {}) Airwallex.client.get(WALLET_INFO_PATH, params) end |
Instance Method Details
#agree_to_terms_and_conditions(params = {}) ⇒ ConnectedAccount
Agree to Airwallex's terms and conditions on behalf of this account
108 109 110 111 112 113 114 |
# File 'lib/airwallex/resources/connected_account.rb', line 108 def agree_to_terms_and_conditions(params = {}) response = Airwallex.client.post( "#{self.class.resource_path}/#{id}/terms_and_conditions/agree", params ) refresh_from(response) self end |
#legal_entity_id ⇒ String?
The legal_entity_id needed by BillingCustomer.create's default_legal_entity_id and BillingSubscription.create's legal_entity_id — nested inside account_details on this account's own response, not a separate resource.
89 90 91 |
# File 'lib/airwallex/resources/connected_account.rb', line 89 def legal_entity_id attributes.dig(:account_details, :legal_entity_id) end |
#reactivate(params = {}) ⇒ ConnectedAccount
Reactivate a suspended account
130 131 132 133 134 |
# File 'lib/airwallex/resources/connected_account.rb', line 130 def reactivate(params = {}) response = Airwallex.client.post("#{self.class.resource_path}/#{id}/reactivate", params) refresh_from(response) self end |
#submit(params = {}) ⇒ ConnectedAccount
Submit the account for KYC/KYB verification
97 98 99 100 101 |
# File 'lib/airwallex/resources/connected_account.rb', line 97 def submit(params = {}) response = Airwallex.client.post("#{self.class.resource_path}/#{id}/submit", params) refresh_from(response) self end |
#suspend(params = {}) ⇒ ConnectedAccount
Suspend this account
120 121 122 123 124 |
# File 'lib/airwallex/resources/connected_account.rb', line 120 def suspend(params = {}) response = Airwallex.client.post("#{self.class.resource_path}/#{id}/suspend", params) refresh_from(response) self end |