Class: TeamcityRuby::Project
- Inherits:
-
Object
- Object
- TeamcityRuby::Project
- Extended by:
- Resource
- Defined in:
- lib/teamcity_ruby/project.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent_id ⇒ Object
readonly
Returns the value of attribute parent_id.
-
#teamcity_id ⇒ Object
readonly
Returns the value of attribute teamcity_id.
Class Method Summary collapse
Instance Method Summary collapse
- #description ⇒ Object
- #description=(value) ⇒ Object
- #destroy! ⇒ Object
-
#initialize(options = {}) ⇒ Project
constructor
A new instance of Project.
Methods included from Resource
all, client, extended, find, locator, resource_name, url_path
Constructor Details
#initialize(options = {}) ⇒ Project
Returns a new instance of Project.
23 24 25 26 27 |
# File 'lib/teamcity_ruby/project.rb', line 23 def initialize( = {}) @teamcity_id = ["id"] @name = ["name"] @parent_id = ["parentProjectId"] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/teamcity_ruby/project.rb', line 5 def name @name end |
#parent_id ⇒ Object (readonly)
Returns the value of attribute parent_id.
5 6 7 |
# File 'lib/teamcity_ruby/project.rb', line 5 def parent_id @parent_id end |
#teamcity_id ⇒ Object (readonly)
Returns the value of attribute teamcity_id.
5 6 7 |
# File 'lib/teamcity_ruby/project.rb', line 5 def teamcity_id @teamcity_id end |
Class Method Details
.create(name, options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/teamcity_ruby/project.rb', line 10 def self.create(name, = {}) payload = { "name" => name } payload["parentProject"] = { "id" => [:parent_id] } if [:parent_id] if [:source_id] payload["sourceProject"] = { "id" => [:source_id] } payload["copyAllAssociatedSettings"] = 'true' end response = client.post("/projects", :body => payload.to_json) new(response) end |
Instance Method Details
#description ⇒ Object
38 39 40 41 |
# File 'lib/teamcity_ruby/project.rb', line 38 def description headers = { "Accept" => "text/plain", "Content-Type" => "text/plain" } client.get("/projects/id:#{teamcity_id}/description", :headers => headers, :format => :text).parsed_response end |
#description=(value) ⇒ Object
33 34 35 36 |
# File 'lib/teamcity_ruby/project.rb', line 33 def description=(value) headers = { "Accept" => "text/plain", "Content-Type" => "text/plain" } client.put("/projects/id:#{teamcity_id}/description", :body => value, :headers => headers) end |
#destroy! ⇒ Object
29 30 31 |
# File 'lib/teamcity_ruby/project.rb', line 29 def destroy! client.delete("/projects/id:#{teamcity_id}") end |