Class: Webhookr::Stripe::Adapter
- Inherits:
-
Object
- Object
- Webhookr::Stripe::Adapter
- Includes:
- Webhookr::Services::Adapter::Base
- Defined in:
- lib/webhookr-stripe.rb
Constant Summary collapse
- SERVICE_NAME =
"stripe"
- EVENT_KEY =
"type"
- PAYLOAD_KEY =
"data"
- OBJECT_KEY =
"object"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.process(raw_response) ⇒ Object
15 16 17 |
# File 'lib/webhookr-stripe.rb', line 15 def self.process(raw_response) new.process(raw_response) end |
Instance Method Details
#process(raw_response) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/webhookr-stripe.rb', line 19 def process(raw_response) Array.wrap(parse(raw_response)).collect do |p| Webhookr::AdapterResponse.new( SERVICE_NAME, convert_periods_to_underscores(p.fetch(EVENT_KEY)), OstructUtils.to_ostruct(p)[PAYLOAD_KEY][OBJECT_KEY] ) if assert_valid_packet(p) end end |