Class: EmailFetchAndProcess::Job
- Inherits:
-
Object
- Object
- EmailFetchAndProcess::Job
- Defined in:
- lib/email-fetch-and-process.rb
Overview
Class tp encapsulate a fetch and handle job.
Instance Method Summary collapse
- #action ⇒ Object
- #default_args ⇒ Object
- #destination ⇒ Object
- #fetch ⇒ Object
- #filename ⇒ Object
-
#initialize(args = {}) ⇒ Job
constructor
A new instance of Job.
- #multiple_fetch_terms? ⇒ Boolean
- #subdirectory ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Job
Returns a new instance of Job.
16 17 18 |
# File 'lib/email-fetch-and-process.rb', line 16 def initialize(args = {}) @args = default_args.merge args end |
Instance Method Details
#action ⇒ Object
42 43 44 |
# File 'lib/email-fetch-and-process.rb', line 42 def action @args[:action] end |
#default_args ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/email-fetch-and-process.rb', line 20 def default_args { fetch: ['SUBJECT', ''], filename: '', action: 'echo FILEPATH', subdirectory: nil, destination: '/tmp' } end |
#destination ⇒ Object
50 51 52 |
# File 'lib/email-fetch-and-process.rb', line 50 def destination @args[:destination] end |
#fetch ⇒ Object
30 31 32 |
# File 'lib/email-fetch-and-process.rb', line 30 def fetch @args[:fetch] end |
#filename ⇒ Object
38 39 40 |
# File 'lib/email-fetch-and-process.rb', line 38 def filename @args[:filename] end |
#multiple_fetch_terms? ⇒ Boolean
34 35 36 |
# File 'lib/email-fetch-and-process.rb', line 34 def multiple_fetch_terms? @args[:fetch][0].is_a?(Array) end |
#subdirectory ⇒ Object
46 47 48 |
# File 'lib/email-fetch-and-process.rb', line 46 def subdirectory @args[:subdirectory] end |