Class: PPC::API::Sogou::Report

Inherits:
PPC::API::Sogou show all
Defined in:
lib/ppc/api/sogou/report.rb

Constant Summary collapse

Service =
'Report'
Type_map =

需要用到的映射集合

{ 'account' => 1, 'plan'=> 2, 'group'=> 3, 
                      'keyword'=> 5, 'creative'=> 4, 'pair'=> 15, 
'query'=> 3 }
Range_map =
{  'account' => 1, 'plan' => 2, 'group' => 3, 
'creative' => 4, 'keyword' => 5 }
Device_map =
{ 'all' => 0, 'pc' => 1, 'mobile' => 2 }
Unit_map =
{ 'day' => 1, 'week' => 2, 'month' => 3 }

Class Method Summary collapse

Methods inherited from PPC::API::Sogou

debug_print, process, request

Methods included from PPC::API

#make_type, #process, #request, #request_http_body, #request_http_header, #request_uri, #reverse_type

Class Method Details

.get_id(auth, params) ⇒ Object



20
21
22
23
24
25
# File 'lib/ppc/api/sogou/report.rb', line 20

def self.get_id( auth, params )
  request = make_reportrequest( params )
  body =  { reportRequestType: request }
  response = request( auth, Service, 'getReportId' ,body) 
  process( response, 'reportId' ){ |x| x }
end

.get_state(auth, id) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/ppc/api/sogou/report.rb', line 27

def self.get_state( auth, id )
  '''
  input id should be string
  '''
  status = {'-1'=>'Waiting' ,'0'=>'Opearting' ,'1'=>'Finished'}
  body = { reportId:  id }
  response = request( auth, Service, 'getReportState' ,body)
  process( response, 'isGenerated' ){ |x| status[x] }
end

.get_url(auth, id) ⇒ Object



37
38
39
40
41
# File 'lib/ppc/api/sogou/report.rb', line 37

def self.get_url( auth, id )
  body = { reportId:  id }
  response = request( auth, Service, 'getReportPath' ,body)
  process( response, 'reportFilePath' ){ |x| x }       
end