Class: K2ConnectRuby::K2Services::Payloads::K2Webhooks
- Inherits:
-
Object
- Object
- K2ConnectRuby::K2Services::Payloads::K2Webhooks
- 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) ⇒ K2Webhooks
constructor
A new instance of K2Webhooks.
Constructor Details
#initialize(payload) ⇒ K2Webhooks
Returns a new instance of K2Webhooks.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 16 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.
7 8 9 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 7 def created_at @created_at end |
#event_resource ⇒ Object (readonly)
Returns the value of attribute event_resource.
7 8 9 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 7 def event_resource @event_resource end |
#event_type ⇒ Object (readonly)
Returns the value of attribute event_type.
7 8 9 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 7 def event_type @event_type end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 7 def id @id end |
#links_resource ⇒ Object (readonly)
Returns the value of attribute links_resource.
7 8 9 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 7 def links_resource @links_resource end |
#links_self ⇒ Object (readonly)
Returns the value of attribute links_self.
7 8 9 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 7 def links_self @links_self end |
#resource_id ⇒ Object (readonly)
Returns the value of attribute resource_id.
7 8 9 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 7 def resource_id @resource_id end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic.
7 8 9 |
# File 'lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb', line 7 def topic @topic end |