Class: Defog::FogWrapper::Aws
- Inherits:
-
Defog::FogWrapper
- Object
- Defog::FogWrapper
- Defog::FogWrapper::Aws
- Defined in:
- lib/defog/fog_wrapper.rb
Instance Attribute Summary
Attributes inherited from Defog::FogWrapper
#fog_connection, #fog_directory, #location
Instance Method Summary collapse
- #get_md5(key) ⇒ Object
-
#initialize(opts = {}) ⇒ Aws
constructor
A new instance of Aws.
- #provider ⇒ Object
- #url(key, expiry) ⇒ Object
Methods inherited from Defog::FogWrapper
connect, #fog_head, #get_file, #put_file
Constructor Details
#initialize(opts = {}) ⇒ Aws
Returns a new instance of Aws.
68 69 70 71 72 73 74 |
# File 'lib/defog/fog_wrapper.rb', line 68 def initialize(opts={}) opts = opts.keyword_args(:aws_access_key_id => :required, :aws_secret_access_key => :required, :region => :optional, :bucket => :required) @location = opts.delete(:bucket) @fog_connection = Fog::Storage.new(opts.merge(:provider => provider)) @fog_connection.directories.create :key => @location unless @fog_connection.directories.map(&:key).include? @location @fog_directory = @fog_connection.directories.get(@location) end |
Instance Method Details
#get_md5(key) ⇒ Object
76 77 78 |
# File 'lib/defog/fog_wrapper.rb', line 76 def get_md5(key) fog_head(key).content_md5 end |
#provider ⇒ Object
66 |
# File 'lib/defog/fog_wrapper.rb', line 66 def provider ; :AWS ; end |
#url(key, expiry) ⇒ Object
80 81 82 |
# File 'lib/defog/fog_wrapper.rb', line 80 def url(key, expiry) fog_head(key).url(expiry) end |