Class: S3Downloader
- Inherits:
-
Object
- Object
- S3Downloader
- Defined in:
- lib/s3_downloader.rb
Constant Summary collapse
- VERSION =
"1.1.0"
Instance Attribute Summary collapse
-
#download_location ⇒ Object
readonly
Returns the value of attribute download_location.
Instance Method Summary collapse
- #check_for_existing_routes_file ⇒ Object
- #download_routes ⇒ Object
-
#initialize ⇒ S3Downloader
constructor
A new instance of S3Downloader.
Constructor Details
#initialize ⇒ S3Downloader
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_location ⇒ Object (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_file ⇒ Object
19 20 21 |
# File 'lib/s3_downloader.rb', line 19 def check_for_existing_routes_file File.exists?(@download_location) end |
#download_routes ⇒ Object
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 |