class ExtremeFeedbackDevice::Job

Constants

COLOR_ABORTED
COLOR_BLUE
COLOR_DISABLED
COLOR_GREY
COLOR_NOTBUILT
COLOR_RED
COLOR_YELLOW

Public Class Methods

from_json_object(attributes) click to toggle source
# File lib/extreme_feedback_device/job.rb, line 13
def from_json_object(attributes)
  health_report = attributes['healthReport']
  attributes['score'] = health_report.first.nil? ? nil : health_report.first['score']
  new(attributes['name'], attributes['color'], attributes['score'])
end

Public Instance Methods

aborted?() click to toggle source
# File lib/extreme_feedback_device/job.rb, line 44
def aborted?
  color && color =~ COLOR_ABORTED
end
disabled?() click to toggle source
# File lib/extreme_feedback_device/job.rb, line 40
def disabled?
  color && color =~ COLOR_DISABLED
end
fail?() click to toggle source
# File lib/extreme_feedback_device/job.rb, line 24
def fail?
  color && color =~ COLOR_RED
end
inactive?() click to toggle source
# File lib/extreme_feedback_device/job.rb, line 36
def inactive?
  color && color =~ COLOR_GREY
end
not_built?() click to toggle source
# File lib/extreme_feedback_device/job.rb, line 48
def not_built?
  color && color =~ COLOR_NOTBUILT
end
success?() click to toggle source
# File lib/extreme_feedback_device/job.rb, line 32
def success?
  color && color =~ COLOR_BLUE
end
to_hash() click to toggle source
# File lib/extreme_feedback_device/job.rb, line 20
def to_hash
  {name: name, color: color, health: health}
end
unstable?() click to toggle source
# File lib/extreme_feedback_device/job.rb, line 28
def unstable?
  color && color =~ COLOR_YELLOW
end