Class: ThePlaidApi::EmploymentVerification

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

Overview

An object containing proof of employment data for an individual

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(status: SKIP, start_date: SKIP, end_date: SKIP, employer: SKIP, title: SKIP, platform_ids: SKIP, additional_properties: nil) ⇒ EmploymentVerification

Returns a new instance of EmploymentVerification.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/the_plaid_api/models/employment_verification.rb', line 70

def initialize(status: SKIP, start_date: SKIP, end_date: SKIP,
               employer: SKIP, title: SKIP, platform_ids: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @status = status unless status == SKIP
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @employer = employer unless employer == SKIP
  @title = title unless title == SKIP
  @platform_ids = platform_ids unless platform_ids == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#employerEmployerVerification

An object containing employer data.



26
27
28
# File 'lib/the_plaid_api/models/employment_verification.rb', line 26

def employer
  @employer
end

#end_dateDate

End of employment, if applicable. Provided in ISO 8601 format (YYY-MM-DD).

Returns:

  • (Date)


22
23
24
# File 'lib/the_plaid_api/models/employment_verification.rb', line 22

def end_date
  @end_date
end

#platform_idsPlatformIds

An object containing a set of ids related to an employee

Returns:



34
35
36
# File 'lib/the_plaid_api/models/employment_verification.rb', line 34

def platform_ids
  @platform_ids
end

#start_dateDate

Start of employment in ISO 8601 format (YYYY-MM-DD).

Returns:

  • (Date)


18
19
20
# File 'lib/the_plaid_api/models/employment_verification.rb', line 18

def start_date
  @start_date
end

#statusEmploymentVerificationStatus

Current employment status.



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

def status
  @status
end

#titleString

Current title of employee.

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/employment_verification.rb', line 30

def title
  @title
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/the_plaid_api/models/employment_verification.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : SKIP
  start_date = hash.key?('start_date') ? hash['start_date'] : SKIP
  end_date = hash.key?('end_date') ? hash['end_date'] : SKIP
  employer = EmployerVerification.from_hash(hash['employer']) if hash['employer']
  title = hash.key?('title') ? hash['title'] : SKIP
  platform_ids = PlatformIds.from_hash(hash['platform_ids']) if hash['platform_ids']

  # 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.
  EmploymentVerification.new(status: status,
                             start_date: start_date,
                             end_date: end_date,
                             employer: employer,
                             title: title,
                             platform_ids: platform_ids,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/the_plaid_api/models/employment_verification.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash['employer'] = 'employer'
  @_hash['title'] = 'title'
  @_hash['platform_ids'] = 'platform_ids'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
64
65
66
67
68
# File 'lib/the_plaid_api/models/employment_verification.rb', line 61

def self.nullables
  %w[
    status
    start_date
    end_date
    title
  ]
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
58
# File 'lib/the_plaid_api/models/employment_verification.rb', line 49

def self.optionals
  %w[
    status
    start_date
    end_date
    employer
    title
    platform_ids
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
128
# File 'lib/the_plaid_api/models/employment_verification.rb', line 123

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status.inspect}, start_date: #{@start_date.inspect}, end_date:"\
  " #{@end_date.inspect}, employer: #{@employer.inspect}, title: #{@title.inspect},"\
  " platform_ids: #{@platform_ids.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status}, start_date: #{@start_date}, end_date: #{@end_date},"\
  " employer: #{@employer}, title: #{@title}, platform_ids: #{@platform_ids},"\
  " additional_properties: #{@additional_properties}>"
end