Class: Dropbox::API::File

Inherits:
Object
  • Object
show all
Includes:
Fileops
Defined in:
lib/dropbox-api/objects/file.rb

Instance Attribute Summary

Attributes inherited from Object

#client

Instance Method Summary collapse

Methods included from Fileops

#copy, #destroy, #move, #path, #share_url

Methods inherited from Object

convert, #deep_update, init, resolve_class

Instance Method Details

#copy_ref(options = {}) ⇒ Object



22
23
24
25
# File 'lib/dropbox-api/objects/file.rb', line 22

def copy_ref(options = {})
  response = client.raw.copy_ref({ :path => self.path }.merge(options))
  Dropbox::API::Object.init(response, client)
end

#direct_url(options = {}) ⇒ Object



31
32
33
34
# File 'lib/dropbox-api/objects/file.rb', line 31

def direct_url(options = {})
  response = client.raw.media({ :path => self.path }.merge(options))
  Dropbox::API::Object.init(response, client)
end

#downloadObject



27
28
29
# File 'lib/dropbox-api/objects/file.rb', line 27

def download
  client.download(self.path)
end

#restore(rev, options = {}) ⇒ Object



13
14
15
16
# File 'lib/dropbox-api/objects/file.rb', line 13

def restore(rev, options = {})
  response = client.raw.restore({ :rev => rev, :path => self.path }.merge(options))
  self.update response
end

#revisions(options = {}) ⇒ Object



8
9
10
11
# File 'lib/dropbox-api/objects/file.rb', line 8

def revisions(options = {})
  response = client.raw.revisions({ :path => self.path }.merge(options))
  Dropbox::API::Object.convert(response, client)
end

#thumbnail(options = {}) ⇒ Object



18
19
20
# File 'lib/dropbox-api/objects/file.rb', line 18

def thumbnail(options = {})
  client.raw.thumbnails({ :path => self.path }.merge(options))
end