Class: ActiveProject::WebhookEvent
- Inherits:
-
Struct
- Object
- Struct
- ActiveProject::WebhookEvent
- Defined in:
- lib/active_project/webhook_event.rb
Overview
Represents a standardized event parsed from a webhook payload. Using Struct for simplicity for now. Could be a full class inheriting BaseResource if needed.
Instance Attribute Summary collapse
-
#actor ⇒ Object
Returns the value of attribute actor.
-
#data ⇒ Object
(also: #object_data)
Returns the value of attribute data.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#raw_data ⇒ Object
Returns the value of attribute raw_data.
-
#resource_id ⇒ Object
(also: #event_object_id)
Returns the value of attribute resource_id.
-
#resource_type ⇒ Object
(also: #object_kind)
Returns the value of attribute resource_type.
-
#source ⇒ Object
(also: #adapter_source)
Returns the value of attribute source.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#type ⇒ Object
(also: #event_type)
Returns the value of attribute type.
-
#webhook_type ⇒ Object
Returns the value of attribute webhook_type.
Instance Method Summary collapse
- #changes ⇒ Object
-
#object_key ⇒ Object
Additional aliases that might be expected.
-
#resource ⇒ Object
Helper method to get the resource object.
Instance Attribute Details
#actor ⇒ Object
Returns the value of attribute actor
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def actor @actor end |
#data ⇒ Object Also known as: object_data
Returns the value of attribute data
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def data @data end |
#project_id ⇒ Object
Returns the value of attribute project_id
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def project_id @project_id end |
#raw_data ⇒ Object
Returns the value of attribute raw_data
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def raw_data @raw_data end |
#resource_id ⇒ Object Also known as: event_object_id
Returns the value of attribute resource_id
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def resource_id @resource_id end |
#resource_type ⇒ Object Also known as: object_kind
Returns the value of attribute resource_type
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def resource_type @resource_type end |
#source ⇒ Object Also known as: adapter_source
Returns the value of attribute source
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def source @source end |
#timestamp ⇒ Object
Returns the value of attribute timestamp
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def end |
#type ⇒ Object Also known as: event_type
Returns the value of attribute type
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def type @type end |
#webhook_type ⇒ Object
Returns the value of attribute webhook_type
6 7 8 |
# File 'lib/active_project/webhook_event.rb', line 6 def webhook_type @webhook_type end |
Instance Method Details
#changes ⇒ Object
31 32 33 34 |
# File 'lib/active_project/webhook_event.rb', line 31 def changes changes_data = data&.dig(:changes) || data&.dig("changes") changes_data.nil? || changes_data.empty? ? nil : changes_data end |
#object_key ⇒ Object
Additional aliases that might be expected
27 28 29 |
# File 'lib/active_project/webhook_event.rb', line 27 def object_key data&.dig(:object_key) || data&.dig("object_key") end |
#resource ⇒ Object
Helper method to get the resource object
37 38 39 40 |
# File 'lib/active_project/webhook_event.rb', line 37 def resource return data[resource_type] if data && data.key?(resource_type) nil end |