Class: Straddle::Resources::Accounts
- Inherits:
-
Object
- Object
- Straddle::Resources::Accounts
- Defined in:
- lib/straddle/resources/accounts.rb,
sig/straddle/resources/accounts.rbs
Overview
Accounts represent businesses that use Straddle through a platform.
Instance Method Summary collapse
-
#create(access_level:, account_type:, business_profile:, organization_id:, external_id: nil, metadata: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Some parameter documentations has been truncated, see Models::AccountCreateParams for more details.
-
#initialize(client:) ⇒ Accounts
constructor
private
A new instance of Accounts.
-
#list(external_id: nil, page_number: nil, page_size: nil, search_text: nil, sort_by: nil, sort_order: nil, status: nil, type: nil, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountList
Some parameter documentations has been truncated, see Models::AccountListParams for more details.
-
#onboard(account_id, terms_of_service:, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Some parameter documentations has been truncated, see Models::AccountOnboardParams for more details.
-
#retrieve(account_id, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Returns the account with the specified ID.
-
#simulate_onboarding(account_id, final_status: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Some parameter documentations has been truncated, see Models::AccountSimulateOnboardingParams for more details.
-
#update(account_id, business_profile:, external_id: nil, metadata: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Some parameter documentations has been truncated, see Models::AccountUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Accounts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Accounts.
263 264 265 |
# File 'lib/straddle/resources/accounts.rb', line 263 def initialize(client:) @client = client end |
Instance Method Details
#create(access_level:, account_type:, business_profile:, organization_id:, external_id: nil, metadata: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Some parameter documentations has been truncated, see Models::AccountCreateParams for more details.
Creates a business account in the specified organization and returns the account.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/straddle/resources/accounts.rb', line 38 def create(params) parsed, = Straddle::AccountCreateParams.dump_request(params) header_params = { correlation_id: "correlation-id", idempotency_key: "idempotency-key", request_id: "request-id" } @client.request( method: :post, path: "v1/accounts", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Straddle::AccountResponse, options: ) end |
#list(external_id: nil, page_number: nil, page_size: nil, search_text: nil, sort_by: nil, sort_order: nil, status: nil, type: nil, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountList
Some parameter documentations has been truncated, see Models::AccountListParams for more details.
Returns a paginated list of accounts for your platform. Filter the list by status, type, external ID, or text search.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/straddle/resources/accounts.rb', line 158 def list(params = {}) query_params = %i[external_id page_number page_size search_text sort_by sort_order status type] parsed, = Straddle::AccountListParams.dump_request(params) query = Straddle::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "v1/accounts", query: query, headers: parsed.except(*query_params).transform_keys( correlation_id: "correlation-id", request_id: "request-id" ), model: Straddle::AccountList, options: ) end |
#onboard(account_id, terms_of_service:, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Some parameter documentations has been truncated, see Models::AccountOnboardParams for more details.
Starts onboarding and records the account's acceptance of Straddle's Terms of
Service. The account must have at least one representative and one linked bank
account. This operation also moves all associated representatives and linked
bank accounts to onboarding.
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/straddle/resources/accounts.rb', line 201 def onboard(account_id, params) parsed, = Straddle::AccountOnboardParams.dump_request(params) header_params = { correlation_id: "correlation-id", idempotency_key: "idempotency-key", request_id: "request-id" } @client.request( method: :post, path: ["v1/accounts/%1$s/onboard", account_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Straddle::AccountResponse, options: ) end |
#retrieve(account_id, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Returns the account with the specified ID.
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/straddle/resources/accounts.rb', line 70 def retrieve(account_id, params = {}) parsed, = Straddle::AccountRetrieveParams.dump_request(params) @client.request( method: :get, path: ["v1/accounts/%1$s", account_id], headers: parsed.transform_keys(correlation_id: "correlation-id", request_id: "request-id"), model: Straddle::AccountResponse, options: ) end |
#simulate_onboarding(account_id, final_status: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Some parameter documentations has been truncated, see Models::AccountSimulateOnboardingParams for more details.
Simulates an account status transition to onboarding or active in the
sandbox and returns the account.
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/straddle/resources/accounts.rb', line 241 def simulate_onboarding(account_id, params = {}) query_params = [:final_status] parsed, = Straddle::AccountSimulateOnboardingParams.dump_request(params) query = Straddle::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :post, path: ["v1/accounts/%1$s/simulate", account_id], query: query, headers: parsed.except(*query_params).transform_keys( correlation_id: "correlation-id", idempotency_key: "idempotency-key", request_id: "request-id" ), model: Straddle::AccountResponse, options: ) end |
#update(account_id, business_profile:, external_id: nil, metadata: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::AccountResponse
Some parameter documentations has been truncated, see Models::AccountUpdateParams for more details.
Updates an account's business profile, metadata, and external ID, then returns the account.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/straddle/resources/accounts.rb', line 108 def update(account_id, params) parsed, = Straddle::AccountUpdateParams.dump_request(params) header_params = { correlation_id: "correlation-id", idempotency_key: "idempotency-key", request_id: "request-id" } @client.request( method: :put, path: ["v1/accounts/%1$s", account_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Straddle::AccountResponse, options: ) end |