Class: Dropbox::Explorer::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/dropbox/explorer/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
# File 'lib/dropbox/explorer/client.rb', line 6

def initialize(options = {})
  @options = options
  @options[:credentials] = fetch_credentials

  @dropbox_client = init_dropbox_client
end

Instance Method Details

#contents_in_path(path = '/', options = {}) ⇒ Object



13
14
15
16
# File 'lib/dropbox/explorer/client.rb', line 13

def contents_in_path(path = '/', options = {})
   = @dropbox_client.(path)
  Folder.new().get_contents_paths(only_files: options[:only_files])
end

#get_file_content(file_path) ⇒ Object



18
19
20
21
# File 'lib/dropbox/explorer/client.rb', line 18

def get_file_content(file_path)
  content,  = @dropbox_client.(file_path)
  content
end

#get_file_url(file_path) ⇒ Object



23
24
25
26
# File 'lib/dropbox/explorer/client.rb', line 23

def get_file_url(file_path)
  generated_url = @dropbox_client.media(file_path)
  generated_url['url']
end