Class: Confy::Api::Orgs
- Inherits:
-
Object
- Object
- Confy::Api::Orgs
- 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
-
#initialize(client) ⇒ Orgs
constructor
A new instance of Orgs.
-
#list(options = {}) ⇒ Object
List all organizations the authenticated user is a member of.
-
#retrieve(org, options = {}) ⇒ Object
Get the given organization if the authenticated user is a member.
-
#update(org, email, options = {}) ⇒ Object
Update the given organization if the authenticated user is the owner.
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( = {}) body = .fetch(:query, {}) @client.get("/orgs", body, ) 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, = {}) body = .fetch(:query, {}) @client.get("/orgs/#{org}", body, ) 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, = {}) body = .fetch(:body, {}) body[:email] = email @client.patch("/orgs/#{org}", body, ) end |