Class: Confy::Api::Orgs

Inherits:
Object
  • Object
show all
Defined in:
lib/confy/api/orgs.rb

Overview

Organizations are owned by users and only (s)he can add/remove teams and projects for that organization. A default organization will be created for every user.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Orgs

Returns a new instance of Orgs.



8
9
10
# File 'lib/confy/api/orgs.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#list(options = {}) ⇒ Object

List all organizations the authenticated user is a member of.

‘/orgs’ GET



15
16
17
18
19
# File 'lib/confy/api/orgs.rb', line 15

def list(options = {})
  body = options.fetch(:query, {})

  @client.get("/orgs", body, options)
end

#retrieve(org, options = {}) ⇒ Object

Get the given organization if the authenticated user is a member.

‘/orgs/:org’ GET

org - Name of the organization



26
27
28
29
30
# File 'lib/confy/api/orgs.rb', line 26

def retrieve(org, options = {})
  body = options.fetch(:query, {})

  @client.get("/orgs/#{org}", body, options)
end

#update(org, email, options = {}) ⇒ Object

Update the given organization if the authenticated user is the owner. __Email__ is the only thing which can be updated.

‘/orgs/:org’ PATCH

org - Name of the organization email - Billing email of the organization



38
39
40
41
42
43
# File 'lib/confy/api/orgs.rb', line 38

def update(org, email, options = {})
  body = options.fetch(:body, {})
  body[:email] = email

  @client.patch("/orgs/#{org}", body, options)
end