Class: Confy::Api::Config
- Inherits:
-
Object
- Object
- Confy::Api::Config
- Defined in:
- lib/confy/api/config.rb
Overview
Any member of the team which has access to the project can retrieve any of it’s environment’s configuration document or edit it.
org - Name of the organization project - Name of the project env - Name of the environment
Instance Method Summary collapse
-
#initialize(org, project, env, client) ⇒ Config
constructor
A new instance of Config.
-
#retrieve(options = {}) ⇒ Object
Get an environment configuration.
-
#update(config, options = {}) ⇒ Object
Update the configuration document for the given environment of the project.
-
#versions(options = {}) ⇒ Object
List the last 10 versions of the environment configuration.
Constructor Details
#initialize(org, project, env, client) ⇒ Config
Returns a new instance of Config.
12 13 14 15 16 17 |
# File 'lib/confy/api/config.rb', line 12 def initialize(org, project, env, client) @org = org @project = project @env = env @client = client end |
Instance Method Details
#retrieve(options = {}) ⇒ Object
Get an environment configuration
‘/orgs/:org/projects/:project/envs/:env/config’ GET
22 23 24 25 26 |
# File 'lib/confy/api/config.rb', line 22 def retrieve( = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/projects/#{@project}/envs/#{@env}/config", body, ) end |
#update(config, options = {}) ⇒ Object
Update the configuration document for the given environment of the project. We will patch the document recursively.
‘/orgs/:org/projects/:project/envs/:env/config’ PATCH
config - Configuration to update
33 34 35 36 37 38 |
# File 'lib/confy/api/config.rb', line 33 def update(config, = {}) body = .fetch(:body, {}) body[:config] = config @client.patch("/orgs/#{@org}/projects/#{@project}/envs/#{@env}/config", body, ) end |
#versions(options = {}) ⇒ Object
List the last 10 versions of the environment configuration
‘/orgs/:org/projects/:project/envs/:env/versions’ GET
43 44 45 46 47 |
# File 'lib/confy/api/config.rb', line 43 def versions( = {}) body = .fetch(:query, {}) @client.get("/orgs/#{@org}/projects/#{@project}/envs/#{@env}/versions", body, ) end |