class PPC::API::Qihu::Sublink

Constants

Service
SublinkType

Public Class Methods

add( auth, sublinks ) click to toggle source
# File lib/ppc/api/qihu/sublink.rb, line 42
def self.add( auth, sublinks )
  response = request( auth, Service, 'add', { sublinks: make_type( sublinks ) } )
  process( response, 'sublinkIdList'){ |x| x.map{|id| {id: id} } }
end
all( auth, group_ids ) click to toggle source
# File lib/ppc/api/qihu/sublink.rb, line 26
def self.all( auth, group_ids )
  results = self.ids( auth, group_ids )
  return results unless results[:succ]
  self.get( auth , results[:result] )
end
delete( auth, ids ) click to toggle source
# File lib/ppc/api/qihu/sublink.rb, line 47
def self.delete( auth, ids )
  response = request( auth, Service, 'deleteByIdList', { idList: ids } )
  process( response, 'affectedRecords' ){ |x|x }     
end
enable( auth, ids ) click to toggle source
# File lib/ppc/api/qihu/sublink.rb, line 62
def self.enable( auth, ids )
  self.update( auth, ids.map{ |id| { id: id, status: 'enable'} } )
end
get( auth, ids ) click to toggle source
# File lib/ppc/api/qihu/sublink.rb, line 37
def self.get( auth, ids )
  response = request( auth, Service, 'getInfoByIdList', { idList: ids } )
  process( response, 'sublinkList'){ |x| reverse_type( x ) }
end
ids( auth, group_ids ) click to toggle source
# File lib/ppc/api/qihu/sublink.rb, line 32
def self.ids( auth, group_ids )
  response = request( auth, Service, 'getIdListByGroupIdList', {groupIdList: group_ids} )
  process( response, 'sublinkIdListList' ){ |x| x.map(&:to_i) }
end
info( auth, ids ) click to toggle source
# File lib/ppc/api/qihu/sublink.rb, line 21
def self.info( auth, ids )
  response = request( auth, Service, 'getInfoByIdList', { idList: ids } )
  process( response, 'sublinkList'){ |x| reverse_type( x )[0] }
end
pause( auth, ids ) click to toggle source
# File lib/ppc/api/qihu/sublink.rb, line 66
def self.pause( auth, ids )
  self.update( auth, ids.map{ |id| { id: id, status: 'pause'} } )
end
update( auth, sublinks ) click to toggle source
# File lib/ppc/api/qihu/sublink.rb, line 52
def self.update( auth, sublinks )
  response = request( auth, Service, 'update', { sublinks: make_type( sublinks ) } )
  process( response, 'affectedRecords', 'failKeywordIds' ){ |x| x }        
end