Class: ESP::Stat
- Includes:
- StatTotals
- Defined in:
- lib/esp/resources/stat.rb
Constant Summary
Constants inherited from Resource
Class Method Summary collapse
-
.find ⇒ Object
Not Implemented.
-
.for_report(report_id = nil, options = {}) ⇒ Object
Returns all the stats of all the alerts for a report identified by the report_id parameter.
-
.latest_for_teams ⇒ Object
Returns all the stats for the most recent report of each team accessible by the given API key.
-
.where ⇒ Object
Not Implemented.
Instance Method Summary collapse
-
#custom_signatures ⇒ Object
The stats for each custom signature associated with this stat object.
-
#regions ⇒ Object
The stats for each region associated with this stat object.
-
#report ⇒ Object
The report these stats are for.
-
#services ⇒ Object
The stats for each service associated with this stat object.
-
#signatures ⇒ Object
The stats for each signature associated with this stat object.
Methods included from StatTotals
#destroy, #save, #total, #total_suppressed
Methods inherited from Resource
arrange_options, filters, make_pageable, #serializable_hash
Class Method Details
.find ⇒ Object
Not Implemented. You cannot search for a Stat.
31 32 33 |
# File 'lib/esp/resources/stat.rb', line 31 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 = {}) ⇒ Object
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
report_id
| Required | The ID of the report to retrieve stats for
options
| Optional | A hash of options
Valid Options
include
| The list of associated objects to return on the initial request.
valid Includable Associations
See API documentation for valid arguments
59 60 61 62 63 |
# File 'lib/esp/resources/stat.rb', line 59 def self.for_report(report_id = nil, = {}) # 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: ) end |
.latest_for_teams ⇒ Object
Returns all the stats for the most recent report of each team accessible by the given API key.
66 67 68 69 |
# File 'lib/esp/resources/stat.rb', line 66 def self.latest_for_teams # call find_every directly since find is overriden/not implemented find_every(from: :latest_for_teams) end |
.where ⇒ Object
Not Implemented. You cannot search for a Stat.
26 27 28 |
# File 'lib/esp/resources/stat.rb', line 26 def self.where(*) fail ESP::NotImplementedError end |
Instance Method Details
#custom_signatures ⇒ Object
The stats for each custom signature associated with this stat object.
23 |
# File 'lib/esp/resources/stat.rb', line 23 has_many :custom_signatures, class_name: 'ESP::StatCustomSignature' |
#regions ⇒ Object
The stats for each region associated with this stat object.
11 |
# File 'lib/esp/resources/stat.rb', line 11 has_many :regions, class_name: 'ESP::StatRegion' |
#report ⇒ Object
The report these stats are for.
7 |
# File 'lib/esp/resources/stat.rb', line 7 belongs_to :report, class_name: 'ESP::Report' |
#services ⇒ Object
The stats for each service associated with this stat object.
15 |
# File 'lib/esp/resources/stat.rb', line 15 has_many :services, class_name: 'ESP::StatService' |
#signatures ⇒ Object
The stats for each signature associated with this stat object.
19 |
# File 'lib/esp/resources/stat.rb', line 19 has_many :signatures, class_name: 'ESP::StatSignature' |