Class: Velocify::Report
- Inherits:
-
Object
- Object
- Velocify::Report
- Includes:
- Model
- Defined in:
- lib/velocify/report.rb
Class Method Summary collapse
- .find_all(destruct: false, return_array: false) ⇒ Object
-
.find_results(report_id:, template_values: [], destruct: false, return_array: false) ⇒ Object
Retrieves report results with or without a filter.
Methods included from Model
Class Method Details
.find_all(destruct: false, return_array: false) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/velocify/report.rb', line 8 def find_all destruct: false, return_array: false verify_credentials! request do destruct_response? destruct operation :get_reports authenticate? true transform do |resp| if return_array arrayify resp[:reports][:report] else resp end end end end |
.find_results(report_id:, template_values: [], destruct: false, return_array: false) ⇒ Object
Note:
The template_values option must contain an array of filter items. Filter items are objects that must respond to #field_title and #value.
Retrieves report results with or without a filter
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/velocify/report.rb', line 39 def find_results report_id:, template_values: [], destruct: false, return_array: false verify_credentials! request do destruct_response? destruct operation :get_report_results authenticate? true xml GetReportResultsPayload.new(report_id, template_values) transform do |resp| if return_array if template_values.empty? arrayify resp[:report_results][:result] else arrayify resp[:report_results] end else resp end end end end |