Class: ThePlaidApi::Owner
- Defined in:
- lib/the_plaid_api/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.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/the_plaid_api/models/owner.rb', line 60 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.
38 39 40 |
# File 'lib/the_plaid_api/models/owner.rb', line 38 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.
32 33 34 |
# File 'lib/the_plaid_api/models/owner.rb', line 32 def emails @emails end |
#names ⇒ Array[String]
A list of names associated with the account by the financial institution. 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.
20 21 22 |
# File 'lib/the_plaid_api/models/owner.rb', line 20 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.
26 27 28 |
# File 'lib/the_plaid_api/models/owner.rb', line 26 def phone_numbers @phone_numbers end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
73 74 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 |
# File 'lib/the_plaid_api/models/owner.rb', line 73 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.
41 42 43 44 45 46 47 48 |
# File 'lib/the_plaid_api/models/owner.rb', line 41 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
56 57 58 |
# File 'lib/the_plaid_api/models/owner.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 |
# File 'lib/the_plaid_api/models/owner.rb', line 51 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
132 133 134 135 136 137 |
# File 'lib/the_plaid_api/models/owner.rb', line 132 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.
125 126 127 128 129 |
# File 'lib/the_plaid_api/models/owner.rb', line 125 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 |