Class: PPC::API::Sm::Report

Inherits:
PPC::API::Sm show all
Defined in:
lib/ppc/api/sm/report.rb

Constant Summary collapse

Service =
'Report'
Type_map =

需要用到的映射集合

{ 'account' => 2, 'plan'=> 10, 'group'=> 11,
                      'keyword'=> 14, 'creative'=> 12,
'region'=> 3, 'query'=>6, 'trail' => 21, "tel" => 22,
"app" => 23, "none" => 24}
Level_map =
{  'account' => 2, 'plan' => 3, 'group' => 5,
                        'creative'=> 7, 'keywordid' => 11, 'trail' => 21, "tel" => 22,
"app" => 23, 'query_creative' => 12}
Device_map =
{ 'all' => 0, 'pc' => 1, 'mobile' => 2 }
Unit_map =
{ 'day' => 5, 'month' => 3, 'range' => 8 }

Class Method Summary collapse

Methods inherited from PPC::API::Sm

process, request_uri

Methods included from PPC::API

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

Class Method Details

.get_file(auth, id) ⇒ Object



41
42
43
# File 'lib/ppc/api/sm/report.rb', line 41

def self.get_file( auth,  id  )
  request( auth, 'file' , 'download' , {fileId: id} )
end

.get_fileId(auth, id) ⇒ Object



36
37
38
39
# File 'lib/ppc/api/sm/report.rb', line 36

def self.get_fileId( auth,  id  )
  response = request( auth, 'task' , 'getTaskState' , {taskId: id} )
  process( response, 'fileId' ){ |x| x }
end

.get_id(auth, params) ⇒ Object

API wraping function #



25
26
27
28
29
# File 'lib/ppc/api/sm/report.rb', line 25

def self.get_id( auth, params  )
  body = make_reportrequest( params )
  response = request( auth, 'report' , 'getReport' ,body)
  process( response, 'taskId' ){ |x| x }
end

.get_state(auth, id) ⇒ Object



31
32
33
34
# File 'lib/ppc/api/sm/report.rb', line 31

def self.get_state( auth, id )
  response = request( auth, 'task' , 'getTaskState' , {taskId: id} )
  process( response, 'status' ){ |x| x }
end