Class: TeamcityRuby::AgentPool
- Inherits:
-
Object
- Object
- TeamcityRuby::AgentPool
- Extended by:
- Resource
- Defined in:
- lib/teamcity_ruby/agent_pool.rb
Instance Attribute Summary collapse
-
#teamcity_id ⇒ Object
Returns the value of attribute teamcity_id.
Class Method Summary collapse
Instance Method Summary collapse
- #add_project(options = {}) ⇒ Object
- #destroy! ⇒ Object
-
#initialize(options = {}) ⇒ AgentPool
constructor
A new instance of AgentPool.
- #projects ⇒ Object
Methods included from Resource
all, client, extended, find, locator, resource_name, url_path
Constructor Details
#initialize(options = {}) ⇒ AgentPool
Returns a new instance of AgentPool.
16 17 18 19 |
# File 'lib/teamcity_ruby/agent_pool.rb', line 16 def initialize( = {}) @teamcity_id = ["id"] @name = ["name"] end |
Instance Attribute Details
#teamcity_id ⇒ Object
Returns the value of attribute teamcity_id.
5 6 7 |
# File 'lib/teamcity_ruby/agent_pool.rb', line 5 def teamcity_id @teamcity_id end |
Class Method Details
.create(name, options = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/teamcity_ruby/agent_pool.rb', line 10 def self.create(name, = {}) payload = { "name" => name }.to_json response = client.post("/agentPools", :body => payload) new(response) end |
Instance Method Details
#add_project(options = {}) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/teamcity_ruby/agent_pool.rb', line 25 def add_project( = {}) raise "Agent pool needs a teamcity_id" unless self.teamcity_id project_id = .fetch(:project_id) { raise ":project_id is required" } payload = { "id" => project_id } response = client.post("/agentPools/id:#{self.teamcity_id}/projects", :body => payload.to_json) end |
#destroy! ⇒ Object
21 22 23 |
# File 'lib/teamcity_ruby/agent_pool.rb', line 21 def destroy! client.delete("/agentPools/id:#{teamcity_id}") end |