Class: PPC::API::Qihu::Bulk
Constant Summary
collapse
- Service =
'account'
Class Method Summary
collapse
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
.download(auth, ids = nil) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/ppc/api/qihu/bulk.rb', line 23
def self.download( auth, ids = nil)
result = get_all_object(auth, ids)
field_id = result[:result]
loop do
status = get_file_state(auth, field_id)
return status if status[:result]['isGenerated'] == 'success'
sleep 15
end
end
|
.get_all_object(auth, ids) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/ppc/api/qihu/bulk.rb', line 9
def self.get_all_object( auth, ids )
body = nil
body = { 'idList' => to_json_string(ids) } if ids
response = request( auth, Service, 'getAllObjects', body )
process( response, 'fileId' ){ |x| x }
end
|
.get_file_state(auth, id) ⇒ Object
17
18
19
20
21
|
# File 'lib/ppc/api/qihu/bulk.rb', line 17
def self.get_file_state( auth, id )
body = { 'fileId' => id }
response = request( auth, Service, 'getFileState' , body )
process( response, '' ){ |x| x }
end
|