Sha256: b6eebca16bc93a452f2f946af9ff98f7d09a12a08c7e56e2fd532fd62a8cd90d

Contents?: true

Size: 655 Bytes

Versions: 15

Compression:

Stored size: 655 Bytes

Contents

require 'xmlsimple'

module Heirloom
  class Downloader
    class S3

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

      def download_file(args)
        s3.get_object args[:bucket], args[:key]
      rescue Excon::Errors::Forbidden, Excon::Errors::NotFound => e
        error = XmlSimple.xml_in e.response.body
        error['Message'].each do |msg|
          @logger.error msg
        end
        false
      end

      private

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
heirloom-0.12.7 lib/heirloom/downloader/s3.rb
heirloom-0.12.5 lib/heirloom/downloader/s3.rb
heirloom-0.12.4 lib/heirloom/downloader/s3.rb
heirloom-0.12.3 lib/heirloom/downloader/s3.rb
heirloom-0.12.2 lib/heirloom/downloader/s3.rb
heirloom-0.12.1 lib/heirloom/downloader/s3.rb
heirloom-0.12.0 lib/heirloom/downloader/s3.rb
heirloom-0.11.2 lib/heirloom/downloader/s3.rb
heirloom-0.11.1 lib/heirloom/downloader/s3.rb
heirloom-0.11.0 lib/heirloom/downloader/s3.rb
heirloom-0.11.0.beta.2 lib/heirloom/downloader/s3.rb
heirloom-0.11.0.beta.1 lib/heirloom/downloader/s3.rb
heirloom-0.10.1 lib/heirloom/downloader/s3.rb
heirloom-0.10.0 lib/heirloom/downloader/s3.rb
heirloom-0.9.0 lib/heirloom/downloader/s3.rb