Class: Incoming::Strategies::Mandrill

Inherits:
Object
  • Object
show all
Includes:
Incoming::Strategy
Defined in:
lib/incoming/strategies/mandrill.rb

Instance Attribute Summary

Attributes included from Incoming::Strategy

#message

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Incoming::Strategy

#authenticate, included, #receive

Constructor Details

#initialize(msg) ⇒ Mandrill

Returns a new instance of Mandrill.



17
18
19
# File 'lib/incoming/strategies/mandrill.rb', line 17

def initialize(msg)
  @message = Mail.new(msg['raw_msg'])
end

Class Method Details

.receive(request) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/incoming/strategies/mandrill.rb', line 8

def self.receive(request)
  JSON.parse(request.params['mandrill_events']).map do |event|
    next unless event['event'] == 'inbound'
    result = super(event['msg'])
    yield(result) if block_given?
    result
  end.compact
end