Class: ThePlaidApi::SignalPersonName

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

Overview

The user’s legal name

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(prefix: SKIP, given_name: SKIP, middle_name: SKIP, family_name: SKIP, suffix: SKIP, additional_properties: nil) ⇒ SignalPersonName

Returns a new instance of SignalPersonName.



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/signal_person_name.rb', line 66

def initialize(prefix: SKIP, given_name: SKIP, middle_name: SKIP,
               family_name: SKIP, suffix: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @prefix = prefix unless prefix == SKIP
  @given_name = given_name unless given_name == SKIP
  @middle_name = middle_name unless middle_name == SKIP
  @family_name = family_name unless family_name == SKIP
  @suffix = suffix unless suffix == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#family_nameString

The user’s family name / surname

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/signal_person_name.rb', line 27

def family_name
  @family_name
end

#given_nameString

The user’s given name. If the user has a one-word name, it should be provided in this field.

Returns:

  • (String)


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

def given_name
  @given_name
end

#middle_nameString

The user’s middle name

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/signal_person_name.rb', line 23

def middle_name
  @middle_name
end

#prefixString

The user’s name prefix (e.g. “Mr.”)

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/signal_person_name.rb', line 14

def prefix
  @prefix
end

#suffixString

The user’s name suffix (e.g. “II”)

Returns:

  • (String)


31
32
33
# File 'lib/the_plaid_api/models/signal_person_name.rb', line 31

def suffix
  @suffix
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/the_plaid_api/models/signal_person_name.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  prefix = hash.key?('prefix') ? hash['prefix'] : SKIP
  given_name = hash.key?('given_name') ? hash['given_name'] : SKIP
  middle_name = hash.key?('middle_name') ? hash['middle_name'] : SKIP
  family_name = hash.key?('family_name') ? hash['family_name'] : SKIP
  suffix = hash.key?('suffix') ? hash['suffix'] : 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.
  SignalPersonName.new(prefix: prefix,
                       given_name: given_name,
                       middle_name: middle_name,
                       family_name: family_name,
                       suffix: suffix,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['prefix'] = 'prefix'
  @_hash['given_name'] = 'given_name'
  @_hash['middle_name'] = 'middle_name'
  @_hash['family_name'] = 'family_name'
  @_hash['suffix'] = 'suffix'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
59
60
61
62
63
64
# File 'lib/the_plaid_api/models/signal_person_name.rb', line 56

def self.nullables
  %w[
    prefix
    given_name
    middle_name
    family_name
    suffix
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    prefix
    given_name
    middle_name
    family_name
    suffix
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
120
# File 'lib/the_plaid_api/models/signal_person_name.rb', line 115

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} prefix: #{@prefix.inspect}, given_name: #{@given_name.inspect},"\
  " middle_name: #{@middle_name.inspect}, family_name: #{@family_name.inspect}, suffix:"\
  " #{@suffix.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
# File 'lib/the_plaid_api/models/signal_person_name.rb', line 107

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} prefix: #{@prefix}, given_name: #{@given_name}, middle_name:"\
  " #{@middle_name}, family_name: #{@family_name}, suffix: #{@suffix}, additional_properties:"\
  " #{@additional_properties}>"
end