Method: ESP::Tag.for_alert

Defined in:
lib/esp/resources/tag.rb

.for_alert(alert_id = nil) ⇒ ActiveResource::PaginatedCollection<ESP::Tag>

Returns a paginated collection of tags for the given alert_id Convenience method to use instead of find since an alert_id is required to return tags.

Examples:

alerts = ESP::Tag.for_alert(1194)

Parameters:

  • alert_id (Integer, Numeric) (defaults to: nil)

    Required ID of the alert to list tags for.

Returns:

Raises:

  • (ArgumentError)

    if no alert_id is supplied.



32
33
34
35
36
# File 'lib/esp/resources/tag.rb', line 32

def self.for_alert(alert_id = nil)
  fail ArgumentError, "You must supply an alert id." unless alert_id.present?
  from = "#{prefix}alerts/#{alert_id}/tags.json"
  find(:all, from: from)
end