Class: PagerTree::Integrations::Alert

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Callbacks
Includes:
ActiveModel::API, ActiveModel::Model
Defined in:
app/models/pager_tree/integrations/alert.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Alert

Returns a new instance of Alert.



28
29
30
31
32
# File 'app/models/pager_tree/integrations/alert.rb', line 28

def initialize(params = {})
  run_callbacks :initialize do
    super(params)
  end
end

Instance Attribute Details

#additional_dataObject

Returns the value of attribute additional_data.



16
17
18
# File 'app/models/pager_tree/integrations/alert.rb', line 16

def additional_data
  @additional_data
end

#attachmentsObject

Returns the value of attribute attachments.



17
18
19
# File 'app/models/pager_tree/integrations/alert.rb', line 17

def attachments
  @attachments
end

#dedup_keysObject

Returns the value of attribute dedup_keys.



15
16
17
# File 'app/models/pager_tree/integrations/alert.rb', line 15

def dedup_keys
  @dedup_keys
end

#descriptionObject

Returns the value of attribute description.



8
9
10
# File 'app/models/pager_tree/integrations/alert.rb', line 8

def description
  @description
end

#incidentObject

Returns the value of attribute incident.



10
11
12
# File 'app/models/pager_tree/integrations/alert.rb', line 10

def incident
  @incident
end

#incident_messageObject

Returns the value of attribute incident_message.



12
13
14
# File 'app/models/pager_tree/integrations/alert.rb', line 12

def incident_message
  @incident_message
end

#incident_severityObject

Returns the value of attribute incident_severity.



11
12
13
# File 'app/models/pager_tree/integrations/alert.rb', line 11

def incident_severity
  @incident_severity
end

#metaObject

Returns the value of attribute meta.



13
14
15
# File 'app/models/pager_tree/integrations/alert.rb', line 13

def meta
  @meta
end

#tagsObject

Returns the value of attribute tags.



18
19
20
# File 'app/models/pager_tree/integrations/alert.rb', line 18

def tags
  @tags
end

#thirdparty_idObject

Returns the value of attribute thirdparty_id.



14
15
16
# File 'app/models/pager_tree/integrations/alert.rb', line 14

def thirdparty_id
  @thirdparty_id
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'app/models/pager_tree/integrations/alert.rb', line 7

def title
  @title
end

#urgencyObject

Returns the value of attribute urgency.



9
10
11
# File 'app/models/pager_tree/integrations/alert.rb', line 9

def urgency
  @urgency
end

Instance Method Details

#incident?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'app/models/pager_tree/integrations/alert.rb', line 49

def incident?
  ActiveModel::Type::Boolean.new.cast(self.incident)
end

#push_additional_data(additional_datum) ⇒ Object



53
54
55
56
57
58
59
60
# File 'app/models/pager_tree/integrations/alert.rb', line 53

def push_additional_data(additional_datum)
  if additional_datum.valid?
    self.additional_data.push(additional_data.to_json)
    true
  else
    false
  end
end