Class: Semaph::Model::Promotion

Inherits:
Object
  • Object
show all
Defined in:
lib/semaph/model/promotion.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pipeline, raw) ⇒ Promotion

Returns a new instance of Promotion.



8
9
10
11
12
13
14
# File 'lib/semaph/model/promotion.rb', line 8

def initialize(pipeline, raw)
  @pipeline = pipeline
  @raw = raw
  @name = raw["name"]
  @status = raw["status"]
  @triggered_at = Time.at(raw["triggered_at"]["seconds"])
end

Instance Attribute Details

#pipelineObject (readonly)

Returns the value of attribute pipeline.



6
7
8
# File 'lib/semaph/model/promotion.rb', line 6

def pipeline
  @pipeline
end

#rawObject (readonly)

Returns the value of attribute raw.



6
7
8
# File 'lib/semaph/model/promotion.rb', line 6

def raw
  @raw
end

Instance Method Details

#descriptionObject



16
17
18
19
20
21
22
# File 'lib/semaph/model/promotion.rb', line 16

def description
  [
    status_icon,
    Semaph::Formatting.time(@triggered_at),
    @name,
  ].join(" ")
end

#status_iconObject



24
25
26
27
28
# File 'lib/semaph/model/promotion.rb', line 24

def status_icon
  return "🟢" if @status == "passed"

  "🔴"
end