Class: Putio::File
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Api::Object
#client, instantiate_object, parse_collection, parse_object, plural_name, #set_attribute, singular_name
#client
Class Method Details
.get(id) ⇒ Object
8
9
10
11
|
# File 'lib/putio-ruby/file.rb', line 8
def self.get(id)
res = client.get "files/#{id}"
parse_object res.body if res.success?
end
|
.list(parent_id = nil) ⇒ Object
3
4
5
6
|
# File 'lib/putio-ruby/file.rb', line 3
def self.list(parent_id=nil)
res = client.get "files/list", ( parent_id ? {:parent_id => parent_id} : nil )
parse_collection res.body if res.success?
end
|
Instance Method Details
#delete ⇒ Object
18
19
20
|
# File 'lib/putio-ruby/file.rb', line 18
def delete
client.post "files/delete", :file_ids => id
end
|
#download_url ⇒ Object
13
14
15
16
|
# File 'lib/putio-ruby/file.rb', line 13
def download_url
res = client.get "files/#{id}/download"
res.[:location] if res.success?
end
|