Class: Dragonfly::DataStorage::ImaginaryStore
- Inherits:
-
Object
- Object
- Dragonfly::DataStorage::ImaginaryStore
- Includes:
- Configurable
- Defined in:
- lib/dragonfly-imaginary.rb
Instance Method Summary collapse
- #client ⇒ Object
- #destroy(uid) ⇒ Object
- #retrieve(uid) ⇒ Object
- #store(temp_object, opts = {}) ⇒ Object
- #url_for(uid, options = nil) ⇒ Object
Instance Method Details
#client ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/dragonfly-imaginary.rb', line 17 def client @client ||= ::Imaginary::Client.new(server_url, bucket: bucket, username: username, password: password, secret: secret) end |
#destroy(uid) ⇒ Object
33 34 35 |
# File 'lib/dragonfly-imaginary.rb', line 33 def destroy(uid) # TODO: implement end |
#retrieve(uid) ⇒ Object
29 30 31 |
# File 'lib/dragonfly-imaginary.rb', line 29 def retrieve(uid) URI.parse(client.image_url(uid)).read end |
#store(temp_object, opts = {}) ⇒ Object
25 26 27 |
# File 'lib/dragonfly-imaginary.rb', line 25 def store(temp_object, opts={}) client.add_image_from_file(temp_object.file) end |
#url_for(uid, options = nil) ⇒ Object
37 38 39 |
# File 'lib/dragonfly-imaginary.rb', line 37 def url_for(uid, = nil) client.image_url(uid, ) end |