Class Fetcher::Base
In: vendor/plugins/fetcher/lib/fetcher/base.rb
Parent: Object

Methods

fetch   new   process_message  

Public Class methods

Options:

  • :server - Server to connect to.
  • :username - Username to use when connecting to server.
  • :password - Password to use when connecting to server.
  • :receiver - Receiver object to pass messages to. Assumes the

receiver object has a receive method that takes a message as it‘s argument

Additional protocol-specific options implimented by sub-classes

Example:

  Fetcher::Base.new(:server => 'mail.example.com',
                    :username => 'pam',
                    :password => 'test',
                    :receiver => IncomingMailHandler)

[Source]

    # File vendor/plugins/fetcher/lib/fetcher/base.rb, line 17
17:     def initialize(options={})
18:       %w(server username password receiver).each do |opt|
19:         raise ArgumentError, "#{opt} is required" unless options[opt.to_sym]
20:         instance_eval("@#{opt} = options[:#{opt}]")
21:       end
22:     end

Public Instance methods

Run the fetching process

[Source]

    # File vendor/plugins/fetcher/lib/fetcher/base.rb, line 25
25:     def fetch
26:       establish_connection
27:       get_messages
28:       close_connection
29:     end

Protected Instance methods

Send message to receiver object

[Source]

    # File vendor/plugins/fetcher/lib/fetcher/base.rb, line 49
49:     def process_message(message)
50:       @receiver.receive(message)
51:     end

[Validate]