class Confy::Api::Projects

An organization can contain any number of projects.

org - Name of the organization

Public Class Methods

new(org, client) click to toggle source
# File lib/confy/api/projects.rb, line 10
def initialize(org, client)
  @org = org
  @client = client
end

Public Instance Methods

create(name, description, options = {}) click to toggle source

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

# File lib/confy/api/projects.rb, line 30
def create(name, description, options = {})
  body = options.fetch(:body, {})
  body[:name] = name
  body[:description] = description

  @client.post("/orgs/#{@org}/projects", body, options)
end
destroy(project, options = {}) click to toggle source

Delete the given project. Authenticated user should be the owner of the organization.

'/orgs/:org/projects/:project' DELETE

project - Name of the project

# File lib/confy/api/projects.rb, line 67
def destroy(project, options = {})
  body = options.fetch(:body, {})

  @client.delete("/orgs/#{@org}/projects/#{project}", body, options)
end
list(options = {}) click to toggle source

List all the projects of the given organization which can be accessed by the authenticated user.

'/orgs/:org/projects' GET

# File lib/confy/api/projects.rb, line 18
def list(options = {})
  body = options.fetch(:query, {})

  @client.get("/orgs/#{@org}/projects", body, options)
end
retrieve(project, options = {}) click to toggle source

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

# File lib/confy/api/projects.rb, line 43
def retrieve(project, options = {})
  body = options.fetch(:query, {})

  @client.get("/orgs/#{@org}/projects/#{project}", body, options)
end
update(project, description, options = {}) click to toggle source

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

# File lib/confy/api/projects.rb, line 55
def update(project, description, options = {})
  body = options.fetch(:body, {})
  body[:description] = description

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