Class: Confy::Api::Envs
- Inherits:
-
Object
- Object
- Confy::Api::Envs
- Defined in:
- lib/confy/api/envs.rb
Overview
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
Instance Method Summary collapse
-
#create(name, description, options = {}) ⇒ Object
Create an environment.
-
#destroy(env, options = {}) ⇒ Object
Delete the given environment.
-
#initialize(org, project, client) ⇒ Envs
constructor
A new instance of Envs.
-
#list(options = {}) ⇒ Object
List all the environmens of the project.
-
#retrieve(env, options = {}) ⇒ Object
Get the given environment in the given project.
-
#update(env, description, options = {}) ⇒ Object
Update the given environment.
Constructor Details
#initialize(org, project, client) ⇒ Envs
Returns a new instance of Envs.
11 12 13 14 15 |
# File 'lib/confy/api/envs.rb', line 11 def initialize(org, project, client) @org = org @project = project @client = client end |
Instance Method Details
#create(name, description, options = {}) ⇒ Object
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
32 33 34 35 36 37 38 |
# File 'lib/confy/api/envs.rb', line 32 def create(name, description, = {}) body = .fetch(:body, {}) body[:name] = name body[:description] = description @client.post("/orgs/#{@org}/projects/#{@project}/envs", body, ) end |
#destroy(env, options = {}) ⇒ Object
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
69 70 71 72 73 |
# File 'lib/confy/api/envs.rb', line 69 def destroy(env, = {}) body = .fetch(:body, {}) @client.delete("/orgs/#{@org}/projects/#{@project}/envs/#{env}", body, ) end |
#list(options = {}) ⇒ Object
List all the environmens of the project. The authenticated user should have access to the project.
‘/orgs/:org/projects/:project/envs’ GET
20 21 22 23 24 |
# File 'lib/confy/api/envs.rb', line 20 def list( = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/projects/#{@project}/envs", body, ) end |
#retrieve(env, options = {}) ⇒ Object
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
45 46 47 48 49 |
# File 'lib/confy/api/envs.rb', line 45 def retrieve(env, = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/projects/#{@project}/envs/#{env}", body, ) end |
#update(env, description, options = {}) ⇒ Object
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
57 58 59 60 61 62 |
# File 'lib/confy/api/envs.rb', line 57 def update(env, description, = {}) body = .fetch(:body, {}) body[:description] = description @client.patch("/orgs/#{@org}/projects/#{@project}/envs/#{env}", body, ) end |