Class: ThePlaidApi::BeaconUserData

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

Overview

A Beacon User’s data and resulting analysis when checked against duplicate records and the Beacon Fraud Network.

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(date_of_birth:, name:, address:, email_address:, phone_number:, id_number:, ip_address:, depository_accounts:, additional_properties: nil) ⇒ BeaconUserData

Returns a new instance of BeaconUserData.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/the_plaid_api/models/beacon_user_data.rb', line 79

def initialize(date_of_birth:, name:, address:, email_address:,
               phone_number:, id_number:, ip_address:, depository_accounts:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @date_of_birth = date_of_birth
  @name = name
  @address = address
  @email_address = email_address
  @phone_number = phone_number
  @id_number = id_number
  @ip_address = ip_address
  @depository_accounts = depository_accounts
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressBeaconUserAddress

Even if an address has been collected, some fields may be null depending on the region’s addressing system. For example: Addresses from the United Kingdom will not include a region Addresses from Hong Kong will not include a postal code

Returns:



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

def address
  @address
end

#date_of_birthDate

A date in the format YYYY-MM-DD (RFC 3339 Section 5.6).

Returns:

  • (Date)


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

def date_of_birth
  @date_of_birth
end

#depository_accountsArray[BeaconUserDepositoryAccount]

An IPv4 or IPV6 address.

Returns:



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

def depository_accounts
  @depository_accounts
end

#email_addressString

A valid email address. Must not have leading or trailing spaces and address must be RFC compliant. For more information, see [RFC 3696](datatracker.ietf.org/doc/html/rfc3696).

Returns:

  • (String)


32
33
34
# File 'lib/the_plaid_api/models/beacon_user_data.rb', line 32

def email_address
  @email_address
end

#id_numberBeaconUserIdNumber

The ID number associated with a Beacon User.

Returns:



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

def id_number
  @id_number
end

#ip_addressString

An IPv4 or IPV6 address.

Returns:

  • (String)


44
45
46
# File 'lib/the_plaid_api/models/beacon_user_data.rb', line 44

def ip_address
  @ip_address
end

#nameBeaconUserName

The full name for a given Beacon User.

Returns:



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

def name
  @name
end

#phone_numberString

A phone number in E.164 format.

Returns:

  • (String)


36
37
38
# File 'lib/the_plaid_api/models/beacon_user_data.rb', line 36

def phone_number
  @phone_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/the_plaid_api/models/beacon_user_data.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  date_of_birth = hash.key?('date_of_birth') ? hash['date_of_birth'] : nil
  name = BeaconUserName.from_hash(hash['name']) if hash['name']
  address = BeaconUserAddress.from_hash(hash['address']) if hash['address']
  email_address = hash.key?('email_address') ? hash['email_address'] : nil
  phone_number = hash.key?('phone_number') ? hash['phone_number'] : nil
  id_number = BeaconUserIdNumber.from_hash(hash['id_number']) if hash['id_number']
  ip_address = hash.key?('ip_address') ? hash['ip_address'] : nil
  # Parameter is an array, so we need to iterate through it
  depository_accounts = nil
  unless hash['depository_accounts'].nil?
    depository_accounts = []
    hash['depository_accounts'].each do |structure|
      depository_accounts << (BeaconUserDepositoryAccount.from_hash(structure) if structure)
    end
  end

  depository_accounts = nil unless hash.key?('depository_accounts')

  # 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.
  BeaconUserData.new(date_of_birth: date_of_birth,
                     name: name,
                     address: address,
                     email_address: email_address,
                     phone_number: phone_number,
                     id_number: id_number,
                     ip_address: ip_address,
                     depository_accounts: depository_accounts,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['date_of_birth'] = 'date_of_birth'
  @_hash['name'] = 'name'
  @_hash['address'] = 'address'
  @_hash['email_address'] = 'email_address'
  @_hash['phone_number'] = 'phone_number'
  @_hash['id_number'] = 'id_number'
  @_hash['ip_address'] = 'ip_address'
  @_hash['depository_accounts'] = 'depository_accounts'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/beacon_user_data.rb', line 70

def self.nullables
  %w[
    email_address
    phone_number
    id_number
    ip_address
  ]
end

.optionalsObject

An array for optional fields



65
66
67
# File 'lib/the_plaid_api/models/beacon_user_data.rb', line 65

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
155
# File 'lib/the_plaid_api/models/beacon_user_data.rb', line 148

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} date_of_birth: #{@date_of_birth.inspect}, name: #{@name.inspect}, address:"\
  " #{@address.inspect}, email_address: #{@email_address.inspect}, phone_number:"\
  " #{@phone_number.inspect}, id_number: #{@id_number.inspect}, ip_address:"\
  " #{@ip_address.inspect}, depository_accounts: #{@depository_accounts.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



139
140
141
142
143
144
145
# File 'lib/the_plaid_api/models/beacon_user_data.rb', line 139

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} date_of_birth: #{@date_of_birth}, name: #{@name}, address: #{@address},"\
  " email_address: #{@email_address}, phone_number: #{@phone_number}, id_number:"\
  " #{@id_number}, ip_address: #{@ip_address}, depository_accounts: #{@depository_accounts},"\
  " additional_properties: #{@additional_properties}>"
end