Class: Sistrix::Monitoring::Report
- Inherits:
-
Object
- Object
- Sistrix::Monitoring::Report
- Includes:
- Base
- Defined in:
- lib/sistrix/monitoring/report.rb,
lib/sistrix/monitoring/report/download.rb
Defined Under Namespace
Classes: Download, Recipient, Record
Instance Attribute Summary collapse
-
#credits ⇒ Object
readonly
Returns the value of attribute credits.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#frequency ⇒ Object
readonly
Returns the value of attribute frequency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#recipients ⇒ Object
readonly
Returns the value of attribute recipients.
-
#reports ⇒ Object
readonly
Returns the value of attribute reports.
Instance Method Summary collapse
- #call(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Report
constructor
A new instance of Report.
Methods included from Base
#base_uri, #fetch, #method_name
Constructor Details
#initialize(options = {}) ⇒ Report
Returns a new instance of Report.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sistrix/monitoring/report.rb', line 11 def initialize( = {}) @options = { 'project' => nil, 'report' => nil, 'api_key' => Sistrix.config.api_key, }.merge() if Sistrix.config.proxy RestClient.proxy = Sistrix.config.proxy end end |
Instance Attribute Details
#credits ⇒ Object (readonly)
Returns the value of attribute credits.
9 10 11 |
# File 'lib/sistrix/monitoring/report.rb', line 9 def credits @credits end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
9 10 11 |
# File 'lib/sistrix/monitoring/report.rb', line 9 def format @format end |
#frequency ⇒ Object (readonly)
Returns the value of attribute frequency.
9 10 11 |
# File 'lib/sistrix/monitoring/report.rb', line 9 def frequency @frequency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/sistrix/monitoring/report.rb', line 9 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/sistrix/monitoring/report.rb', line 9 def name @name end |
#recipients ⇒ Object (readonly)
Returns the value of attribute recipients.
9 10 11 |
# File 'lib/sistrix/monitoring/report.rb', line 9 def recipients @recipients end |
#reports ⇒ Object (readonly)
Returns the value of attribute reports.
9 10 11 |
# File 'lib/sistrix/monitoring/report.rb', line 9 def reports @reports end |
Instance Method Details
#call(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sistrix/monitoring/report.rb', line 23 def call( = {}) data = fetch() @credits = data.xpath('/response/credits').first['used'].to_i @name = data.xpath('/response/answer/name').first['value'].to_s.strip @id = data.xpath('/response/answer/id').first['value'].to_s.strip @frequency = data.xpath('/response/answer/frequency').first['value'].to_s.strip @format = data.xpath('/response/answer/format').first['value'].to_s.strip @recipients = [] data.xpath('/response/answer/recipients/recipient').each do |r| @recipients << Recipient.new(r) end @reports = [] data.xpath('/response/answer/archive/report').each do |r| @reports << Record.new(r) end self end |