class PPC::API::Sogou::Plan

Constants

PlanType
Service

Public Class Methods

add( auth, plans ) click to toggle source
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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 ) click to toggle source
# 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