Class: Paymos::WebhookEvent

Inherits:
Model
  • Object
show all
Defined in:
lib/paymos/models.rb,
sig/paymos.rbs

Instance Attribute Summary collapse

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

#dataData (readonly)

Returns the value of attribute data.

Returns:

  • (Data)


155
156
157
# File 'sig/paymos.rbs', line 155

def data
  @data
end

#event_idString (readonly)

Returns the value of attribute event_id.

Returns:

  • (String)


151
152
153
# File 'sig/paymos.rbs', line 151

def event_id
  @event_id
end

#event_typeString (readonly)

Returns the value of attribute event_type.

Returns:

  • (String)


152
153
154
# File 'sig/paymos.rbs', line 152

def event_type
  @event_type
end

#occurred_atInteger (readonly)

Returns the value of attribute occurred_at.

Returns:

  • (Integer)


154
155
156
# File 'sig/paymos.rbs', line 154

def occurred_at
  @occurred_at
end

#versionInteger (readonly)

Returns the value of attribute version.

Returns:

  • (Integer)


153
154
155
# File 'sig/paymos.rbs', line 153

def version
  @version
end

Class Method Details

.from(value) ⇒ Object

Raises:



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