Class: ESP::Stat

Inherits:
Resource show all
Defined in:
lib/esp/resources/stat.rb

'total' rollup methods collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Dirty

#changed_attributes, #original_attributes, #original_attributes=

Methods included from LoadWithOriginalAttributes

#load

Class Method Details

.createvoid

This method returns an undefined value.

Not Implemented. You cannot create a Stat.



# File 'lib/esp/resources/stat.rb', line 46

.findvoid

This method returns an undefined value.

Not Implemented. You cannot search for a Stat.



42
43
44
# 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 = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Stat>

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

Parameters:

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

    Required ID of the report to retrieve stats for.

  • options (Hash) (defaults to: {})

    Optional 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

Returns:

Raises:

  • (ArgumentError)

    if no report_id is supplied.



76
77
78
79
80
# 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_teamsActiveResource::PaginatedCollection<ESP::Stat>

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



85
86
87
88
# 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) ⇒ void

This method returns an undefined value.

Not Implemented. You cannot search for a Stat.



33
34
35
36
37
# 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

Instance Method Details

#custom_signaturesActiveResource::PaginatedCollection<ESP::StatCustomSignature>

The stats for each custom signature associated with this stat object.



28
# File 'lib/esp/resources/stat.rb', line 28

has_many :custom_signatures, class_name: 'ESP::StatCustomSignature'

#destroyvoid

This method returns an undefined value.

Not Implemented. You cannot delete a Stat.



# File 'lib/esp/resources/stat.rb', line 56

#regionsActiveResource::PaginatedCollection<ESP::StatRegion>

The stats for each region associated with this stat object.



13
# File 'lib/esp/resources/stat.rb', line 13

has_many :regions, class_name: 'ESP::StatRegion'

#reportESP::Report

The report these stats are for.

Returns:



8
# File 'lib/esp/resources/stat.rb', line 8

belongs_to :report, class_name: 'ESP::Report'

#savevoid

This method returns an undefined value.

Not Implemented. You cannot create or update a Stat.



# File 'lib/esp/resources/stat.rb', line 51

#servicesActiveResource::PaginatedCollection<ESP::StatService>

The stats for each service associated with this stat object.



18
# File 'lib/esp/resources/stat.rb', line 18

has_many :services, class_name: 'ESP::StatService'

#signaturesActiveResource::PaginatedCollection<ESP::StatSignature>

The stats for each signature associated with this stat object.



23
# File 'lib/esp/resources/stat.rb', line 23

has_many :signatures, class_name: 'ESP::StatSignature'

#totalObject



# File 'lib/esp/resources/stat.rb', line 92

#total_errorObject



# File 'lib/esp/resources/stat.rb', line 100

#total_failObject



# File 'lib/esp/resources/stat.rb', line 96

#total_infoObject



# File 'lib/esp/resources/stat.rb', line 102

#total_new_1dObject



# File 'lib/esp/resources/stat.rb', line 156

#total_new_1d_errorObject



# File 'lib/esp/resources/stat.rb', line 120

#total_new_1d_failObject



# File 'lib/esp/resources/stat.rb', line 116

#total_new_1d_infoObject



# File 'lib/esp/resources/stat.rb', line 122

#total_new_1d_passObject



# File 'lib/esp/resources/stat.rb', line 114

#total_new_1d_warnObject



# File 'lib/esp/resources/stat.rb', line 118

#total_new_1hObject



# File 'lib/esp/resources/stat.rb', line 154

#total_new_1h_errorObject



# File 'lib/esp/resources/stat.rb', line 110

#total_new_1h_failObject



# File 'lib/esp/resources/stat.rb', line 106

#total_new_1h_infoObject



# File 'lib/esp/resources/stat.rb', line 112

#total_new_1h_passObject



# File 'lib/esp/resources/stat.rb', line 104

#total_new_1h_warnObject



# File 'lib/esp/resources/stat.rb', line 108

#total_new_1wObject



# File 'lib/esp/resources/stat.rb', line 158

#total_new_1w_errorObject



# File 'lib/esp/resources/stat.rb', line 128

#total_new_1w_failObject



# File 'lib/esp/resources/stat.rb', line 126

#total_new_1w_infoObject



# File 'lib/esp/resources/stat.rb', line 130

#total_new_1w_passObject



# File 'lib/esp/resources/stat.rb', line 124

#total_new_1w_warnObject



# File 'lib/esp/resources/stat.rb', line 132

#total_oldObject



# File 'lib/esp/resources/stat.rb', line 160

#total_old_errorObject



# File 'lib/esp/resources/stat.rb', line 140

#total_old_failObject



# File 'lib/esp/resources/stat.rb', line 134

#total_old_infoObject



# File 'lib/esp/resources/stat.rb', line 142

#total_old_passObject



# File 'lib/esp/resources/stat.rb', line 136

#total_old_warnObject



# File 'lib/esp/resources/stat.rb', line 138

#total_passObject



# File 'lib/esp/resources/stat.rb', line 94

#total_suppressedObject



# File 'lib/esp/resources/stat.rb', line 144

#total_suppressed_errorObject



# File 'lib/esp/resources/stat.rb', line 152

#total_suppressed_failObject



# File 'lib/esp/resources/stat.rb', line 148

#total_suppressed_passObject



# File 'lib/esp/resources/stat.rb', line 146

#total_suppressed_warnObject



# File 'lib/esp/resources/stat.rb', line 150

#total_warnObject



# File 'lib/esp/resources/stat.rb', line 98