Class: ThePlaidApi::SignalUser

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

Overview

Details about the end user initiating the transaction (i.e., the account holder). These fields are optional, but strongly recommended to increase the accuracy of results when using Signal Transaction Scores. When using a Balance-only ruleset, if the Signal Addendum has been signed, these fields are ignored; if the Addendum has not been signed, using these fields will result in an error.

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(name: SKIP, phone_number: SKIP, email_address: SKIP, address: SKIP, additional_properties: nil) ⇒ SignalUser

Returns a new instance of SignalUser.



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/the_plaid_api/models/signal_user.rb', line 64

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

  @name = name unless name == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @email_address = email_address unless email_address == SKIP
  @address = address unless address == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressAddressData2

Data about the components comprising an address.

Returns:



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

def address
  @address
end

#email_addressString

The user’s email address.

Returns:

  • (String)


28
29
30
# File 'lib/the_plaid_api/models/signal_user.rb', line 28

def email_address
  @email_address
end

#nameSignalPersonName

The user’s legal name

Returns:



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

def name
  @name
end

#phone_numberString

The user’s phone number, in E.164 format: {countrycode}{number}. For example: “14151234567”

Returns:

  • (String)


24
25
26
# File 'lib/the_plaid_api/models/signal_user.rb', line 24

def phone_number
  @phone_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/the_plaid_api/models/signal_user.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = SignalPersonName.from_hash(hash['name']) if hash['name']
  phone_number = hash.key?('phone_number') ? hash['phone_number'] : SKIP
  email_address = hash.key?('email_address') ? hash['email_address'] : SKIP
  address = AddressData2.from_hash(hash['address']) if hash['address']

  # 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.
  SignalUser.new(name: name,
                 phone_number: phone_number,
                 email_address: email_address,
                 address: address,
                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
# File 'lib/the_plaid_api/models/signal_user.rb', line 35

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

.nullablesObject

An array for nullable fields



55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/signal_user.rb', line 55

def self.nullables
  %w[
    name
    phone_number
    email_address
    address
  ]
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/signal_user.rb', line 45

def self.optionals
  %w[
    name
    phone_number
    email_address
    address
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
115
# File 'lib/the_plaid_api/models/signal_user.rb', line 110

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

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
107
# File 'lib/the_plaid_api/models/signal_user.rb', line 102

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