Class: AbacatePay::Webhooks::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/abacate_pay/webhooks/event.rb

Overview

A parsed webhook event.

Accepts both the camelCase and snake_case spellings AbacatePay has used for the envelope fields, so older and newer webhook versions both parse.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Event

Returns a new instance of Event.

Parameters:

  • data (Hash)

    Parsed webhook payload



13
14
15
16
17
# File 'lib/abacate_pay/webhooks/event.rb', line 13

def initialize(data)
  @type = data["event"] || data["type"]
  @data = data["data"]
  @created_at = data["createdAt"] || data["created_at"]
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



10
11
12
# File 'lib/abacate_pay/webhooks/event.rb', line 10

def created_at
  @created_at
end

#dataObject (readonly)

Returns the value of attribute data.



10
11
12
# File 'lib/abacate_pay/webhooks/event.rb', line 10

def data
  @data
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/abacate_pay/webhooks/event.rb', line 10

def type
  @type
end