Class: Paymos::WebhookEvent
- Defined in:
- lib/paymos/models.rb,
sig/paymos.rbs
Instance Attribute Summary collapse
-
#data ⇒ Data
readonly
Returns the value of attribute data.
-
#event_id ⇒ String
readonly
Returns the value of attribute event_id.
-
#event_type ⇒ String
readonly
Returns the value of attribute event_type.
-
#occurred_at ⇒ Integer
readonly
Returns the value of attribute occurred_at.
-
#version ⇒ Integer
readonly
Returns the value of attribute version.
Class Method Summary collapse
Methods inherited from Model
#[], deep_freeze, fields, #initialize, #to_h
Constructor Details
This class inherits a constructor from Paymos::Model
Instance Attribute Details
#data ⇒ Data (readonly)
Returns the value of attribute data.
155 156 157 |
# File 'sig/paymos.rbs', line 155 def data @data end |
#event_id ⇒ String (readonly)
Returns the value of attribute event_id.
151 152 153 |
# File 'sig/paymos.rbs', line 151 def event_id @event_id end |
#event_type ⇒ String (readonly)
Returns the value of attribute event_type.
152 153 154 |
# File 'sig/paymos.rbs', line 152 def event_type @event_type end |
#occurred_at ⇒ Integer (readonly)
Returns the value of attribute occurred_at.
154 155 156 |
# File 'sig/paymos.rbs', line 154 def occurred_at @occurred_at end |
#version ⇒ Integer (readonly)
Returns the value of attribute version.
153 154 155 |
# File 'sig/paymos.rbs', line 153 def version @version end |
Class Method Details
.from(value) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/paymos/models.rb', line 148 def self.from(value) model = super valid = model.event_id.is_a?(String) && !model.event_id.empty? && model.event_type.is_a?(String) && !model.event_type.empty? && model.version.is_a?(Integer) && model.version.positive? && model.occurred_at.is_a?(Integer) && model.occurred_at >= 0 && model.data.is_a?(Hash) raise Error, 'Webhook event envelope is invalid' unless valid model end |