Class: ESP::Report
- Defined in:
- lib/esp/resources/report.rb,
lib/esp/resources/reports/export/integration.rb
Defined Under Namespace
Modules: Export
Constant Summary
Constants inherited from Resource
Class Method Summary collapse
-
.create(arguments = {}) ⇒ Object
Enqueue a report to be run for the given team.
Instance Method Summary collapse
-
#alerts(arguments = {}) ⇒ Object
Returns a paginated collection of alerts for the report.
-
#destroy ⇒ Object
Not Implemented.
-
#external_account ⇒ Object
The external_account the report belongs to.
-
#organization ⇒ Object
The organization the report belongs to.
-
#stat ⇒ Object
Returns the stats for this report.
-
#sub_organization ⇒ Object
The sub_organization the report belongs to.
-
#team ⇒ Object
The team the report belongs to.
-
#update ⇒ Object
Not Implemented.
Methods inherited from Resource
arrange_options, filters, find, make_pageable, #serializable_hash, where
Class Method Details
.create(arguments = {}) ⇒ Object
Enqueue a report to be run for the given team. Returns a Report object with a status of ‘queued’ and an id
Attribute
See API documentation for valid arguments
Periodically check the API
ESP::Report.find(<id>)
until status is ‘complete’.
If not successful, returns a Report object with the errors object populated.
44 45 46 47 48 49 |
# File 'lib/esp/resources/report.rb', line 44 def self.create(arguments = {}) fail ArgumentError, "You must supply a team id." unless arguments.with_indifferent_access[:team_id].present? super rescue ActiveResource::ResourceNotFound => error new(arguments).tap { |r| r.load_remote_errors(error, true) } end |
Instance Method Details
#alerts(arguments = {}) ⇒ Object
Returns a paginated collection of alerts for the report
Parameters
arguments
| Not Required | An optional hash of search criteria to filter the returned collection
Valid Arguments
See API documentation for valid arguments
Example
report = ESP::Report.find(345)
alerts = report.alerts(status_eq: 'fail', signature_risk_level_in: ['High'])
65 66 67 |
# File 'lib/esp/resources/report.rb', line 65 def alerts(arguments = {}) ESP::Alert.where(arguments.merge(report_id: id)) end |
#destroy ⇒ Object
Not Implemented. You cannot destroy a Report.
29 30 31 |
# File 'lib/esp/resources/report.rb', line 29 def destroy fail ESP::NotImplementedError end |
#external_account ⇒ Object
The external_account the report belongs to.
21 |
# File 'lib/esp/resources/report.rb', line 21 belongs_to :external_account, class_name: 'ESP::ExternalAccount' |
#organization ⇒ Object
The organization the report belongs to.
9 |
# File 'lib/esp/resources/report.rb', line 9 belongs_to :organization, class_name: 'ESP::Organization' |
#stat ⇒ Object
Returns the stats for this report
70 71 72 |
# File 'lib/esp/resources/report.rb', line 70 def stat ESP::Stat.for_report(id) end |
#sub_organization ⇒ Object
The sub_organization the report belongs to.
13 |
# File 'lib/esp/resources/report.rb', line 13 belongs_to :sub_organization, class_name: 'ESP::SubOrganization' |
#team ⇒ Object
The team the report belongs to.
17 |
# File 'lib/esp/resources/report.rb', line 17 belongs_to :team, class_name: 'ESP::Team' |
#update ⇒ Object
Not Implemented. You cannot update a Report.
24 25 26 |
# File 'lib/esp/resources/report.rb', line 24 def update fail ESP::NotImplementedError end |