Class: Plaid::SignalUser

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

Overview

Details about the end user initiating the transaction (i.e., the account holder).

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.



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/plaid/models/signal_user.rb', line 58

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

#addressAddressData1

Data about the components comprising an address.

Returns:



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

def address
  @address
end

#email_addressString

The user’s email address.

Returns:

  • (String)


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

def email_address
  @email_address
end

#nameSignalPersonName

The user’s legal name

Returns:



15
16
17
# File 'lib/plaid/models/signal_user.rb', line 15

def name
  @name
end

#phone_numberString

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

Returns:

  • (String)


20
21
22
# File 'lib/plaid/models/signal_user.rb', line 20

def phone_number
  @phone_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/plaid/models/signal_user.rb', line 71

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 = AddressData1.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.



31
32
33
34
35
36
37
38
# File 'lib/plaid/models/signal_user.rb', line 31

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



51
52
53
54
55
56
# File 'lib/plaid/models/signal_user.rb', line 51

def self.nullables
  %w[
    phone_number
    email_address
  ]
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
47
48
# File 'lib/plaid/models/signal_user.rb', line 41

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
109
# File 'lib/plaid/models/signal_user.rb', line 104

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.



96
97
98
99
100
101
# File 'lib/plaid/models/signal_user.rb', line 96

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