Class: UnivapayClientSdk::WebhookCallbackEnvelope
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::WebhookCallbackEnvelope
- Defined in:
- lib/univapay_client_sdk/models/webhook_callback_envelope.rb
Overview
Common wrapper POSTed to your webhook URL for every event. The data field
contains the domain object relevant to the event type.
Instance Attribute Summary collapse
-
#created_on ⇒ DateTime
Timestamp when the event was fired.
-
#event ⇒ WebhookTrigger
Event type that triggers a webhook notification.
-
#id ⇒ UUID | String
Unique ID of this webhook delivery.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(id:, event:, created_on:, additional_properties: nil) ⇒ WebhookCallbackEnvelope
constructor
A new instance of WebhookCallbackEnvelope.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_on ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id:, event:, created_on:, additional_properties: nil) ⇒ WebhookCallbackEnvelope
Returns a new instance of WebhookCallbackEnvelope.
45 46 47 48 49 50 51 52 53 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 45 def initialize(id:, event:, created_on:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id @event = event @created_on = created_on @additional_properties = additional_properties end |
Instance Attribute Details
#created_on ⇒ DateTime
Timestamp when the event was fired.
24 25 26 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 24 def created_on @created_on end |
#event ⇒ WebhookTrigger
Event type that triggers a webhook notification.
20 21 22 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 20 def event @event end |
#id ⇒ UUID | String
Unique ID of this webhook delivery.
16 17 18 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 16 def id @id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil event = hash.key?('event') ? hash['event'] : nil created_on = if hash.key?('created_on') (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on']) end # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. WebhookCallbackEnvelope.new(id: id, event: event, created_on: created_on, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['event'] = 'event' @_hash['created_on'] = 'created_on' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 36 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
92 93 94 95 96 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 92 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, event: #{@event.inspect}, created_on:"\ " #{@created_on.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_created_on ⇒ Object
80 81 82 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 80 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
85 86 87 88 89 |
# File 'lib/univapay_client_sdk/models/webhook_callback_envelope.rb', line 85 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, event: #{@event}, created_on: #{@created_on},"\ " additional_properties: #{@additional_properties}>" end |