Module: Astrotrain

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

Defined Under Namespace

Modules: Transports Classes: Attachment, Message

Constant Summary collapse

VERSION =
'0.7.0'

Class Method Summary collapse

Class Method Details

.deliver(message, destination, options = {}) ⇒ Object

Processes an Astrotrain message.

message - Astrotrain::Message instance. destination - String URL to deliver the message. The scheme selects

which Transport module to use (http://, resque://)

options - Optional hash of options:

:recipient - The main String recipient of the email.
:payload   - Optional hash to be sent with the request.

Returns nothing.



21
22
23
24
25
26
27
# File 'lib/astrotrain.rb', line 21

def self.deliver(message, destination, options = {})
  uri   = Addressable::URI.parse(destination.to_s)
  klass = Transports.load(uri.scheme)
  klass.deliver(message, destination,
                :recipient => options[:recipient],
                :extra     => options[:payload])
end