Class: Straddle::Resources::Organizations
- Inherits:
-
Object
- Object
- Straddle::Resources::Organizations
- Defined in:
- lib/straddle/resources/organizations.rb,
sig/straddle/resources/organizations.rbs
Overview
Organizations group related Straddle accounts.
Instance Method Summary collapse
-
#create(name:, external_id: nil, metadata: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::OrganizationResponse
Some parameter documentations has been truncated, see Models::OrganizationCreateParams for more details.
-
#initialize(client:) ⇒ Organizations
constructor
private
A new instance of Organizations.
-
#list(external_id: nil, name: nil, page_number: nil, page_size: nil, sort_by: nil, sort_order: nil, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::OrganizationList
Some parameter documentations has been truncated, see Models::OrganizationListParams for more details.
-
#retrieve(organization_id, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::OrganizationResponse
Returns the organization with the specified ID.
Constructor Details
#initialize(client:) ⇒ Organizations
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 Organizations.
125 126 127 |
# File 'lib/straddle/resources/organizations.rb', line 125 def initialize(client:) @client = client end |
Instance Method Details
#create(name:, external_id: nil, metadata: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::OrganizationResponse
Some parameter documentations has been truncated, see Models::OrganizationCreateParams for more details.
Creates an organization for your platform and returns it. Organizations group related accounts and users.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/straddle/resources/organizations.rb', line 32 def create(params) parsed, = Straddle::OrganizationCreateParams.dump_request(params) header_params = { correlation_id: "correlation-id", idempotency_key: "idempotency-key", request_id: "request-id" } @client.request( method: :post, path: "v1/organizations", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Straddle::OrganizationResponse, options: ) end |
#list(external_id: nil, name: nil, page_number: nil, page_size: nil, sort_by: nil, sort_order: nil, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::OrganizationList
Some parameter documentations has been truncated, see Models::OrganizationListParams for more details.
Returns a paginated list of organizations for your platform. Filter the list by name or external ID.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/straddle/resources/organizations.rb', line 104 def list(params = {}) query_params = %i[external_id name page_number page_size sort_by sort_order] parsed, = Straddle::OrganizationListParams.dump_request(params) query = Straddle::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "v1/organizations", query: query, headers: parsed.except(*query_params).transform_keys( correlation_id: "correlation-id", request_id: "request-id" ), model: Straddle::OrganizationList, options: ) end |
#retrieve(organization_id, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::OrganizationResponse
Returns the organization with the specified ID.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/straddle/resources/organizations.rb', line 64 def retrieve(organization_id, params = {}) parsed, = Straddle::OrganizationRetrieveParams.dump_request(params) @client.request( method: :get, path: ["v1/organizations/%1$s", organization_id], headers: parsed.transform_keys(correlation_id: "correlation-id", request_id: "request-id"), model: Straddle::OrganizationResponse, options: ) end |