Class: Yieldmanager::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/yieldmanager/report.rb

Overview

This is the data object for all reportware requests.

The #pull method is typically called by Yieldmanager::Client#pull_report.

Data is returned as an array that can be accessed either by index or by column name:

report.headers # => ['advertiser_name','seller_imps']
report.data[0][0] # => "Bob's Ads"
report.data[0].by_name('advertiser_name') # => "Bob's Ads"
report.data[0].by_name(:advertiser_name) # => "Bob's Ads"

Column order is stored in the headers array.

Defined Under Namespace

Classes: ReportRow

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReport

Returns a new instance of Report.



18
19
20
21
# File 'lib/yieldmanager/report.rb', line 18

def initialize
  self.headers = []
  self.data = []
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



16
17
18
# File 'lib/yieldmanager/report.rb', line 16

def data
  @data
end

#headersObject

Returns the value of attribute headers.



16
17
18
# File 'lib/yieldmanager/report.rb', line 16

def headers
  @headers
end

Instance Method Details

#pull(token, report, xml) ⇒ Object



23
24
25
26
27
# File 'lib/yieldmanager/report.rb', line 23

def pull token, report, xml
  report_token = request_report_token token, report, xml
  report_url = retrieve_report_url token, report, report_token
  retrieve_data report_url
end