Class: StraddlePay::Resources::EmbedAccounts
- Defined in:
- lib/straddle_pay/resources/embed_accounts.rb
Overview
Manage embedded accounts for platform/marketplace use. Accessed via StraddlePay::Resources::Embed#accounts.
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #capability_requests ⇒ AccountCapabilityRequests
-
#create(organization_id:, account_type:, business_profile:, access_level:, **options) ⇒ Hash
Create an embedded account.
-
#get(id, **options) ⇒ Hash
Retrieve an account by ID.
-
#list(**options) ⇒ Hash
List accounts with optional filters.
-
#onboard(id, terms_of_service:, **options) ⇒ Hash
Onboard an account (accept terms of service).
-
#simulate(id, final_status:, **options) ⇒ Hash
Simulate account status change (sandbox only).
-
#update(id, **options) ⇒ Hash
Update an account.
Methods inherited from Base
Constructor Details
This class inherits a constructor from StraddlePay::Resources::Base
Instance Method Details
#capability_requests ⇒ AccountCapabilityRequests
9 |
# File 'lib/straddle_pay/resources/embed_accounts.rb', line 9 def capability_requests = @capability_requests ||= AccountCapabilityRequests.new(@client) |
#create(organization_id:, account_type:, business_profile:, access_level:, **options) ⇒ Hash
Create an embedded account.
18 19 20 21 22 23 24 25 |
# File 'lib/straddle_pay/resources/embed_accounts.rb', line 18 def create(organization_id:, account_type:, business_profile:, access_level:, **) payload = { organization_id: organization_id, account_type: account_type, business_profile: business_profile, access_level: access_level, ** }.compact headers = extract_headers(payload) @client.post("v1/accounts", payload, headers: headers) end |
#get(id, **options) ⇒ Hash
Retrieve an account by ID.
31 32 33 34 |
# File 'lib/straddle_pay/resources/embed_accounts.rb', line 31 def get(id, **) headers = extract_headers() @client.get("v1/accounts/#{id}", headers: headers) end |
#list(**options) ⇒ Hash
List accounts with optional filters.
39 40 41 42 |
# File 'lib/straddle_pay/resources/embed_accounts.rb', line 39 def list(**) headers = extract_headers() @client.get("v1/accounts", params: , headers: headers) end |
#onboard(id, terms_of_service:, **options) ⇒ Hash
Onboard an account (accept terms of service).
58 59 60 61 62 |
# File 'lib/straddle_pay/resources/embed_accounts.rb', line 58 def onboard(id, terms_of_service:, **) payload = { terms_of_service: terms_of_service, ** }.compact headers = extract_headers(payload) @client.post("v1/accounts/#{id}/onboard", payload, headers: headers) end |
#simulate(id, final_status:, **options) ⇒ Hash
Simulate account status change (sandbox only).
69 70 71 72 73 |
# File 'lib/straddle_pay/resources/embed_accounts.rb', line 69 def simulate(id, final_status:, **) payload = { final_status: final_status, ** }.compact headers = extract_headers(payload) @client.post("v1/accounts/#{id}/simulate", payload, headers: headers) end |
#update(id, **options) ⇒ Hash
Update an account.
48 49 50 51 |
# File 'lib/straddle_pay/resources/embed_accounts.rb', line 48 def update(id, **) headers = extract_headers() @client.put("v1/accounts/#{id}", , headers: headers) end |