class Confy::Api::Envs

Every project has a default environment named Production. Each environment has __one__ configuration document which can have many keys and values.

org - Name of the organization project - Name of the project

Public Class Methods

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

Public Instance Methods

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

Create an environment. The authenticated user should have access to the project.

'/orgs/:org/projects/:project/envs' POST

name - Name of the environment description - Description of the environment

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

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

Delete the given environment. Authenticated user should have access to the project. Cannot delete the default environment.

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

env - Name of the environment

# File lib/confy/api/envs.rb, line 69
def destroy(env, options = {})
  body = options.fetch(:body, {})

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

List all the environmens of the project. The authenticated user should have access to the project.

'/orgs/:org/projects/:project/envs' GET

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

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

Get the given environment in the given project. The authenticated user should have access to the project.

'/orgs/:org/projects/:project/envs/:env' GET

env - Name of the environment

# File lib/confy/api/envs.rb, line 45
def retrieve(env, options = {})
  body = options.fetch(:query, {})

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

Update the given environment. __Description__ is the only thing which can be updated. Authenticated user should have access to the project.

'/orgs/:org/projects/:project/envs/:env' PATCH

env - Name of the environment description - Description of the environment

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

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