Class: RemoteTranslationLoader::Fetchers::S3Fetcher

Inherits:
BaseFetcher
  • Object
show all
Defined in:
lib/remote_translation_loader/fetchers/s3_fetcher.rb

Instance Method Summary collapse

Methods inherited from BaseFetcher

#parse

Constructor Details

#initialize(s3_client = Aws::S3::Client.new) ⇒ S3Fetcher

Returns a new instance of S3Fetcher.



8
9
10
# File 'lib/remote_translation_loader/fetchers/s3_fetcher.rb', line 8

def initialize(s3_client = Aws::S3::Client.new)
  @s3_client = s3_client
end

Instance Method Details

#fetch(bucket, key) ⇒ Object



12
13
14
15
# File 'lib/remote_translation_loader/fetchers/s3_fetcher.rb', line 12

def fetch(bucket, key)
  response = @s3_client.get_object(bucket: bucket, key: key)
  parse(response.body.read)
end