class Spage::Incident

Page resource in statuspage.io

Attributes

auto_transition_deliver_notifications_at_end[RW]
auto_transition_deliver_notifications_at_start[RW]
auto_transition_to_maintenance_state[RW]
auto_transition_to_operational_state[RW]
auto_tweet_at_beginning[RW]
auto_tweet_on_completion[RW]
auto_tweet_on_creation[RW]
auto_tweet_one_hour_before[RW]
backfill_date[RW]
backfilled[RW]
body[RW]
component_ids[RW]
components[RW]
created_at[R]

rubocop: disable Layout/LineLength

deliver_notifications[RW]
id[R]

rubocop: disable Layout/LineLength

impact[R]

rubocop: disable Layout/LineLength

impact_override[RW]
incident_updates[R]

rubocop: disable Layout/LineLength

metadata[RW]
monitoring_at[R]

rubocop: disable Layout/LineLength

name[RW]
page_id[R]

rubocop: disable Layout/LineLength

postmortem_body[R]

rubocop: disable Layout/LineLength

postmortem_body_last_updated_at[R]

rubocop: disable Layout/LineLength

postmortem_ignored[R]

rubocop: disable Layout/LineLength

postmortem_notified_subscribers[R]

rubocop: disable Layout/LineLength

postmortem_notified_twitter[R]

rubocop: disable Layout/LineLength

postmortem_published_at[R]

rubocop: disable Layout/LineLength

resolved_at[R]

rubocop: disable Layout/LineLength

scheduled_auto_completed[RW]
scheduled_auto_in_progress[RW]
scheduled_auto_transition[RW]
scheduled_for[RW]
scheduled_remind_prior[RW]
scheduled_until[RW]
status[RW]
updated_at[R]

rubocop: disable Layout/LineLength

Public Class Methods

new(attrs) click to toggle source

rubocop: disable Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength

# File lib/spage/resources/incident.rb, line 8
def initialize(attrs)
  @id                              = attrs['id']
  @components                      = attrs['components'] # Array of Component
  @impact                          = attrs['impact']
  @impact_override                 = attrs['impact_override']
  @incident_updates                = attrs['incident_updates'] # Array of IncidentUpdate
  @metadata                        = attrs['metadata'] # Hash of values
  @name                            = attrs['name']
  @page_id                         = attrs['page_id']
  @postmortem_body                 = attrs['postmortem_body']
  @postmortem_body_last_updated_at = attrs['postmortem_body_last_updated_at']
  @postmortem_ignored              = attrs['postmortem_ignored']
  @postmortem_notified_subscribers = attrs['postmortem_notified_subscribers']
  @postmortem_notified_twitter     = attrs['postmortem_notified_twitter']
  @postmortem_published_at         = attrs['postmortem_published_at']
  @scheduled_auto_completed        = attrs['scheduled_auto_completed']
  @scheduled_auto_in_progress      = attrs['scheduled_auto_in_progress']
  @scheduled_for                   = attrs['scheduled_for']
  @scheduled_remind_prior          = attrs['scheduled_remind_prior']
  @scheduled_reminded_at           = date_parse(attrs['scheduled_reminded_at'])
  @scheduled_until                 = attrs['scheduled_until']
  @shortlink                       = attrs['shortlink']
  @status                          = attrs['status']
  @monitoring_at                   = date_parse(attrs['monitoring_at'])
  @resolved_at                     = date_parse(attrs['resolved_at'])
  @created_at                      = date_parse(attrs['created_at'])
  @updated_at                      = date_parse(attrs['updated_at'])

  # vars only used to update/create incident
  @deliver_notifications                          = attrs['deliver_notifications']
  @auto_transition_deliver_notifications_at_end   = attrs['auto_transition_deliver_notifications_at_end']
  @auto_transition_deliver_notifications_at_start = attrs['auto_transition_deliver_notifications_at_start']
  @auto_transition_to_maintenance_state           = attrs['auto_transition_to_maintenance_state']
  @auto_transition_to_operational_state           = attrs['auto_transition_to_operational_state']
  @auto_tweet_at_beginning                        = attrs['auto_tweet_at_beginning']
  @auto_tweet_on_completion                       = attrs['auto_tweet_on_completion']
  @auto_tweet_on_creation                         = attrs['auto_tweet_on_creation']
  @auto_tweet_one_hour_before                     = attrs['auto_tweet_one_hour_before']
  @backfill_date                                  = attrs['backfill_date']
  @backfilled                                     = attrs['backfilled']
  @body                                           = attrs['body']
  @component_ids                                  = attrs['component_ids']
  @scheduled_auto_transition                      = attrs['scheduled_auto_transition']
end

Private Instance Methods

date_parse(str) click to toggle source

rubocop: enable Layout/LineLength

# File lib/spage/resources/incident.rb, line 62
def date_parse(str)
  return str if str.nil?
  return str if str.is_a?(DateTime)

  DateTime.parse(str)
end