Class: Simplify::Event

Inherits:
Hash
  • Object
show all
Defined in:
lib/simplify/event.rb

Overview

An Event object

Class Method Summary collapse

Class Method Details

.create(params, *auth) ⇒ Object

Creates a webhook Event object

params

a hash of parameters; valid keys are:

  • payload The raw JWS message payload. required

  • url The URL for the webhook. If present it must match the URL registered for the webhook.

auth

Authentication information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object.



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/simplify/event.rb', line 42

def self.create(params, *auth)

   h = Simplify::PaymentsApi.jws_decode(params, Simplify::PaymentsApi.create_auth_object(auth))

 if !h['event']
     raise ApiException.new("Incorrect data in webhook event", nil, nil)
 end

 obj = Event.new()
 obj = obj.merge!(h['event'])

 obj
end