Class: ThePlaidApi::OriginatingFundSource

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

Overview

The original source of the funds. This field is required by local regulation for certain businesses (e.g. money remittance) to send payouts to recipients in the EU and UK.

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(full_name:, address:, account_number:, bic:, additional_properties: nil) ⇒ OriginatingFundSource

Returns a new instance of OriginatingFundSource.



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

def initialize(full_name:, address:, account_number:, bic:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @full_name = full_name
  @address = address
  @account_number = 
  @bic = bic
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_numberString

The account number from which the funds are sourced.

Returns:

  • (String)


25
26
27
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 25

def 
  @account_number
end

#addressPaymentInitiationAddress

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



21
22
23
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 21

def address
  @address
end

#bicString

The Business Identifier Code, also known as SWIFT code, for this bank account.

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 30

def bic
  @bic
end

#full_nameString

The full name associated with the source of the funds.

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 16

def full_name
  @full_name
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
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  full_name = hash.key?('full_name') ? hash['full_name'] : nil
  address = PaymentInitiationAddress.from_hash(hash['address']) if hash['address']
   =
    hash.key?('account_number') ? hash['account_number'] : nil
  bic = hash.key?('bic') ? hash['bic'] : nil

  # 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.
  OriginatingFundSource.new(full_name: full_name,
                            address: address,
                            account_number: ,
                            bic: bic,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['full_name'] = 'full_name'
  @_hash['address'] = 'address'
  @_hash['account_number'] = 'account_number'
  @_hash['bic'] = 'bic'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
51
52
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 48

def self.nullables
  %w[
    address
  ]
end

.optionalsObject

An array for optional fields



43
44
45
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 43

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
105
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 100

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} full_name: #{@full_name.inspect}, address: #{@address.inspect},"\
  " account_number: #{@account_number.inspect}, bic: #{@bic.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
# File 'lib/the_plaid_api/models/originating_fund_source.rb', line 93

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} full_name: #{@full_name}, address: #{@address}, account_number:"\
  " #{@account_number}, bic: #{@bic}, additional_properties: #{@additional_properties}>"
end