Sha256: 720ff4e356b5e2d2d729b0b4bdd072063167b009ec9dd307351a7d692a9729c4

Contents?: true

Size: 810 Bytes

Versions: 1

Compression:

Stored size: 810 Bytes

Contents

require 'fetcher'
require 'things_fetcher/mail_handler'

module ThingsFetcher
  class Fetcher
    def initialize(config)
      super
      @config = config
    end
    
    def run
      fetcher = ::Fetcher.create(fetcher_options)
      fetcher.fetch
    end
    
  private
    attr_accessor :config
  
    def fetcher_options
      {
        :type => :imap,
        :receiver => handler,
        :server => config[:server],
        :port => config[:port],
        :ssl => config[:ssl],
        :use_login => config[:use_login],
        :username => config[:username],
        :password => config[:password],
        :in_folder => config[:in_folder],
        :error_folder => config[:error_folder]
      }      
    end
    
    def handler
      ThingsFetcher::MailHandler.new(config)      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
things-fetcher-0.1.1 lib/things_fetcher/fetcher.rb