class ESP::Stat

Public Class Methods

find(*) click to toggle source

Not Implemented. You cannot search for a Stat.

@return [void]

# File lib/esp/resources/stat.rb, line 42
def self.find(*)
  fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled.  Use either the ESP::Stat.for_report or ESP::Stat.latest_for_teams method.'
end
for_report(report_id = nil, options = {}) click to toggle source

Returns all the stats of all the alerts for a report identified by the report_id parameter. Said report contains all statistics for this alert triggered from signatures contained in all regions for the selected hour.

Parameters

@param report_id [Integer, Numeric] Required ID of the report to retrieve stats for. @param options [Hash] Optional hash of options.

===== Valid Options

+include+ | The list of associated objects to return on the initial request.

===== valid Includable Associations

See {API documentation}[http://api-docs.evident.io?ruby#alert-attributes] for valid arguments

@return [ActiveResource::PaginatedCollection<ESP::Stat>] @raise [ArgumentError] if no report_id is supplied.

# File lib/esp/resources/stat.rb, line 76
def self.for_report(report_id = nil, options = {}) # rubocop:disable Style/OptionHash
  fail ArgumentError, "You must supply a report id." unless report_id.present?
  # call find_one directly since find is overriden/not implemented
  find_one(from: "#{prefix}reports/#{report_id}/stats.json", params: options)
end
latest_for_teams() click to toggle source

Returns all the stats for the most recent report of each team accessible by the given API key.

@return [ActiveResource::PaginatedCollection<ESP::Stat>]

# File lib/esp/resources/stat.rb, line 85
def self.latest_for_teams
  # call find_every directly since find is overriden/not implemented
  where(from: "#{prefix}stats/latest_for_teams")
end
where(attrs) click to toggle source

Not Implemented. You cannot search for a Stat.

@return [void]

Calls superclass method ESP::Resource::where
# File lib/esp/resources/stat.rb, line 33
def self.where(attrs)
  # when calling `latest_for_teams.next_page` it will come into here
  return super if attrs[:from].to_s.include?('latest_for_teams')
  fail ESP::NotImplementedError
end