Class: Braintrust::Resources::Organizations
- Inherits:
-
Object
- Object
- Braintrust::Resources::Organizations
- Defined in:
- lib/braintrust/resources/organizations.rb,
lib/braintrust/resources/organizations/members.rb
Defined Under Namespace
Classes: Members
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#delete(organization_id, opts = {}) ⇒ Braintrust::Models::Organization
Delete an organization object by its id.
-
#initialize(client:) ⇒ Organizations
constructor
A new instance of Organizations.
-
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Organization>
List out all organizations.
-
#retrieve(organization_id, opts = {}) ⇒ Braintrust::Models::Organization
Get an organization object by its id.
-
#update(organization_id, params = {}, opts = {}) ⇒ Braintrust::Models::Organization
Partially update an organization object.
Constructor Details
#initialize(client:) ⇒ Organizations
Returns a new instance of Organizations.
9 10 11 12 |
# File 'lib/braintrust/resources/organizations.rb', line 9 def initialize(client:) @client = client @members = Braintrust::Resources::Organizations::Members.new(client: client) end |
Instance Attribute Details
#members ⇒ Braintrust::Resources::Organizations::Members (readonly)
7 8 9 |
# File 'lib/braintrust/resources/organizations.rb', line 7 def members @members end |
Instance Method Details
#delete(organization_id, opts = {}) ⇒ Braintrust::Models::Organization
Delete an organization object by its id
91 92 93 94 95 96 97 |
# File 'lib/braintrust/resources/organizations.rb', line 91 def delete(organization_id, opts = {}) req = {} req[:method] = :delete req[:path] = "/v1/organization/#{organization_id}" req[:model] = Braintrust::Models::Organization @client.request(req, opts) end |
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Organization>
List out all organizations. The organizations are sorted by creation date, with the most recently-created organizations coming first
75 76 77 78 79 80 81 82 83 |
# File 'lib/braintrust/resources/organizations.rb', line 75 def list(params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/organization" req[:query] = params req[:page] = Braintrust::ListObjects req[:model] = Braintrust::Models::Organization @client.request(req, opts) end |
#retrieve(organization_id, opts = {}) ⇒ Braintrust::Models::Organization
Get an organization object by its id
20 21 22 23 24 25 26 |
# File 'lib/braintrust/resources/organizations.rb', line 20 def retrieve(organization_id, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/organization/#{organization_id}" req[:model] = Braintrust::Models::Organization @client.request(req, opts) end |
#update(organization_id, params = {}, opts = {}) ⇒ Braintrust::Models::Organization
Partially update an organization object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.
44 45 46 47 48 49 50 51 |
# File 'lib/braintrust/resources/organizations.rb', line 44 def update(organization_id, params = {}, opts = {}) req = {} req[:method] = :patch req[:path] = "/v1/organization/#{organization_id}" req[:body] = params req[:model] = Braintrust::Models::Organization @client.request(req, opts) end |