Class: ConnectWiseRest::Report
- Defined in:
- lib/connect_wise_rest/report.rb
Constant Summary
Constants inherited from Client
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Client
Instance Method Summary collapse
- #fetch(query = {}) ⇒ Object
- #format! ⇒ Object
-
#initialize(name, options = {}) ⇒ Report
constructor
A new instance of Report.
Methods inherited from Client
#data, #next_page, #next_page?, #previous_page, #previous_page?, #request_options, #response, #url
Constructor Details
#initialize(name, options = {}) ⇒ Report
Returns a new instance of Report.
6 7 8 9 10 |
# File 'lib/connect_wise_rest/report.rb', line 6 def initialize(name, = {}) @name = name @resource = '/system/reports/' + name = DEFAULT_OPTIONS.merge() end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/connect_wise_rest/report.rb', line 4 def name @name end |
Instance Method Details
#fetch(query = {}) ⇒ Object
12 13 14 15 |
# File 'lib/connect_wise_rest/report.rb', line 12 def fetch(query = {}) super format! end |
#format! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/connect_wise_rest/report.rb', line 17 def format! if @data && @data['row_values'].is_a?(Array) rows = [] @data['row_values'].each do |values| row = {} values.each_with_index do |value, index| key = @data['column_definitions'][index].keys[0] row[key] = value end rows << row end @data = rows else @data = [] end end |