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

Methods inherited from Object

convert, #deep_update, init, resolve_class

Instance Method Details

#copy_ref(options = {}) ⇒ Object



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

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



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

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

#downloadObject



37
38
39
# File 'lib/dropbox-api/objects/file.rb', line 37

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

#share_url(options = {}) ⇒ Object



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

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

#thumbnail(options = {}) ⇒ Object



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

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