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

Methods inherited from Object

convert, #deep_update, init, resolve_class

Instance Method Details

#folder_meta(path, hash = '') ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/dropbox-api/objects/dir.rb', line 17

def folder_meta(path,hash = '')
  data = client.raw. :path => path, :hash => hash
  
  if data.kind_of? Dropbox::API::Error::NotModified
    return Dropbox::API::Error::NotModified
  else
    return data  
  end
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