Class: Confy::Api::Projects
- Inherits:
-
Object
- Object
- Confy::Api::Projects
- Defined in:
- lib/confy/api/projects.rb
Overview
An organization can contain any number of projects.
org - Name of the organization
Instance Method Summary collapse
-
#create(name, description, options = {}) ⇒ Object
Create a project if the authenticated user is the owner of the given organization.
-
#destroy(project, options = {}) ⇒ Object
Delete the given project.
-
#initialize(org, client) ⇒ Projects
constructor
A new instance of Projects.
-
#list(options = {}) ⇒ Object
List all the projects of the given organization which can be accessed by the authenticated user.
-
#retrieve(project, options = {}) ⇒ Object
Get the given project in the given organization.
-
#update(project, description, options = {}) ⇒ Object
Update the given project.
Constructor Details
#initialize(org, client) ⇒ Projects
Returns a new instance of Projects.
10 11 12 13 |
# File 'lib/confy/api/projects.rb', line 10 def initialize(org, client) @org = org @client = client end |
Instance Method Details
#create(name, description, options = {}) ⇒ Object
Create a project if the authenticated user is the owner of the given organization. Only the __owners__ team will be able to see the project initially.
‘/orgs/:org/projects’ POST
name - Name of the project description - Description of the project
30 31 32 33 34 35 36 |
# File 'lib/confy/api/projects.rb', line 30 def create(name, description, = {}) body = .fetch(:body, {}) body[:name] = name body[:description] = description @client.post("/orgs/#{@org}/projects", body, ) end |
#destroy(project, options = {}) ⇒ Object
Delete the given project. Authenticated user should be the owner of the organization.
‘/orgs/:org/projects/:project’ DELETE
project - Name of the project
67 68 69 70 71 |
# File 'lib/confy/api/projects.rb', line 67 def destroy(project, = {}) body = .fetch(:body, {}) @client.delete("/orgs/#{@org}/projects/#{project}", body, ) end |
#list(options = {}) ⇒ Object
List all the projects of the given organization which can be accessed by the authenticated user.
‘/orgs/:org/projects’ GET
18 19 20 21 22 |
# File 'lib/confy/api/projects.rb', line 18 def list( = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/projects", body, ) end |
#retrieve(project, options = {}) ⇒ Object
Get the given project in the given organization. Works only if the authenticated user has access to the project.
‘/orgs/:org/projects/:project’ GET
project - Name of the project
43 44 45 46 47 |
# File 'lib/confy/api/projects.rb', line 43 def retrieve(project, = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/projects/#{project}", body, ) end |
#update(project, description, options = {}) ⇒ Object
Update the given project. __Description__ is the only thing which can be updated. Authenticated user should be the owner of the organization.
‘/orgs/:org/projects/:project’ PATCH
project - Name of the project description - Description of the project
55 56 57 58 59 60 |
# File 'lib/confy/api/projects.rb', line 55 def update(project, description, = {}) body = .fetch(:body, {}) body[:description] = description @client.patch("/orgs/#{@org}/projects/#{project}", body, ) end |