Class: Dragonfly::DataStorage::ImaginaryStore

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/dragonfly-imaginary.rb

Instance Method Summary collapse

Instance Method Details

#clientObject



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, options = nil)
  client.image_url(uid, options)
end