Class: Tripwire::Server::OrganizationsResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Tripwire::Server::OrganizationsResource
- Defined in:
- lib/tripwire/server/client.rb
Instance Attribute Summary collapse
-
#api_keys ⇒ Object
readonly
Returns the value of attribute api_keys.
Instance Method Summary collapse
- #create(name:, slug:) ⇒ Object
- #get(organization_id) ⇒ Object
-
#initialize(client) ⇒ OrganizationsResource
constructor
A new instance of OrganizationsResource.
- #update(organization_id, name: nil, status: nil) ⇒ Object
Constructor Details
#initialize(client) ⇒ OrganizationsResource
Returns a new instance of OrganizationsResource.
270 271 272 273 |
# File 'lib/tripwire/server/client.rb', line 270 def initialize(client) super(client) @api_keys = ApiKeysResource.new(client) end |
Instance Attribute Details
#api_keys ⇒ Object (readonly)
Returns the value of attribute api_keys.
268 269 270 |
# File 'lib/tripwire/server/client.rb', line 268 def api_keys @api_keys end |
Instance Method Details
#create(name:, slug:) ⇒ Object
275 276 277 |
# File 'lib/tripwire/server/client.rb', line 275 def create(name:, slug:) @client.request_json("POST", "/v1/organizations", body: { name: name, slug: slug })[:data] end |
#get(organization_id) ⇒ Object
279 280 281 |
# File 'lib/tripwire/server/client.rb', line 279 def get(organization_id) @client.request_json("GET", "/v1/organizations/#{CGI.escape(organization_id)}")[:data] end |
#update(organization_id, name: nil, status: nil) ⇒ Object
283 284 285 286 287 288 |
# File 'lib/tripwire/server/client.rb', line 283 def update(organization_id, name: nil, status: nil) @client.request_json("PATCH", "/v1/organizations/#{CGI.escape(organization_id)}", body: { name: name, status: status }.reject { |_key, value| value.nil? })[:data] end |