Class: CarrierWave::Storage::Dropbox::File
- Inherits:
-
Object
- Object
- CarrierWave::Storage::Dropbox::File
- Includes:
- Utilities::Uri
- Defined in:
- lib/carrierwave/storage/dropbox.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(uploader, config, path, client) ⇒ File
constructor
A new instance of File.
- #url ⇒ Object
Constructor Details
#initialize(uploader, config, path, client) ⇒ File
Returns a new instance of File.
51 52 53 |
# File 'lib/carrierwave/storage/dropbox.rb', line 51 def initialize(uploader, config, path, client) @uploader, @config, @path, @client = uploader, config, path, client end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
49 50 51 |
# File 'lib/carrierwave/storage/dropbox.rb', line 49 def path @path end |
Instance Method Details
#delete ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/carrierwave/storage/dropbox.rb', line 64 def delete path = "/Public/#{@path}" if @config[:access_type] == "dropbox" begin @client.file_delete(path) rescue DropboxError end end |
#url ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/carrierwave/storage/dropbox.rb', line 55 def url user_id, path = @config[:user_id], @path if @config[:access_type] == "dropbox" "https://dl.dropboxusercontent.com/u/#{user_id}/#{path}" else @client.media(path)["url"] end end |