Class: StraddlePay::Resources::EmbedOrganizations

Inherits:
Base
  • Object
show all
Defined in:
lib/straddle_pay/resources/embed_organizations.rb

Overview

Manage organizations for embedded accounts. Accessed via StraddlePay::Resources::Embed#organizations.

Constant Summary

Constants inherited from Base

Base::HEADER_KEYS

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from StraddlePay::Resources::Base

Instance Method Details

#create(name:, **options) ⇒ Hash

Create an organization.



12
13
14
15
16
# File 'lib/straddle_pay/resources/embed_organizations.rb', line 12

def create(name:, **options)
  payload = { name: name, **options }.compact
  headers = extract_headers(payload)
  @client.post("v1/organizations", payload, headers: headers)
end

#get(id, **options) ⇒ Hash

Retrieve an organization by ID.



22
23
24
25
# File 'lib/straddle_pay/resources/embed_organizations.rb', line 22

def get(id, **options)
  headers = extract_headers(options)
  @client.get("v1/organizations/#{id}", headers: headers)
end

#list(**options) ⇒ Hash

List organizations with optional filters.



30
31
32
33
# File 'lib/straddle_pay/resources/embed_organizations.rb', line 30

def list(**options)
  headers = extract_headers(options)
  @client.get("v1/organizations", params: options, headers: headers)
end