Class: Paypal::Webhooks::Event
- Inherits:
-
Object
- Object
- Paypal::Webhooks::Event
- Defined in:
- lib/paypal/webhooks/event.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- VALID_PAYPAL_CERT_CN =
"messageverificationcerts.paypal.com".freeze
- VALID_PAYPAL_CERT_HOST =
"api.paypal.com".freeze
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(params:, request:) ⇒ Event
constructor
A new instance of Event.
- #type ⇒ Object
- #verify ⇒ Object
- #verify! ⇒ Object
Constructor Details
#initialize(params:, request:) ⇒ Event
Returns a new instance of Event.
19 20 21 22 23 |
# File 'lib/paypal/webhooks/event.rb', line 19 def initialize(params:, request:) @request = request @body = request.body&.read @params = params end |
Class Method Details
.cert_cache ⇒ Object
10 11 12 |
# File 'lib/paypal/webhooks/event.rb', line 10 def cert_cache @cert_cache ||= {} end |
.clear_cert_cache ⇒ Object
14 15 16 |
# File 'lib/paypal/webhooks/event.rb', line 14 def clear_cert_cache @cert_cache = nil end |
Instance Method Details
#data ⇒ Object
37 38 39 |
# File 'lib/paypal/webhooks/event.rb', line 37 def data @data ||= Util.deep_symbolize_keys(@params)[:resource] || {} end |
#type ⇒ Object
33 34 35 |
# File 'lib/paypal/webhooks/event.rb', line 33 def type @params[:event_type] end |
#verify ⇒ Object
29 30 31 |
# File 'lib/paypal/webhooks/event.rb', line 29 def verify verify_cert_url && verify_cert && verify_signature end |
#verify! ⇒ Object
25 26 27 |
# File 'lib/paypal/webhooks/event.rb', line 25 def verify! raise EventVerificationFailed unless verify end |