Module: Reelagram::Mail

Defined in:
lib/reelagram/mail.rb,
lib/reelagram/mail/configuration.rb,
lib/reelagram/mail/fetchers/base_fetcher.rb,
lib/reelagram/mail/parsers/shipping_parser.rb,
lib/reelagram/mail/fetchers/shipping_fetcher.rb,
lib/reelagram/mail/processors/shipping_processor.rb

Defined Under Namespace

Modules: Fetchers, Parsers, Processors Classes: Configuration

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



11
12
13
# File 'lib/reelagram/mail.rb', line 11

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



14
15
16
17
18
# File 'lib/reelagram/mail.rb', line 14

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
  configured?
end

.configured?Boolean

Returns:

  • (Boolean)


20
21
22
23
# File 'lib/reelagram/mail.rb', line 20

def self.configured?
  return false if configuration.nil?
  configuration.configured?
end

.debug?Boolean

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/reelagram/mail.rb', line 31

def self.debug?
  false unless configured?
  configuration.debug
end

.process_shipping_emailsObject



25
26
27
28
29
# File 'lib/reelagram/mail.rb', line 25

def self.process_shipping_emails
  emails = Fetchers::ShippingFetcher.new.fetch
  parser = Parsers::ShippingParser.new
  Processors::ShippingProcessor.new(emails, parser).run
end