Class: Webhook
- Inherits:
-
Object
- Object
- Webhook
- Defined in:
- lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#event_resource ⇒ Object
readonly
Returns the value of attribute event_resource.
-
#event_type ⇒ Object
readonly
Returns the value of attribute event_type.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#links_resource ⇒ Object
readonly
Returns the value of attribute links_resource.
-
#links_self ⇒ Object
readonly
Returns the value of attribute links_self.
-
#resource_id ⇒ Object
readonly
Returns the value of attribute resource_id.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Webhook
constructor
A new instance of Webhook.
Constructor Details
#initialize(payload) ⇒ Webhook
Returns a new instance of Webhook.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 11 def initialize(payload) @id = payload.dig('id') @topic = payload.dig('topic') @created_at = payload.dig('created_at') # Event @event_type = payload.dig('event', 'type') @resource_id = payload.dig('event', 'resource', 'id') unless @event_type.eql?('Customer Created') # Links @links_self = payload.dig('_links', 'self') @links_resource = payload.dig('_links', 'resource') end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
2 3 4 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 2 def created_at @created_at end |
#event_resource ⇒ Object (readonly)
Returns the value of attribute event_resource.
2 3 4 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 2 def event_resource @event_resource end |
#event_type ⇒ Object (readonly)
Returns the value of attribute event_type.
2 3 4 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 2 def event_type @event_type end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 2 def id @id end |
#links_resource ⇒ Object (readonly)
Returns the value of attribute links_resource.
2 3 4 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 2 def links_resource @links_resource end |
#links_self ⇒ Object (readonly)
Returns the value of attribute links_self.
2 3 4 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 2 def links_self @links_self end |
#resource_id ⇒ Object (readonly)
Returns the value of attribute resource_id.
2 3 4 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 2 def resource_id @resource_id end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic.
2 3 4 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 2 def topic @topic end |