Sha256: 4db21d7a0b635908eac0102d0bf2021776d747520eecebf767615ed2776255bb

Contents?: true

Size: 634 Bytes

Versions: 15

Compression:

Stored size: 634 Bytes

Contents

require 'fog'

class Tasks::Toolbelt::Storage
class << self

  PROVIDER = 'AWS'
  BUCKET = "quandl-command"

  def create(file_name, file_contents)
    puts "Storage.create #{BUCKET}/#{file_name}"
    directory.files.create( key: file_name, body: file_contents, public: true )
  end

  def directory
    @directory ||= connection.directories.get(BUCKET)
  end

  def connection
    # create a connection
    @connection ||= Fog::Storage.new({
      :provider                 => PROVIDER,
      :aws_access_key_id        => ENV['AWS_ACCESS_KEY_ID'],
      :aws_secret_access_key    => ENV['AWS_SECRET_ACCESS_KEY']
    })
  end

end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
quandl-0.4.4 tasks/toolbelt/storage.rb
quandl-0.4.3 tasks/toolbelt/storage.rb
quandl-0.4.2 tasks/toolbelt/storage.rb
quandl-0.4.1 tasks/toolbelt/storage.rb
quandl-0.4.0 tasks/toolbelt/storage.rb
quandl-0.3.7 tasks/toolbelt/storage.rb
quandl-0.3.6 tasks/toolbelt/storage.rb
quandl-0.3.4 tasks/toolbelt/storage.rb
quandl-0.3.3 tasks/toolbelt/storage.rb
quandl-0.3.0 tasks/toolbelt/storage.rb
quandl-0.2.27 tasks/toolbelt/storage.rb
quandl-0.2.26 tasks/toolbelt/storage.rb
quandl-0.2.25 tasks/toolbelt/storage.rb
quandl-0.2.24 tasks/toolbelt/storage.rb
quandl-0.2.22 tasks/toolbelt/storage.rb