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.
169 170 171 172 173 174 175 176 177 |
# File 'lib/sendly/webhooks.rb', line 169 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.
167 168 169 |
# File 'lib/sendly/webhooks.rb', line 167 def api_version @api_version end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
167 168 169 |
# File 'lib/sendly/webhooks.rb', line 167 def created @created end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
167 168 169 |
# File 'lib/sendly/webhooks.rb', line 167 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
167 168 169 |
# File 'lib/sendly/webhooks.rb', line 167 def id @id end |
#livemode ⇒ Object (readonly)
Returns the value of attribute livemode.
167 168 169 |
# File 'lib/sendly/webhooks.rb', line 167 def livemode @livemode end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
167 168 169 |
# File 'lib/sendly/webhooks.rb', line 167 def type @type end |
Instance Method Details
#created_at ⇒ Object
179 180 181 |
# File 'lib/sendly/webhooks.rb', line 179 def created_at @created end |
#to_h ⇒ Object
183 184 185 186 187 188 189 190 191 192 |
# File 'lib/sendly/webhooks.rb', line 183 def to_h { id: @id, type: @type, data: @data.to_h, created: @created, api_version: @api_version, livemode: @livemode } end |