Class: Dropbox::API::Dir

Inherits:
Object
  • Object
show all
Includes:
Fileops
Defined in:
lib/dropbox-api/objects/dir.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

#direct_url(options = {}) ⇒ Object



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

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

#hashObject



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

def hash
  self[:hash]
end

#ls(path_to_list = '') ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/dropbox-api/objects/dir.rb', line 8

def ls(path_to_list = '')
  data = client.raw. :path => path + path_to_list
  if data['is_dir']
    Dropbox::API::Object.convert(data.delete('contents') || [], client)
  else
    [Dropbox::API::Object.convert(data, client)]
  end
end