Class: SidekiqVigil::Alert::Event
- Inherits:
-
Object
- Object
- SidekiqVigil::Alert::Event
- Defined in:
- lib/sidekiq_vigil/alert/event.rb
Instance Attribute Summary collapse
-
#history ⇒ Object
readonly
Returns the value of attribute history.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#transition ⇒ Object
readonly
Returns the value of attribute transition.
Instance Method Summary collapse
- #alert_id ⇒ Object
-
#initialize(result:, transition:, state:, history:, timestamp:) ⇒ Event
constructor
A new instance of Event.
- #severity ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(result:, transition:, state:, history:, timestamp:) ⇒ Event
Returns a new instance of Event.
8 9 10 11 12 13 14 |
# File 'lib/sidekiq_vigil/alert/event.rb', line 8 def initialize(result:, transition:, state:, history:, timestamp:) @result = result @transition = transition.to_sym @state = state @history = history @timestamp = end |
Instance Attribute Details
#history ⇒ Object (readonly)
Returns the value of attribute history.
6 7 8 |
# File 'lib/sidekiq_vigil/alert/event.rb', line 6 def history @history end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/sidekiq_vigil/alert/event.rb', line 6 def result @result end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
6 7 8 |
# File 'lib/sidekiq_vigil/alert/event.rb', line 6 def state @state end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/sidekiq_vigil/alert/event.rb', line 6 def @timestamp end |
#transition ⇒ Object (readonly)
Returns the value of attribute transition.
6 7 8 |
# File 'lib/sidekiq_vigil/alert/event.rb', line 6 def transition @transition end |
Instance Method Details
#alert_id ⇒ Object
20 21 22 |
# File 'lib/sidekiq_vigil/alert/event.rb', line 20 def alert_id result.alert_id end |
#severity ⇒ Object
16 17 18 |
# File 'lib/sidekiq_vigil/alert/event.rb', line 16 def severity result.severity end |
#to_h ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sidekiq_vigil/alert/event.rb', line 24 def to_h { schema_version: "1.0", event: transition, alert_id:, timestamp: .utc.iso8601, alert: result.to_h, state: state.to_h, history: } end |