Class: CarrierWave::Storage::SwiftSwauth

Inherits:
Abstract
  • Object
show all
Defined in:
lib/carrierwave/storage/swift_swauth.rb

Instance Method Summary collapse

Instance Method Details

#retrieve!(file_identifier) ⇒ Object

Public: Returns the object given the identifier

Examples

swift_swauth.retrieve! 'foo'
=> <OpenStack::Swift::Container::Object>

Returns an instance of OpenStack::Swift::COntainer::Object



29
30
31
# File 'lib/carrierwave/storage/swift_swauth.rb', line 29

def retrieve!(file_identifier)
  client.object(file_identifier)
end

#store!(file) ⇒ Object

Public: Stores the file on Swift

Examples

swift_swauth.store! <File>
=> nil

Returns nothing



16
17
18
19
# File 'lib/carrierwave/storage/swift_swauth.rb', line 16

def store!(file)
  write_opts = { content_type: file.content_type }
  client.create_object(identifier, write_opts, file)
end