class AwsTestDump::S3FileDump

Public Instance Methods

dump_data() click to toggle source
# File lib/aws_test_dump.rb, line 111
def dump_data
  dirname = File.dirname(@dump_file)
  unless File.directory?(dirname)
    FileUtils.mkdir_p(dirname)
  end
  File.open(@dump_file, 'w') { |file| file.write file_contents }
end
file_contents() click to toggle source
# File lib/aws_test_dump.rb, line 101
def file_contents
  if @file_contents.nil?
    response = @s3_client.get_object(
      bucket: @bucket_name, key: @key_name
    ).body.read
    @file_contents = @key_name.end_with?('.json') ? JSON.pretty_generate(JSON.parse(response)) : response
  end
  @file_contents
end
run() click to toggle source
# File lib/aws_test_dump.rb, line 97
def run
  dump_data
end