Class: PPC::API::Baidu::Bulk

Inherits:
PPC::API::Baidu show all
Defined in:
lib/ppc/api/baidu/bulk.rb

Constant Summary collapse

Service =
'BulkJob'

Class Method Summary collapse

Methods inherited from PPC::API::Baidu

make_type, process, request, reverse_type

Class Method Details

.get_all_object(auth, params = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ppc/api/baidu/bulk.rb', line 7

def self.get_all_object( auth,params = {})
  
  plan_ids = params[:plan_ids]

  unless plan_ids.nil?
    plan_ids = plan_ids.class == Array ? plan_ids : [plan_ids]
  end

  options = {
    campaignIds:              plan_ids              || []      ,
    includeQuality:           params[:quality]      || true    ,
    includeTemp:              params[:temp]         || false   ,
    format:                   params[:format]       || 1       ,
    newCreativeFiles:         params[:adcopy]       || 0       ,
    includeTempNewCreatives:  params[:temp_adcopy]  || 0       ,
    includePhraseType:        params[:phrase]       || 0       ,
    extended:                 params[:extended]     || 0
  }
  response = request( auth, Service, 'getAllObjects',options )
  response[:get_all_objects_response][:file_id]
end

.path(auth, id) ⇒ Object



34
35
36
# File 'lib/ppc/api/baidu/bulk.rb', line 34

def self.path( auth, id)
  request( auth, Service, 'getFilePath',{fileId:id})[:get_file_path_response][:file_paths]
end

.state(auth, id) ⇒ Object



29
30
31
32
# File 'lib/ppc/api/baidu/bulk.rb', line 29

def self.state( auth, id)
  raise "empty id" if id.nil? or id.empty?
  request(auth, Service, 'getFileState',{fileId:id})[:get_file_state_response][:is_generated]
end