Class: Plaid::DepositSwitchTargetUser

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

Overview

DepositSwitchTargetUser Model.

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(given_name:, family_name:, phone:, email:, address: SKIP, tax_payer_id: SKIP, additional_properties: nil) ⇒ DepositSwitchTargetUser

Returns a new instance of DepositSwitchTargetUser.



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 62

def initialize(given_name:, family_name:, phone:, email:, address: SKIP,
               tax_payer_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @given_name = given_name
  @family_name = family_name
  @phone = phone
  @email = email
  @address = address unless address == SKIP
  @tax_payer_id = tax_payer_id unless tax_payer_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressDepositSwitchAddressData

The user’s address.



31
32
33
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 31

def address
  @address
end

#emailString

The email address of the user.

Returns:

  • (String)


27
28
29
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 27

def email
  @email
end

#family_nameString

The family name (last name) of the user.

Returns:

  • (String)


18
19
20
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 18

def family_name
  @family_name
end

#given_nameString

The given name (first name) of the user.

Returns:

  • (String)


14
15
16
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 14

def given_name
  @given_name
end

#phoneString

The phone number of the user. The endpoint can accept a variety of phone number formats, including E.164.

Returns:

  • (String)


23
24
25
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 23

def phone
  @phone
end

#tax_payer_idString

The taxpayer ID of the user, generally their SSN, EIN, or TIN.

Returns:

  • (String)


35
36
37
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 35

def tax_payer_id
  @tax_payer_id
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
100
101
102
103
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  given_name = hash.key?('given_name') ? hash['given_name'] : nil
  family_name = hash.key?('family_name') ? hash['family_name'] : nil
  phone = hash.key?('phone') ? hash['phone'] : nil
  email = hash.key?('email') ? hash['email'] : nil
  address = DepositSwitchAddressData.from_hash(hash['address']) if hash['address']
  tax_payer_id = hash.key?('tax_payer_id') ? hash['tax_payer_id'] : SKIP

  # 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.
  DepositSwitchTargetUser.new(given_name: given_name,
                              family_name: family_name,
                              phone: phone,
                              email: email,
                              address: address,
                              tax_payer_id: tax_payer_id,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['given_name'] = 'given_name'
  @_hash['family_name'] = 'family_name'
  @_hash['phone'] = 'phone'
  @_hash['email'] = 'email'
  @_hash['address'] = 'address'
  @_hash['tax_payer_id'] = 'tax_payer_id'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    address
    tax_payer_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



114
115
116
117
118
119
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 114

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} given_name: #{@given_name.inspect}, family_name: #{@family_name.inspect},"\
  " phone: #{@phone.inspect}, email: #{@email.inspect}, address: #{@address.inspect},"\
  " tax_payer_id: #{@tax_payer_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



106
107
108
109
110
111
# File 'lib/plaid/models/deposit_switch_target_user.rb', line 106

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} given_name: #{@given_name}, family_name: #{@family_name}, phone: #{@phone},"\
  " email: #{@email}, address: #{@address}, tax_payer_id: #{@tax_payer_id},"\
  " additional_properties: #{@additional_properties}>"
end