Class: CruiseFace::Model::Pipeline::History::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/cruise_face/pipeline.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stage, resource) ⇒ Job

Returns a new instance of Job.



97
98
99
100
# File 'lib/cruise_face/pipeline.rb', line 97

def initialize(stage, resource)
  @stage = stage
  @resource = resource
end

Instance Attribute Details

#stageObject (readonly)

Returns the value of attribute stage.



95
96
97
# File 'lib/cruise_face/pipeline.rb', line 95

def stage
  @stage
end

Instance Method Details

#completed?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/cruise_face/pipeline.rb', line 114

def completed?
  @resource.is_completed == 'true'
end

#current_build_durationObject



126
127
128
# File 'lib/cruise_face/pipeline.rb', line 126

def current_build_duration
  @resource.current_build_duration
end

#failed?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/cruise_face/pipeline.rb', line 110

def failed?
  [FAILED_STATUS, CANCELED_STATUS].include? @resource.result
end

#incompleted?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/cruise_face/pipeline.rb', line 118

def incompleted?
  !completed?
end

#last_build_durationObject



122
123
124
# File 'lib/cruise_face/pipeline.rb', line 122

def last_build_duration
  @resource.last_build_duration
end

#nameObject



102
103
104
# File 'lib/cruise_face/pipeline.rb', line 102

def name
  @resource.name
end

#passed?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/cruise_face/pipeline.rb', line 106

def passed?
  @resource.result == PASSED_STATUS
end

#to_sObject



130
131
132
# File 'lib/cruise_face/pipeline.rb', line 130

def to_s
  "Job #{name}[#{@stage}] #{completed? ? 'completed' : ''} #{failed? ? "failed" : (passed? ? 'passed' : 'unknown')}"
end