Class: UnivapayClientSdk::WebhookEvent
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::WebhookEvent
- Defined in:
- lib/univapay_client_sdk/models/webhook_event.rb
Overview
Represents a single delivery attempt of a webhook event, including the payload sent and the delivery outcome.
Instance Attribute Summary collapse
-
#created_on ⇒ DateTime
Timestamp when the event was created.
-
#data ⇒ Object
Domain object payload for webhook deliveries.
-
#error_message ⇒ String
Error message if delivery failed.
-
#event ⇒ WebhookTrigger
Event type that triggers a webhook notification.
-
#fired_on ⇒ DateTime
Timestamp when the webhook was dispatched.
-
#id ⇒ UUID | String
Unique identifier for the webhook event.
-
#successful ⇒ TrueClass | FalseClass
Whether the webhook delivery was acknowledged (HTTP 2xx).
-
#webhook_id ⇒ UUID | String
ID of the parent webhook.
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: SKIP, webhook_id: SKIP, event: SKIP, data: SKIP, successful: SKIP, fired_on: SKIP, error_message: SKIP, created_on: SKIP, additional_properties: nil) ⇒ WebhookEvent
constructor
A new instance of WebhookEvent.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_on ⇒ Object
- #to_custom_fired_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: SKIP, webhook_id: SKIP, event: SKIP, data: SKIP, successful: SKIP, fired_on: SKIP, error_message: SKIP, created_on: SKIP, additional_properties: nil) ⇒ WebhookEvent
Returns a new instance of WebhookEvent.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 83 def initialize(id: SKIP, webhook_id: SKIP, event: SKIP, data: SKIP, successful: SKIP, fired_on: SKIP, error_message: SKIP, created_on: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @webhook_id = webhook_id unless webhook_id == SKIP @event = event unless event == SKIP @data = data unless data == SKIP @successful = successful unless successful == SKIP @fired_on = fired_on unless fired_on == SKIP @error_message = unless == SKIP @created_on = created_on unless created_on == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#created_on ⇒ DateTime
Timestamp when the event was created.
46 47 48 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 46 def created_on @created_on end |
#data ⇒ Object
Domain object payload for webhook deliveries. The actual structure depends on the event type — see each webhook callback schema for the specific payload shape.
30 31 32 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 30 def data @data end |
#error_message ⇒ String
Error message if delivery failed.
42 43 44 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 42 def @error_message end |
#event ⇒ WebhookTrigger
Event type that triggers a webhook notification.
24 25 26 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 24 def event @event end |
#fired_on ⇒ DateTime
Timestamp when the webhook was dispatched.
38 39 40 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 38 def fired_on @fired_on end |
#id ⇒ UUID | String
Unique identifier for the webhook event.
16 17 18 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 16 def id @id end |
#successful ⇒ TrueClass | FalseClass
Whether the webhook delivery was acknowledged (HTTP 2xx).
34 35 36 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 34 def successful @successful end |
#webhook_id ⇒ UUID | String
ID of the parent webhook.
20 21 22 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 20 def webhook_id @webhook_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP webhook_id = hash.key?('webhook_id') ? hash['webhook_id'] : SKIP event = hash.key?('event') ? hash['event'] : SKIP data = hash.key?('data') ? hash['data'] : SKIP successful = hash.key?('successful') ? hash['successful'] : SKIP fired_on = if hash.key?('fired_on') (DateTimeHelper.from_rfc3339(hash['fired_on']) if hash['fired_on']) else SKIP end = hash.key?('error_message') ? hash['error_message'] : SKIP created_on = if hash.key?('created_on') (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on']) else SKIP 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. WebhookEvent.new(id: id, webhook_id: webhook_id, event: event, data: data, successful: successful, fired_on: fired_on, error_message: , created_on: created_on, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['webhook_id'] = 'webhook_id' @_hash['event'] = 'event' @_hash['data'] = 'data' @_hash['successful'] = 'successful' @_hash['fired_on'] = 'fired_on' @_hash['error_message'] = 'error_message' @_hash['created_on'] = 'created_on' @_hash end |
.nullables ⇒ Object
An array for nullable fields
77 78 79 80 81 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 77 def self.nullables %w[ error_message ] end |
.optionals ⇒ Object
An array for optional fields
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 63 def self.optionals %w[ id webhook_id event data successful fired_on error_message created_on ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
158 159 160 161 162 163 164 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 158 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, webhook_id: #{@webhook_id.inspect}, event:"\ " #{@event.inspect}, data: #{@data.inspect}, successful: #{@successful.inspect}, fired_on:"\ " #{@fired_on.inspect}, error_message: #{@error_message.inspect}, created_on:"\ " #{@created_on.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_created_on ⇒ Object
145 146 147 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 145 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_custom_fired_on ⇒ Object
141 142 143 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 141 def to_custom_fired_on DateTimeHelper.to_rfc3339(fired_on) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
150 151 152 153 154 155 |
# File 'lib/univapay_client_sdk/models/webhook_event.rb', line 150 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, webhook_id: #{@webhook_id}, event: #{@event}, data: #{@data},"\ " successful: #{@successful}, fired_on: #{@fired_on}, error_message: #{@error_message},"\ " created_on: #{@created_on}, additional_properties: #{@additional_properties}>" end |