Class: UnivapayClientSdk::BankTransferStatusWebhookCallback

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb

Overview

Webhook envelope whose data payload is a BankTransferStatusData resource.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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:, event: SKIP, data: SKIP, additional_properties: nil) ⇒ BankTransferStatusWebhookCallback

Returns a new instance of BankTransferStatusWebhookCallback.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 54

def initialize(id:, created_on:, event: SKIP, data: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @event = event unless event == SKIP
  @id = id
  @created_on = created_on
  @data = data unless data == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_onDateTime

Timestamp when the event was fired.

Returns:

  • (DateTime)


24
25
26
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 24

def created_on
  @created_on
end

#dataBankTransferStatusData

Data payload for bank_transfer_status_updated webhook events. Contains the bank transfer extension fields inlined alongside amount and metadata.



29
30
31
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 29

def data
  @data
end

#eventBankTransferEvent

Event type discriminator — always bank_transfer_status_updated for this callback.

Returns:



16
17
18
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 16

def event
  @event
end

#idUUID | String

Unique ID of this webhook delivery.

Returns:

  • (UUID | String)


20
21
22
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 20

def id
  @id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 67

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
  event = hash.key?('event') ? hash['event'] : SKIP
  data = BankTransferStatusData.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.
  BankTransferStatusWebhookCallback.new(id: id,
                                        created_on: created_on,
                                        event: event,
                                        data: data,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['event'] = 'event'
  @_hash['id'] = 'id'
  @_hash['created_on'] = 'created_on'
  @_hash['data'] = 'data'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 42

def self.optionals
  %w[
    event
    data
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 99

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.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['created_on'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



127
128
129
130
131
132
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 127

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} event: #{@event.inspect}, id: #{@id.inspect}, created_on:"\
  " #{@created_on.inspect}, data: #{@data.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_created_onObject



93
94
95
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 93

def to_custom_created_on
  DateTimeHelper.to_rfc3339(created_on)
end

#to_sObject

Provides a human-readable string representation of the object.



120
121
122
123
124
# File 'lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb', line 120

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} event: #{@event}, id: #{@id}, created_on: #{@created_on}, data: #{@data},"\
  " additional_properties: #{@additional_properties}>"
end