Class: Webhookr::Mandrill::Adapter

Inherits:
Object
  • Object
show all
Includes:
Services::Adapter::Base
Defined in:
lib/webhookr-mandrill.rb

Constant Summary collapse

SERVICE_NAME =
"mandrill"
EVENT_KEY =
"event"
PAYLOAD_KEY =
"msg"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.process(raw_response) ⇒ Object



14
15
16
# File 'lib/webhookr-mandrill.rb', line 14

def self.process(raw_response)
  new.process(raw_response)
end

Instance Method Details

#process(raw_response) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/webhookr-mandrill.rb', line 18

def process(raw_response)
  Array.wrap(parse(raw_response)).collect do |p|
    Webhookr::AdapterResponse.new(
      SERVICE_NAME,
      p.fetch(EVENT_KEY),
      OstructUtils.to_ostruct(p)
    ) if assert_valid_packet(p)
  end
end