Class: ThePlaidApi::OwnerOverride

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

Overview

Data about the owner or owners of an account. Any fields not specified will be filled in with default Sandbox information.

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(names:, phone_numbers:, emails:, addresses:, additional_properties: nil) ⇒ OwnerOverride

Returns a new instance of OwnerOverride.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/owner_override.rb', line 52

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

#addressesArray[Address]

Data about the various addresses associated with the account.

Returns:



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

def addresses
  @addresses
end

#emailsArray[Email]

A list of email addresses associated with the account.

Returns:



26
27
28
# File 'lib/the_plaid_api/models/owner_override.rb', line 26

def emails
  @emails
end

#namesArray[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. Note that the same name data will be used for all accounts associated with an Item.

Returns:

  • (Array[String])


18
19
20
# File 'lib/the_plaid_api/models/owner_override.rb', line 18

def names
  @names
end

#phone_numbersArray[PhoneNumber]

A list of phone numbers associated with the account.

Returns:



22
23
24
# File 'lib/the_plaid_api/models/owner_override.rb', line 22

def phone_numbers
  @phone_numbers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/the_plaid_api/models/owner_override.rb', line 65

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.
  OwnerOverride.new(names: names,
                    phone_numbers: phone_numbers,
                    emails: emails,
                    addresses: addresses,
                    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/owner_override.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['names'] = 'names'
  @_hash['phone_numbers'] = 'phone_numbers'
  @_hash['emails'] = 'emails'
  @_hash['addresses'] = 'addresses'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/the_plaid_api/models/owner_override.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
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/owner_override.rb', line 124

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_sObject

Provides a human-readable string representation of the object.



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

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