Class: EmailFetchAndProcess::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/email-fetch-and-process.rb

Overview

Class tp encapsulate a fetch and handle job.

Instance Method Summary collapse

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

#actionObject



42
43
44
# File 'lib/email-fetch-and-process.rb', line 42

def action
  @args[:action]
end

#default_argsObject



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

#destinationObject



50
51
52
# File 'lib/email-fetch-and-process.rb', line 50

def destination
  @args[:destination]
end

#fetchObject



30
31
32
# File 'lib/email-fetch-and-process.rb', line 30

def fetch
  @args[:fetch]
end

#filenameObject



38
39
40
# File 'lib/email-fetch-and-process.rb', line 38

def filename
  @args[:filename]
end

#multiple_fetch_terms?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/email-fetch-and-process.rb', line 34

def multiple_fetch_terms?
  @args[:fetch][0].is_a?(Array)
end

#subdirectoryObject



46
47
48
# File 'lib/email-fetch-and-process.rb', line 46

def subdirectory
  @args[:subdirectory]
end