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, 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_idObject (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

#deleteObject



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_dataObject



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

def file_data
  @file_data ||= @client.get_temporary_link(@file_id)
end

#filenameObject



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

def filename
  file_data[0].name
end

#urlObject



57
58
59
# File 'lib/carrierwave/storage/dropbox.rb', line 57

def url
  file_data[1]
end