Class: Plaid::SignalUser
- 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
-
#address ⇒ AddressData1
Data about the components comprising an address.
-
#email_address ⇒ String
The user’s email address.
-
#name ⇒ SignalPersonName
The user’s legal name.
-
#phone_number ⇒ String
The user’s phone number, in E.164 format: +countrycodenumber.
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(name: SKIP, phone_number: SKIP, email_address: SKIP, address: SKIP, additional_properties: nil) ⇒ SignalUser
constructor
A new instance of SignalUser.
-
#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(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
#address ⇒ AddressData1
Data about the components comprising an address.
28 29 30 |
# File 'lib/plaid/models/signal_user.rb', line 28 def address @address end |
#email_address ⇒ String
The user’s email address.
24 25 26 |
# File 'lib/plaid/models/signal_user.rb', line 24 def email_address @email_address end |
#name ⇒ SignalPersonName
The user’s legal name
15 16 17 |
# File 'lib/plaid/models/signal_user.rb', line 15 def name @name end |
#phone_number ⇒ String
The user’s phone number, in E.164 format: {countrycode}{number}. For example: “14151234567”
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
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 |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |