Module: Astrotrain::Transports

Defined in:
lib/astrotrain.rb,
lib/astrotrain/transports/resque.rb,
lib/astrotrain/transports/http_post.rb

Overview

Transports are responsible for getting this email where it is supposed to go.

All Transports should conform to this API:

Transports::HttpPost.process(address, message, main_recipient, extra_payload={})

Defined Under Namespace

Modules: HttpPost, Resque

Constant Summary collapse

MAP =
{:http => :http_post, :resque => :resque}

Class Method Summary collapse

Class Method Details

.load(key) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/astrotrain.rb', line 39

def self.load(key)
  key   = key.to_sym if key
  value = MAP[key]
  if !value
    raise ArgumentError, "No transport #{key.inspect} found in #{MAP.keys.inspect}"
  elsif value.is_a?(Module)
    value
  else
    require "astrotrain/transports/#{value}"
    MAP[key]
  end
end