Class: GoApiClient::Pipeline
- Inherits:
-
Object
- Object
- GoApiClient::Pipeline
- Includes:
- Helpers::SimpleAttributesSupport
- Defined in:
- lib/go_api_client/pipeline.rb
Instance Attribute Summary collapse
-
#authors ⇒ Object
Returns the value of attribute authors.
-
#branch_name ⇒ Object
Returns the value of attribute branch_name.
-
#commits ⇒ Object
Returns the value of attribute commits.
-
#counter ⇒ Object
Returns the value of attribute counter.
-
#http_fetcher ⇒ Object
Returns the value of attribute http_fetcher.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#label ⇒ Object
Returns the value of attribute label.
-
#name ⇒ Object
Returns the value of attribute name.
-
#schedule_time ⇒ Object
Returns the value of attribute schedule_time.
-
#stages ⇒ Object
Returns the value of attribute stages.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(root, attributes = {}) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #parse! ⇒ Object
Constructor Details
Instance Attribute Details
#authors ⇒ Object
Returns the value of attribute authors.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def @authors end |
#branch_name ⇒ Object
Returns the value of attribute branch_name.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def branch_name @branch_name end |
#commits ⇒ Object
Returns the value of attribute commits.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def commits @commits end |
#counter ⇒ Object
Returns the value of attribute counter.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def counter @counter end |
#http_fetcher ⇒ Object
Returns the value of attribute http_fetcher.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def http_fetcher @http_fetcher end |
#identifier ⇒ Object
Returns the value of attribute identifier.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def identifier @identifier end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def label @label end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def name @name end |
#schedule_time ⇒ Object
Returns the value of attribute schedule_time.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def schedule_time @schedule_time end |
#stages ⇒ Object
Returns the value of attribute stages.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def stages @stages end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/go_api_client/pipeline.rb', line 3 def url @url end |
Class Method Details
.from(url, attributes = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/go_api_client/pipeline.rb', line 13 def from(url, attributes = {}) attributes[:http_fetcher] ||= GoApiClient::HttpFetcher.new doc = Nokogiri::XML(attributes[:http_fetcher].get!(url)) self.new(doc.root, attributes).parse! end |
Instance Method Details
#parse! ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/go_api_client/pipeline.rb', line 24 def parse! self.name = @root.attributes["name"].value self.label = @root.attributes["label"].value self.counter = @root.attributes["counter"].value.to_i self.url = href_from(@root.xpath("./link[@rel='self']")) self.identifier = @root.xpath("./id").first.content self.schedule_time = Time.parse(@root.xpath('./scheduleTime').first.content).utc self.commits = @root.xpath('./materials/material[@type = "GitMaterial"]/modifications/changeset').collect do |changeset| Commit.new(changeset).parse! end @root = nil self end |