Class: Linkshare::AdvancedReports
- Inherits:
-
Object
- Object
- Linkshare::AdvancedReports
- Defined in:
- lib/linkshare/advanced_reports.rb
Instance Method Summary collapse
- #fetchReports(reportid, bdate, edate, nid = '', mid = '') ⇒ Object
- #getCSV ⇒ Object
- #getReports ⇒ Object
- #initilize ⇒ Object
Instance Method Details
#fetchReports(reportid, bdate, edate, nid = '', mid = '') ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/linkshare/advanced_reports.rb', line 16 def fetchReports(reportid, bdate, edate, nid = '', mid = '') token = Linkshare.security_token params = { 'token' => token, 'reportid' => reportid, 'bdate' => bdate, 'edate' => edate } unless nid == '' params.merge({ 'nid' => nid}) end unless mid == '' params.merge({ 'mid' => mid}) end @reportsRows = [] @reportsCSV = Linkshare::Request.get(Linkshare::API_URIS[:advanced_reports], :params => params).body reportsrows = @reportsCSV.split(/\n/) @cols = reportsrows[0].split(/,/) reportsrows.shift reportsrows.each { |row| r = {} row.split(/,/).each_with_index { | o, i| r[@cols[i]]=o } @reportsRows.push(r) } @reportsRows end |
#getCSV ⇒ Object
8 9 10 |
# File 'lib/linkshare/advanced_reports.rb', line 8 def getCSV @reportsCSV end |
#getReports ⇒ Object
12 13 14 |
# File 'lib/linkshare/advanced_reports.rb', line 12 def getReports @reportsRows end |
#initilize ⇒ Object
3 4 5 6 7 |
# File 'lib/linkshare/advanced_reports.rb', line 3 def initilize() @reportsCSV = '' @reportsRows = [] @cols = [] end |