Class: PPC::API::Shenma::Report

Inherits:
PPC::API::Shenma show all
Defined in:
lib/ppc/api/shenma/report.rb

Constant Summary collapse

Service =
'Report'
Type_map =

需要用到的映射集合

{ 'account' =>2, 'plan'=> 10, 'group'=> 11, 
                      'keyword'=> 14, 'creative'=> 12, 'region'=> 3, 
'query'=> 6, 'phone' => 22, 'app' => 23 }
Level_map =
{  'account' => 2, 'plan' => 3, 'group' => 5, 
                        'creative' => 7, 'keyword' => 11, 'phone' => 22,
'app' => 23, 'pair' => 12 }
Unit_map =
{ 'day' => 5, 'month' => 3, 'default' => 8 }

Class Method Summary collapse

Class Method Details

.download(auth, id, debug = false) ⇒ Object

todo : rewrite method



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

def self.download( auth, id, debug = false )
  body = { fileId:  id }
  response = request( auth, '/file/download' ,body)
  process( response, 'reportPath', debug ){ |x| x }       
end

.get_id(auth, params, debug = false) ⇒ Object



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

def self.get_id( auth, params, debug = false )
  request = make_reportrequest( params )
  body =  { ReportRequestType: request }
  response = request( auth, '/report/getReport' ,body) 
  process( response, 'reportId', debug ){ |x| x }
end

.get_state(auth, id, debug = false) ⇒ Object



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

def self.get_state( auth, id, debug = false)
  '''
  input id should be string
  '''
  status = {1=>'Waiting' ,2=>'Opearting' ,3=>'Finished'}
  body = { taskId:  id }
  response = request( auth, '/task/getTaskState' ,body)
  process( response, 'isGenerated', debug ){ |x| status[x] }
end