Class: Konzertmeister::InfrastructureVersion
- Inherits:
-
Object
- Object
- Konzertmeister::InfrastructureVersion
- Defined in:
- lib/konzertmeister/infrastructure_version.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#commit ⇒ Object
Returns the value of attribute commit.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ InfrastructureVersion
constructor
A new instance of InfrastructureVersion.
- #save ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ InfrastructureVersion
Returns a new instance of InfrastructureVersion.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/konzertmeister/infrastructure_version.rb', line 5 def initialize(data = {}) @data = data data.each do |k,value| if m = k.match(/^infrastructure_version_id$/) key = "id" else key = k end instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
3 4 5 |
# File 'lib/konzertmeister/infrastructure_version.rb', line 3 def branch @branch end |
#commit ⇒ Object
Returns the value of attribute commit.
3 4 5 |
# File 'lib/konzertmeister/infrastructure_version.rb', line 3 def commit @commit end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/konzertmeister/infrastructure_version.rb', line 3 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/konzertmeister/infrastructure_version.rb', line 3 def id @id end |
#tag ⇒ Object
Returns the value of attribute tag.
3 4 5 |
# File 'lib/konzertmeister/infrastructure_version.rb', line 3 def tag @tag end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/konzertmeister/infrastructure_version.rb', line 3 def updated_at @updated_at end |
Instance Method Details
#save ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/konzertmeister/infrastructure_version.rb', line 18 def save if commit params = { 'commit' => commit } elsif tag params = { 'tag' => tag } elsif branch params = { 'branch' => branch } end response = Konzertmeister.session.post('/infrastructure_versions', params) if response response_object = Konzertmeister::InfrastructureVersion.new(response) @id = response_object.id response_object end end |
#to_s ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/konzertmeister/infrastructure_version.rb', line 53 def to_s if @data.has_key?("commit") inf_version_string = "commit:#{@data["commit"]}" elsif @data.has_key?("tag") inf_version_string = "tag:#{@data["tag"]}" else inf_version_string = "branch:#{@data["branch"]}" end "Inf<#{inf_version_string}>" end |