Class: Sendly::WebhookEvent
- Inherits:
-
Object
- Object
- Sendly::WebhookEvent
- Defined in:
- lib/sendly/webhooks.rb
Instance Attribute Summary collapse
-
#api_version ⇒ Object
readonly
Returns the value of attribute api_version.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#livemode ⇒ Object
readonly
Returns the value of attribute livemode.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #created_at ⇒ Object
-
#initialize(data) ⇒ WebhookEvent
constructor
A new instance of WebhookEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ WebhookEvent
Returns a new instance of WebhookEvent.
153 154 155 156 157 158 159 160 161 |
# File 'lib/sendly/webhooks.rb', line 153 def initialize(data) @id = data[:id] @type = data[:type] obj = data[:data][:object] || data[:data] @data = WebhookMessageData.new(obj) @created = data[:created] || data[:created_at] || 0 @api_version = data[:api_version] || '2024-01' @livemode = data[:livemode] || false end |
Instance Attribute Details
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
151 152 153 |
# File 'lib/sendly/webhooks.rb', line 151 def api_version @api_version end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
151 152 153 |
# File 'lib/sendly/webhooks.rb', line 151 def created @created end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
151 152 153 |
# File 'lib/sendly/webhooks.rb', line 151 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
151 152 153 |
# File 'lib/sendly/webhooks.rb', line 151 def id @id end |
#livemode ⇒ Object (readonly)
Returns the value of attribute livemode.
151 152 153 |
# File 'lib/sendly/webhooks.rb', line 151 def livemode @livemode end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
151 152 153 |
# File 'lib/sendly/webhooks.rb', line 151 def type @type end |
Instance Method Details
#created_at ⇒ Object
163 164 165 |
# File 'lib/sendly/webhooks.rb', line 163 def created_at @created end |
#to_h ⇒ Object
167 168 169 170 171 172 173 174 175 176 |
# File 'lib/sendly/webhooks.rb', line 167 def to_h { id: @id, type: @type, data: @data.to_h, created: @created, api_version: @api_version, livemode: @livemode } end |