Class: HasOffers::Report

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

Constant Summary collapse

Target =
'Report'

Class Method Summary collapse

Methods inherited from Base

api_mode, api_mode=, base_uri, base_uri=, get_request, initialize_credentials, live?, post_request, requires!, test?

Class Method Details

.get_conversions(params) ⇒ Object

Jon Phenow @ 06/13/12 Switched this to use POST because of some weird issues with sending from behind a proxy


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/hasoffers/report.rb', line 28

def get_conversions(params)
  response = post_request(Target, 'getConversions', params)
  if response.success?
    # strip out the 'Stat' keys which is just extra clutter
    data = response.data.map do |stat|
      stat["Stat"]
    end
    response.set_data data
  end
  response        
end

.get_stats(params) ⇒ Object

Jon Phenow @ 06/13/12 Switched this to use POST because of some weird issues with sending from behind a proxy


12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hasoffers/report.rb', line 12

def get_stats(params)
  requires!(params, %w[fields])
  response = post_request(Target, 'getStats', params)
  if response.success?
    # strip out the 'Stat' keys which is just extra clutter
    data = response.data.map do |stat|
      stat["Stat"]
    end
    response.set_data data
  end
  response
end