class S3diff::S3Client

Public Class Methods

new(options = {}) click to toggle source
# File lib/s3diff/s3_client.rb, line 6
def initialize(options = {})
  @client = Aws::S3::Client.new(options)
end

Public Instance Methods

get_object(s3_uri, file_io, options = {}) click to toggle source
# File lib/s3diff/s3_client.rb, line 14
def get_object(s3_uri, file_io, options = {})
  @client.get_object(options.merge(parse_s3_uri(s3_uri))) do |chunk|
    file_io.write(chunk)
  end
end
head_object(s3_uri, options = {}) click to toggle source
# File lib/s3diff/s3_client.rb, line 10
def head_object(s3_uri, options = {})
  @client.head_object(options.merge(parse_s3_uri(s3_uri)))
end
parse_s3_uri(s3_uri) click to toggle source
# File lib/s3diff/s3_client.rb, line 20
def parse_s3_uri(s3_uri)
  uri = URI.parse(s3_uri)
  { bucket: uri.host, key: uri.path.sub(%r{^/}, "") }
end