Sha256: cebf22f155fa2d46f5432f3f201cd786cfeb89a354a727b9bff051f72bc4f76b

Contents?: true

Size: 753 Bytes

Versions: 3

Compression:

Stored size: 753 Bytes

Contents

module Heirloom
  module Uploader
    class S3

      def initialize(args)
        @config = args[:config]
        @region = args[:region]
      end

      def upload_file(args)
        file = args[:file]
        key_name = args[:key_name]
        key_folder = args[:key_folder]
        public_readable = args[:public_readable]
        bucket = args[:bucket]

        s3_bucket = s3.get_bucket bucket

        s3_bucket.files.create :key    => "#{key_folder}/#{key_name}",
                               :body   => File.open(file),
                               :public => public_readable
      end

      private

      def s3
        @s3 ||= AWS::S3.new :config => @config,
                            :region => @region
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heirloom-0.1.0 lib/heirloom/uploader/s3.rb
heirloom-0.0.9 lib/heirloom/uploader/s3.rb
heirloom-0.0.8 lib/heirloom/uploader/s3.rb