Class: PPC::API::Qihu::Sublink

Inherits:
PPC::API::Qihu show all
Defined in:
lib/ppc/api/qihu/sublink.rb

Constant Summary collapse

Service =
'sublink'

Class Method Summary collapse

Methods inherited from PPC::API::Qihu

make_type, process, request_http_body, request_http_header, request_uri, reverse_type, to_id_list, to_json_string

Methods included from PPC::API

#debug_off, #debug_on, #is_no_quota, #make_type, #process, #request, #request_http_body, #request_http_header, #request_uri, #reverse_type

Class Method Details

.add(auth, sublinks) ⇒ Object



23
24
25
26
27
28
# File 'lib/ppc/api/qihu/sublink.rb', line 23

def self.add( auth, sublinks )
  sublink_types = make_type( sublinks ).to_json
  body = { 'sublinks' => sublink_types}
  response = request( auth, Service, 'add', body )
  process( response, 'sublinkIdList'){ |x| to_id_hash_list( x['item'] ) }
end

.get(auth, ids) ⇒ Object



17
18
19
20
21
# File 'lib/ppc/api/qihu/sublink.rb', line 17

def self.get( auth, ids )
  body  = { 'idList' => to_json_string( ids ) }
  response = request( auth, Service, 'getInfoByIdList', body )
  process( response, 'sublinkList'){ |x| reverse_type( x['item'] ) }
end