Class: TeamcityRuby::VcsRoot
- Inherits:
-
Object
- Object
- TeamcityRuby::VcsRoot
- Extended by:
- Resource
- Defined in:
- lib/teamcity_ruby/vcs_root.rb
Constant Summary collapse
- VCS_TYPES =
{ :git => 'jetbrains.git' }
- DEFAULT_PROJECT =
"_Root"- DEFAULT_VCS_TYPE =
:git
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
- #destroy! ⇒ Object
-
#initialize(options = {}) ⇒ VcsRoot
constructor
A new instance of VcsRoot.
Methods included from Resource
all, client, extended, find, locator, resource_name, url_path
Constructor Details
#initialize(options = {}) ⇒ VcsRoot
Returns a new instance of VcsRoot.
31 32 33 34 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 31 def initialize( = {}) @teamcity_id = ["id"] @name = ["name"] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 10 def name @name end |
#parent_id ⇒ Object (readonly)
Returns the value of attribute parent_id.
10 11 12 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 10 def parent_id @parent_id end |
#teamcity_id ⇒ Object (readonly)
Returns the value of attribute teamcity_id.
10 11 12 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 10 def teamcity_id @teamcity_id end |
Class Method Details
.create(options = {}, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 15 def self.create( = {}, &block) vcs_type = VCS_TYPES[.fetch(:type) { DEFAULT_VCS_TYPE }] project_id = .fetch(:project_id) { DEFAULT_PROJECT } attributes = { "name" => [:name], "vcsName" => vcs_type, "projectLocator" => "id:#{project_id}", } builder = TeamCity::ElementBuilder.new(attributes, &block) response = client.post("/vcs-roots", :body => builder.to_request_body) VcsRoot.new(response) end |
Instance Method Details
#destroy! ⇒ Object
36 37 38 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 36 def destroy! client.delete("/vcs-roots/id:#{self.teamcity_id}") end |