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', :svn => 'svn' }
- DEFAULT_PROJECT =
"_Root"- DEFAULT_VCS_TYPE =
"jetbrains.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.
-
#vcs_type ⇒ Object
readonly
Returns the value of attribute vcs_type.
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.
36 37 38 39 40 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 36 def initialize( = {}) @teamcity_id = ["id"] @name = ["name"] @vcs_type = ["vcsName"] 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 |
#vcs_type ⇒ Object (readonly)
Returns the value of attribute vcs_type.
10 11 12 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 10 def vcs_type @vcs_type end |
Class Method Details
.create(options = {}, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 15 def self.create( = {}, &block) vcs_type = if [:vcs_type] VCS_TYPES[[:vcs_type]] || [:vcs_type] else DEFAULT_VCS_TYPE end 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
42 43 44 |
# File 'lib/teamcity_ruby/vcs_root.rb', line 42 def destroy! client.delete("/vcs-roots/id:#{self.teamcity_id}") end |