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
-
#file_id ⇒ Object
readonly
Returns the value of attribute file_id.
Instance Method Summary collapse
- #delete ⇒ Object
- #file_data ⇒ Object
- #filename ⇒ Object
-
#initialize(uploader, config, file_id, client) ⇒ File
constructor
A new instance of File.
- #url ⇒ Object
Constructor Details
#initialize(uploader, config, file_id, client) ⇒ File
Returns a new instance of File.
45 46 47 |
# File 'lib/carrierwave/storage/dropbox.rb', line 45 def initialize(uploader, config, file_id, client) @uploader, @config, @file_id, @client = uploader, config, file_id, client end |
Instance Attribute Details
#file_id ⇒ Object (readonly)
Returns the value of attribute file_id.
43 44 45 |
# File 'lib/carrierwave/storage/dropbox.rb', line 43 def file_id @file_id end |
Instance Method Details
#delete ⇒ Object
61 62 63 64 65 66 |
# File 'lib/carrierwave/storage/dropbox.rb', line 61 def delete begin @client.delete @file_id rescue ::Dropbox::ApiError end end |
#file_data ⇒ Object
49 50 51 |
# File 'lib/carrierwave/storage/dropbox.rb', line 49 def file_data @file_data ||= @client.get_temporary_link(@file_id) end |
#filename ⇒ Object
53 54 55 |
# File 'lib/carrierwave/storage/dropbox.rb', line 53 def filename file_data[0].name end |
#url ⇒ Object
57 58 59 |
# File 'lib/carrierwave/storage/dropbox.rb', line 57 def url file_data[1] end |