Class: ThePlaidApi::PaymentInitiationRecipientGetResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb

Overview

PaymentInitiationRecipientGetResponse defines the response schema for ‘/payment_initiation/recipient/get`

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(recipient_id:, name:, request_id:, address: SKIP, iban: SKIP, bacs: SKIP, additional_properties: nil) ⇒ PaymentInitiationRecipientGetResponse

Returns a new instance of PaymentInitiationRecipientGetResponse.



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 72

def initialize(recipient_id:, name:, request_id:, address: SKIP, iban: SKIP,
               bacs: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @recipient_id = recipient_id
  @name = name
  @address = address unless address == SKIP
  @iban = iban unless iban == SKIP
  @bacs = bacs unless bacs == SKIP
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressPaymentInitiationAddress

The optional address of the payment recipient’s bank account. Required by most institutions outside of the UK.



24
25
26
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 24

def address
  @address
end

#bacsRecipientBacsNullable

An object containing a BACS account number and sort code. If an IBAN is not provided or if this recipient needs to accept domestic GBP-denominated payments, BACS data is required.



34
35
36
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 34

def bacs
  @bacs
end

#ibanString

The International Bank Account Number (IBAN) for the recipient.

Returns:

  • (String)


28
29
30
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 28

def iban
  @iban
end

#nameString

The name of the recipient.

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 19

def name
  @name
end

#recipient_idString

The ID of the recipient.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 15

def recipient_id
  @recipient_id
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


40
41
42
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 40

def request_id
  @request_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  recipient_id = hash.key?('recipient_id') ? hash['recipient_id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  address = PaymentInitiationAddress.from_hash(hash['address']) if hash['address']
  iban = hash.key?('iban') ? hash['iban'] : SKIP
  bacs = RecipientBacsNullable.from_hash(hash['bacs']) if hash['bacs']

  # 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.
  PaymentInitiationRecipientGetResponse.new(recipient_id: recipient_id,
                                            name: name,
                                            request_id: request_id,
                                            address: address,
                                            iban: iban,
                                            bacs: bacs,
                                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['recipient_id'] = 'recipient_id'
  @_hash['name'] = 'name'
  @_hash['address'] = 'address'
  @_hash['iban'] = 'iban'
  @_hash['bacs'] = 'bacs'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
67
68
69
70
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 64

def self.nullables
  %w[
    address
    iban
    bacs
  ]
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 55

def self.optionals
  %w[
    address
    iban
    bacs
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



124
125
126
127
128
129
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 124

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} recipient_id: #{@recipient_id.inspect}, name: #{@name.inspect}, address:"\
  " #{@address.inspect}, iban: #{@iban.inspect}, bacs: #{@bacs.inspect}, request_id:"\
  " #{@request_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
121
# File 'lib/the_plaid_api/models/payment_initiation_recipient_get_response.rb', line 116

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} recipient_id: #{@recipient_id}, name: #{@name}, address: #{@address}, iban:"\
  " #{@iban}, bacs: #{@bacs}, request_id: #{@request_id}, additional_properties:"\
  " #{@additional_properties}>"
end