-1

I've created a Rails 6 app that downloads data from an SFTP server. I have the Ruby script working and now need to automate the following:

Logon to the server --> Download the data --> Send the data files to a folder within the app or perhaps a dropbox folder? --> send an email letting me know when this has happened (or hasn't)

This would repeat on a daily basis at a given time.

I have the Whenever gem installed. Are there ways of a) sending automated email announcements after task is done and b) sending the files to something like Dropbox or other cloud service?

Demian Sims
  • 871
  • 1
  • 14
  • 29

1 Answers1

0

You can write a rake task and run it with a cron job

Use mechanize gem to login and download file

Use mail gem to send email after task is finished or failed

Use APIs for Dropbox, AWS or gems (if available) for uploading file

PGill
  • 3,373
  • 18
  • 21
  • Great! Will Heroku allow me to use the API's? Also, I assumed that I would need ActiveStorage to attach a downloaded file to `record` model and send to AWS S3 that way. Is it possible to just send directly to AWS without the ActiveStorage attachment methods? – Demian Sims Nov 24 '19 at 23:41
  • S3 API should work fine on heroku. You can use [aws-sdk-ruby](https://github.com/aws/aws-sdk-ruby) gem to upload directly to S3. [S3 docs](https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/s3-examples.html) – PGill Nov 25 '19 at 05:52