Class: UnivapayClientSdk::SubscriptionCompletedWebhookCallback
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::SubscriptionCompletedWebhookCallback
- Defined in:
- lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb
Overview
Webhook envelope for the subscription_completed event.
Instance Attribute Summary collapse
-
#created_on ⇒ DateTime
Timestamp when the event was fired.
-
#data ⇒ Subscription
The Subscription object represents a recurring payment schedule.
-
#event ⇒ String
readonly
Event type discriminator — always
subscription_completedfor this callback. -
#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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(id:, created_on:, data: SKIP, additional_properties: nil) ⇒ SubscriptionCompletedWebhookCallback
constructor
A new instance of SubscriptionCompletedWebhookCallback.
-
#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:, created_on:, data: SKIP, additional_properties: nil) ⇒ SubscriptionCompletedWebhookCallback
Returns a new instance of SubscriptionCompletedWebhookCallback.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 52 def initialize(id:, created_on:, data: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id @event = 'subscription_completed' @data = data unless data == SKIP @created_on = created_on @additional_properties = additional_properties end |
Instance Attribute Details
#created_on ⇒ DateTime
Timestamp when the event was fired.
28 29 30 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 28 def created_on @created_on end |
#data ⇒ Subscription
The Subscription object represents a recurring payment schedule.
24 25 26 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 24 def data @data end |
#event ⇒ String (readonly)
Event type discriminator — always subscription_completed for this
callback.
20 21 22 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 20 def event @event end |
#id ⇒ UUID | String
Unique ID of this webhook delivery.
15 16 17 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 15 def id @id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil created_on = if hash.key?('created_on') (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on']) end data = Subscription.from_hash(hash['data']) if hash['data'] # 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. SubscriptionCompletedWebhookCallback.new(id: id, created_on: created_on, data: data, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['event'] = 'event' @_hash['data'] = 'data' @_hash['created_on'] = 'created_on' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 48 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 41 def self.optionals %w[ data ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
94 95 96 97 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/subscription_completed_webhook_callback.rb', line 94 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.event, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.created_on, ->(val) { val.instance_of? DateTime }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['event'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['created_on'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
126 127 128 129 130 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 126 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, event: #{@event.inspect}, data: #{@data.inspect},"\ " created_on: #{@created_on.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_created_on ⇒ Object
88 89 90 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 88 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
119 120 121 122 123 |
# File 'lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb', line 119 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, event: #{@event}, data: #{@data}, created_on: #{@created_on},"\ " additional_properties: #{@additional_properties}>" end |