Class: Concourse::Job
- Inherits:
-
Object
- Object
- Concourse::Job
- Defined in:
- lib/concourse/job.rb
Overview
A job belongs to a pipeline A job has many builds A job has one finished_build A job has one next_build
Instance Attribute Summary collapse
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
Instance Method Summary collapse
- #builds ⇒ Object
- #finished_build ⇒ Object
-
#initialize(pipeline, info) ⇒ Job
constructor
A new instance of Job.
- #name ⇒ Object
- #next_build ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(pipeline, info) ⇒ Job
Returns a new instance of Job.
15 16 17 18 |
# File 'lib/concourse/job.rb', line 15 def initialize(pipeline, info) @pipeline = pipeline @info = info end |
Instance Attribute Details
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
13 14 15 |
# File 'lib/concourse/job.rb', line 13 def pipeline @pipeline end |
Instance Method Details
#builds ⇒ Object
28 29 30 31 32 |
# File 'lib/concourse/job.rb', line 28 def builds JSON.parse(@pipeline.get("/#{CGI.escape(name)}/builds")).map do |build| Build.new(self, build) end end |
#finished_build ⇒ Object
34 35 36 |
# File 'lib/concourse/job.rb', line 34 def finished_build Build.new(self, @info['finished_build']) if @info['finished_build'] end |
#name ⇒ Object
20 21 22 |
# File 'lib/concourse/job.rb', line 20 def name @info['name'] end |
#next_build ⇒ Object
38 39 40 41 |
# File 'lib/concourse/job.rb', line 38 def next_build next_build = @info['next_build'] Build.new(self, next_build) if next_build end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/concourse/job.rb', line 24 def to_s "#{self.class.name.split('::').last.downcase} #{name} of #{pipeline}" end |