Class: Plaid::Owner
- Defined in:
- lib/plaid/models/owner.rb
Overview
Data returned from the financial institution about the owner or owners of an account. Only the ‘names` array must be non-empty.
Instance Attribute Summary collapse
-
#addresses ⇒ Array[Address]
Data about the various addresses associated with the account by the financial institution.
-
#emails ⇒ Array[Email]
A list of email addresses associated with the account by the financial institution.
-
#names ⇒ Array[String]
A list of names associated with the account by the financial institution.
-
#phone_numbers ⇒ Array[PhoneNumber]
A list of phone numbers associated with the account by the financial institution.
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(names:, phone_numbers:, emails:, addresses:, additional_properties: nil) ⇒ Owner
constructor
A new instance of Owner.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(names:, phone_numbers:, emails:, addresses:, additional_properties: nil) ⇒ Owner
Returns a new instance of Owner.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/plaid/models/owner.rb', line 62 def initialize(names:, phone_numbers:, emails:, addresses:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @names = names @phone_numbers = phone_numbers @emails = emails @addresses = addresses @additional_properties = additional_properties end |
Instance Attribute Details
#addresses ⇒ Array[Address]
Data about the various addresses associated with the account by the financial institution. May be an empty array if no relevant information is returned from the financial institution.
40 41 42 |
# File 'lib/plaid/models/owner.rb', line 40 def addresses @addresses end |
#emails ⇒ Array[Email]
A list of email addresses associated with the account by the financial institution. May be an empty array if no relevant information is returned from the financial institution.
34 35 36 |
# File 'lib/plaid/models/owner.rb', line 34 def emails @emails end |
#names ⇒ Array[String]
A list of names associated with the account by the financial institution. These should always be the names of individuals, even for business accounts. If the name of a business is reported, please contact Plaid Support. In the case of a joint account, Plaid will make a best effort to report the names of all account holders. If an Item contains multiple accounts with different owner names, some institutions will report all names associated with the Item in each account’s ‘names` array.
22 23 24 |
# File 'lib/plaid/models/owner.rb', line 22 def names @names end |
#phone_numbers ⇒ Array[PhoneNumber]
A list of phone numbers associated with the account by the financial institution. May be an empty array if no relevant information is returned from the financial institution.
28 29 30 |
# File 'lib/plaid/models/owner.rb', line 28 def phone_numbers @phone_numbers end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
75 76 77 78 79 80 81 82 83 84 85 86 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 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/plaid/models/owner.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. names = hash.key?('names') ? hash['names'] : nil # Parameter is an array, so we need to iterate through it phone_numbers = nil unless hash['phone_numbers'].nil? phone_numbers = [] hash['phone_numbers'].each do |structure| phone_numbers << (PhoneNumber.from_hash(structure) if structure) end end phone_numbers = nil unless hash.key?('phone_numbers') # Parameter is an array, so we need to iterate through it emails = nil unless hash['emails'].nil? emails = [] hash['emails'].each do |structure| emails << (Email.from_hash(structure) if structure) end end emails = nil unless hash.key?('emails') # Parameter is an array, so we need to iterate through it addresses = nil unless hash['addresses'].nil? addresses = [] hash['addresses'].each do |structure| addresses << (Address.from_hash(structure) if structure) end end addresses = nil unless hash.key?('addresses') # 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. Owner.new(names: names, phone_numbers: phone_numbers, emails: emails, addresses: addresses, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
43 44 45 46 47 48 49 50 |
# File 'lib/plaid/models/owner.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['names'] = 'names' @_hash['phone_numbers'] = 'phone_numbers' @_hash['emails'] = 'emails' @_hash['addresses'] = 'addresses' @_hash end |
.nullables ⇒ Object
An array for nullable fields
58 59 60 |
# File 'lib/plaid/models/owner.rb', line 58 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
53 54 55 |
# File 'lib/plaid/models/owner.rb', line 53 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
134 135 136 137 138 139 |
# File 'lib/plaid/models/owner.rb', line 134 def inspect class_name = self.class.name.split('::').last "<#{class_name} names: #{@names.inspect}, phone_numbers: #{@phone_numbers.inspect}, emails:"\ " #{@emails.inspect}, addresses: #{@addresses.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
127 128 129 130 131 |
# File 'lib/plaid/models/owner.rb', line 127 def to_s class_name = self.class.name.split('::').last "<#{class_name} names: #{@names}, phone_numbers: #{@phone_numbers}, emails: #{@emails},"\ " addresses: #{@addresses}, additional_properties: #{@additional_properties}>" end |