Class: UnivapayClientSdk::Webhook
- Defined in:
- lib/univapay_client_sdk/models/webhook.rb
Overview
Represents a webhook subscription. Webhooks send event notifications to a specified URL when triggered by payment events.
Instance Attribute Summary collapse
-
#active ⇒ TrueClass | FalseClass
Whether this webhook is currently active and receiving events.
-
#auth_token ⇒ String
Optional bearer token included in the
Authorizationheader of webhook requests. -
#created_on ⇒ DateTime
Timestamp when the webhook was created.
-
#id ⇒ UUID | String
Unique identifier for the webhook.
-
#is_integration ⇒ TrueClass | FalseClass
Admin-only flag.
-
#merchant_id ⇒ UUID | String
ID of the merchant this webhook belongs to.
-
#store_id ⇒ UUID | String
ID of the store this webhook belongs to (null for merchant-level webhooks).
-
#triggers ⇒ Array[WebhookTrigger]
List of event types that trigger this webhook.
-
#updated_on ⇒ DateTime
Timestamp when the webhook was last updated.
-
#url ⇒ String
The endpoint URL that receives webhook POST requests.
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, store_id: SKIP, merchant_id: SKIP, triggers: SKIP, url: SKIP, auth_token: SKIP, active: SKIP, is_integration: SKIP, created_on: SKIP, updated_on: SKIP, additional_properties: nil) ⇒ Webhook
constructor
A new instance of Webhook.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_on ⇒ Object
- #to_custom_updated_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, store_id: SKIP, merchant_id: SKIP, triggers: SKIP, url: SKIP, auth_token: SKIP, active: SKIP, is_integration: SKIP, created_on: SKIP, updated_on: SKIP, additional_properties: nil) ⇒ Webhook
Returns a new instance of Webhook.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 98 def initialize(id: SKIP, store_id: SKIP, merchant_id: SKIP, triggers: SKIP, url: SKIP, auth_token: SKIP, active: SKIP, is_integration: SKIP, created_on: SKIP, updated_on: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @store_id = store_id unless store_id == SKIP @merchant_id = merchant_id unless merchant_id == SKIP @triggers = triggers unless triggers == SKIP @url = url unless url == SKIP @auth_token = auth_token unless auth_token == SKIP @active = active unless active == SKIP @is_integration = is_integration unless is_integration == SKIP @created_on = created_on unless created_on == SKIP @updated_on = updated_on unless updated_on == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#active ⇒ TrueClass | FalseClass
Whether this webhook is currently active and receiving events.
42 43 44 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 42 def active @active end |
#auth_token ⇒ String
Optional bearer token included in the Authorization header of webhook
requests. Used to authenticate the webhook receiver.
38 39 40 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 38 def auth_token @auth_token end |
#created_on ⇒ DateTime
Timestamp when the webhook was created.
51 52 53 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 51 def created_on @created_on end |
#id ⇒ UUID | String
Unique identifier for the webhook.
16 17 18 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 16 def id @id end |
#is_integration ⇒ TrueClass | FalseClass
Admin-only flag. Indicates this webhook is used for platform integration purposes. Not settable by merchants.
47 48 49 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 47 def is_integration @is_integration end |
#merchant_id ⇒ UUID | String
ID of the merchant this webhook belongs to.
25 26 27 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 25 def merchant_id @merchant_id end |
#store_id ⇒ UUID | String
ID of the store this webhook belongs to (null for merchant-level webhooks).
21 22 23 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 21 def store_id @store_id end |
#triggers ⇒ Array[WebhookTrigger]
List of event types that trigger this webhook.
29 30 31 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 29 def triggers @triggers end |
#updated_on ⇒ DateTime
Timestamp when the webhook was last updated.
55 56 57 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 55 def updated_on @updated_on end |
#url ⇒ String
The endpoint URL that receives webhook POST requests.
33 34 35 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 33 def url @url end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 119 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP store_id = hash.key?('store_id') ? hash['store_id'] : SKIP merchant_id = hash.key?('merchant_id') ? hash['merchant_id'] : SKIP triggers = hash.key?('triggers') ? hash['triggers'] : SKIP url = hash.key?('url') ? hash['url'] : SKIP auth_token = hash.key?('auth_token') ? hash['auth_token'] : SKIP active = hash.key?('active') ? hash['active'] : SKIP is_integration = hash.key?('is_integration') ? hash['is_integration'] : SKIP created_on = if hash.key?('created_on') (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on']) else SKIP end updated_on = if hash.key?('updated_on') (DateTimeHelper.from_rfc3339(hash['updated_on']) if hash['updated_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. Webhook.new(id: id, store_id: store_id, merchant_id: merchant_id, triggers: triggers, url: url, auth_token: auth_token, active: active, is_integration: is_integration, created_on: created_on, updated_on: updated_on, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 58 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['store_id'] = 'store_id' @_hash['merchant_id'] = 'merchant_id' @_hash['triggers'] = 'triggers' @_hash['url'] = 'url' @_hash['auth_token'] = 'auth_token' @_hash['active'] = 'active' @_hash['is_integration'] = 'is_integration' @_hash['created_on'] = 'created_on' @_hash['updated_on'] = 'updated_on' @_hash end |
.nullables ⇒ Object
An array for nullable fields
90 91 92 93 94 95 96 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 90 def self.nullables %w[ store_id merchant_id auth_token ] end |
.optionals ⇒ Object
An array for optional fields
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 74 def self.optionals %w[ id store_id merchant_id triggers url auth_token active is_integration created_on updated_on ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
182 183 184 185 186 187 188 189 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 182 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, store_id: #{@store_id.inspect}, merchant_id:"\ " #{@merchant_id.inspect}, triggers: #{@triggers.inspect}, url: #{@url.inspect}, auth_token:"\ " #{@auth_token.inspect}, active: #{@active.inspect}, is_integration:"\ " #{@is_integration.inspect}, created_on: #{@created_on.inspect}, updated_on:"\ " #{@updated_on.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_created_on ⇒ Object
164 165 166 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 164 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_custom_updated_on ⇒ Object
168 169 170 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 168 def to_custom_updated_on DateTimeHelper.to_rfc3339(updated_on) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
173 174 175 176 177 178 179 |
# File 'lib/univapay_client_sdk/models/webhook.rb', line 173 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, store_id: #{@store_id}, merchant_id: #{@merchant_id}, triggers:"\ " #{@triggers}, url: #{@url}, auth_token: #{@auth_token}, active: #{@active},"\ " is_integration: #{@is_integration}, created_on: #{@created_on}, updated_on:"\ " #{@updated_on}, additional_properties: #{@additional_properties}>" end |