Class: S3Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/s3_downloader.rb

Constant Summary collapse

VERSION =
"1.1.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeS3Downloader

Returns a new instance of S3Downloader.



8
9
10
11
12
13
# File 'lib/s3_downloader.rb', line 8

def initialize
  @s3_bucket_name = 'routes-for-radarr'
  @file_name = 'api_routes.yml'
  @s3_bucket_object = Aws::S3::Bucket.new(@s3_bucket_name).object(@file_name)
  @download_location = "/tmp/#{@file_name}"
end

Instance Attribute Details

#download_locationObject (readonly)

Returns the value of attribute download_location.



6
7
8
# File 'lib/s3_downloader.rb', line 6

def download_location
  @download_location
end

Instance Method Details

#check_for_existing_routes_fileObject



19
20
21
# File 'lib/s3_downloader.rb', line 19

def check_for_existing_routes_file
  File.exists?(@download_location)
end

#download_routesObject



15
16
17
# File 'lib/s3_downloader.rb', line 15

def download_routes
  @s3_bucket_object.download_file(@download_location) unless check_for_existing_routes_file
end