class PPC::API::Sogou::Keyword

Constants

KeywordType
Match_type
Service

Public Class Methods

add( auth, keywords ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 63
def self.add( auth, keywords )
  body = { cpcTypes: make_type( keywords )  }
  response = request( auth, Service, "addCpc", body )
  process(response, 'cpcTypes'){|x| reverse_type(x)  }
end
all( auth, ids ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 48
def self.all( auth, ids )
  response = request( auth, Service, "getCpcByCpcGrpId", {cpcGrpIds: ids} )
  process(response, 'cpcGrpCpcs'){|x| ids.count == 1 ? reverse_type(x[:cpc_types]) : x.map{|y| reverse_type(y[:cpc_types])}.flatten }
end
delete( auth, ids ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 75
def self.delete( auth, ids )
  response = request( auth, Service, 'deleteCpc', {cpcIds: ids} )
  process(response, ''){|x| x }
end
enable( auth, ids ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 80
def self.enable( auth, ids )
  keywords = ids.map{|id| {id: id, pause: false} }
  self.update( auth, keywords )
end
get( auth, ids ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 58
def self.get( auth, ids )
  response = request( auth, Service, 'getCpcByCpcId', {cpcIds: ids} )
  process(response, 'cpcTypes'){|x| reverse_type( x ) }
end
ids( auth, ids ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 53
def self.ids( auth, ids )
  response = request( auth, Service, "getCpcIdByCpcGrpId", {cpcGrpIds: ids} )
  process(response, 'cpcGrpCpcIds'){|x| reverse_type( x ) }
end
info( auth, ids ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 43
def self.info( auth, ids )
  response = request( auth, Service, 'getCpcByCpcId', {cpcIds: ids} )
  process(response, 'cpcTypes'){|x| reverse_type( x )[0] }
end
pause( auth, ids ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 85
def self.pause( auth, ids )
  keywords = ids.map{|id| {id: id, pause: true} }
  self.update( auth, keywords )
end
quality( auth ,ids ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 96
def self.quality( auth ,ids )
  response = request( auth, Service, 'getCpcByCpcId', {cpcIds: ids} )
  process(response, 'cpcTypes'){|x| reverse_type(x, @quality_map) }
end
status( auth, ids ) click to toggle source

sogou的keyword服务不提供质量度和状态,从getInfo方法中查询

# File lib/ppc/api/sogou/keyword.rb, line 91
def self.status( auth, ids )
  response = request( auth, Service, 'getCpcByCpcId', {cpcIds: ids} )
  process(response, 'cpcTypes'){|x|  reverse_type(x, @status_map) }
end
update( auth, keywords ) click to toggle source
# File lib/ppc/api/sogou/keyword.rb, line 69
def self.update( auth, keywords )
  body = { cpcTypes: make_type( keywords )  }
  response = request( auth, Service, "updateCpc", body )
  process(response, 'cpcTypes'){|x| reverse_type(x)  }
end