Class: CarrierWave::Storage::Dropbox::File

Inherits:
Object
  • Object
show all
Includes:
Utilities::Uri
Defined in:
lib/carrierwave/storage/dropbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uploader, config, path, client) ⇒ File

Returns a new instance of File.



49
50
51
# File 'lib/carrierwave/storage/dropbox.rb', line 49

def initialize(uploader, config, path, client)
  @uploader, @config, @path, @client = uploader, config, path, client
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



47
48
49
# File 'lib/carrierwave/storage/dropbox.rb', line 47

def path
  @path
end

Instance Method Details

#deleteObject



57
58
59
60
61
62
63
64
# File 'lib/carrierwave/storage/dropbox.rb', line 57

def delete
  path = @path
  path = "/#{path}" if @config[:access_type] == "dropbox"
  begin
    @client.file_delete(path)
  rescue DropboxError
  end
end

#urlObject



53
54
55
# File 'lib/carrierwave/storage/dropbox.rb', line 53

def url
  @client.media(@path)["url"]
end