Class: PPC::API::Sogou::Plan
Constant Summary
collapse
- Service =
'CpcPlan'
- PlanType =
{
id: :cpcPlanId,
name: :cpcPlanName,
budget: :budget,
region: :regions,
ip: :excludeIps,
negative: :negativeWords,
exact_negative: :exactNegativeWords,
schedule: :schedule,
budget_offline_time: :budgetOfflineTime,
show_prob: :showProb,
join_union: :joinUnion,
device: :device,
price_ratio: :mobilePriceRate,
pause: :pause,
status: :status,
"id" => :cpc_plan_id,
"name" => :cpc_plan_name,
}
Class Method Summary
collapse
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
.add(auth, plans) ⇒ Object
48
49
50
51
52
53
|
# File 'lib/ppc/api/sogou/plan.rb', line 48
def self.add( auth, plans )
cpcPlanTypes = make_type( plans )
body = { cpcPlanTypes: cpcPlanTypes }
response = request( auth, Service, 'addCpcPlan', body)
process( response, 'cpcPlanTypes' ){ |x| reverse_type(x) }
end
|
.all(auth) ⇒ Object
33
34
35
36
|
# File 'lib/ppc/api/sogou/plan.rb', line 33
def self.all( auth )
response = request( auth, Service, 'getAllCpcPlan' )
process( response, 'cpcPlanTypes' ){ |x| reverse_type(x) }
end
|
.delete(auth, ids) ⇒ Object
62
63
64
65
|
# File 'lib/ppc/api/sogou/plan.rb', line 62
def self.delete(auth, ids )
response = request( auth, Service, 'deleteCpcPlan', {cpcPlanIds: ids} )
process( response, '' ){ |x| x }
end
|
.enable(auth, ids) ⇒ Object
67
68
69
70
|
# File 'lib/ppc/api/sogou/plan.rb', line 67
def self.enable( auth, ids )
plans = ids.map{|id| {id: id, pause: false} }
self.update( auth, plans )
end
|
.get(auth, ids) ⇒ Object
43
44
45
46
|
# File 'lib/ppc/api/sogou/plan.rb', line 43
def self.get( auth, ids )
response = request( auth, Service, 'getCpcPlanByCpcPlanId', {cpcPlanIds: ids} )
process( response, 'cpcPlanTypes' ){ |x| reverse_type(x) }
end
|
.ids(auth) ⇒ Object
38
39
40
41
|
# File 'lib/ppc/api/sogou/plan.rb', line 38
def self.ids( auth )
response = request( auth, Service, 'getAllCpcPlanId' )
process( response, 'cpcPlanIds' ){ |x| x }
end
|
.info(auth, ids) ⇒ Object
28
29
30
31
|
# File 'lib/ppc/api/sogou/plan.rb', line 28
def self.info( auth, ids )
response = request( auth, Service, 'getCpcPlanByCpcPlanId', {cpcPlanIds: ids} )
process( response, 'cpcPlanTypes' ){ |x| reverse_type(x)[0] }
end
|
.pause(auth, ids) ⇒ Object
72
73
74
75
|
# File 'lib/ppc/api/sogou/plan.rb', line 72
def self.pause( auth, ids )
plans = ids.map{|id| {id: id, pause: true} }
self.update( auth, plans )
end
|
.update(auth, plans) ⇒ Object
55
56
57
58
59
60
|
# File 'lib/ppc/api/sogou/plan.rb', line 55
def self.update( auth, plans )
cpcPlanTypes = make_type( plans )
body = { cpcPlanTypes: cpcPlanTypes }
response = request( auth, Service, 'updateCpcPlan', body)
process( response, 'cpcPlanTypes' ){ |x| reverse_type(x) }
end
|