Class: FdxV660Api::Employment1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/employment1.rb

Overview

The employee's employment

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(employer:, status:, job_title: SKIP, original_hire_date: SKIP, most_recent_hire_date: SKIP, end_date: SKIP, supplemental_status: SKIP, type: SKIP, additional_properties: nil) ⇒ Employment1

Returns a new instance of Employment1.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/fdx_v660_api/models/employment1.rb', line 76

def initialize(employer:, status:, job_title: SKIP,
               original_hire_date: SKIP, most_recent_hire_date: SKIP,
               end_date: SKIP, supplemental_status: SKIP, type: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @employer = employer
  @job_title = job_title unless job_title == SKIP
  @original_hire_date = original_hire_date unless original_hire_date == SKIP
  @most_recent_hire_date = most_recent_hire_date unless most_recent_hire_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @status = status
  @supplemental_status = supplemental_status unless supplemental_status == SKIP
  @type = type unless type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#employerEmployerEntity1

The employer for the job/position

Returns:



14
15
16
# File 'lib/fdx_v660_api/models/employment1.rb', line 14

def employer
  @employer
end

#end_dateDate

The employment end date

Returns:

  • (Date)


30
31
32
# File 'lib/fdx_v660_api/models/employment1.rb', line 30

def end_date
  @end_date
end

#job_titleString

The title of the job/position

Returns:

  • (String)


18
19
20
# File 'lib/fdx_v660_api/models/employment1.rb', line 18

def job_title
  @job_title
end

#most_recent_hire_dateDate

The date when employee re-joined most recently

Returns:

  • (Date)


26
27
28
# File 'lib/fdx_v660_api/models/employment1.rb', line 26

def most_recent_hire_date
  @most_recent_hire_date
end

#original_hire_dateDate

The date when employee joined for the first time

Returns:

  • (Date)


22
23
24
# File 'lib/fdx_v660_api/models/employment1.rb', line 22

def original_hire_date
  @original_hire_date
end

#statusActiveInactiveStatus2

The employee's employment status, ACTIVE or INACTIVE



34
35
36
# File 'lib/fdx_v660_api/models/employment1.rb', line 34

def status
  @status
end

#supplemental_statusSupplementalStatus2

Supplemental detail of employee's employment status

Returns:



38
39
40
# File 'lib/fdx_v660_api/models/employment1.rb', line 38

def supplemental_status
  @supplemental_status
end

#typeEmploymentType2

The employee's employment type, CONTRACTED, FULL-TIME, OTHER, PART-TIME, SEASONAL, TEMPORARY

Returns:



43
44
45
# File 'lib/fdx_v660_api/models/employment1.rb', line 43

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/fdx_v660_api/models/employment1.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  employer = EmployerEntity1.from_hash(hash['employer']) if hash['employer']
  status = hash.key?('status') ? hash['status'] : nil
  job_title = hash.key?('jobTitle') ? hash['jobTitle'] : SKIP
  original_hire_date =
    hash.key?('originalHireDate') ? hash['originalHireDate'] : SKIP
  most_recent_hire_date =
    hash.key?('mostRecentHireDate') ? hash['mostRecentHireDate'] : SKIP
  end_date = hash.key?('endDate') ? hash['endDate'] : SKIP
  supplemental_status =
    hash.key?('supplementalStatus') ? hash['supplementalStatus'] : SKIP
  type = hash.key?('type') ? hash['type'] : 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.
  Employment1.new(employer: employer,
                  status: status,
                  job_title: job_title,
                  original_hire_date: original_hire_date,
                  most_recent_hire_date: most_recent_hire_date,
                  end_date: end_date,
                  supplemental_status: supplemental_status,
                  type: type,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fdx_v660_api/models/employment1.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['employer'] = 'employer'
  @_hash['job_title'] = 'jobTitle'
  @_hash['original_hire_date'] = 'originalHireDate'
  @_hash['most_recent_hire_date'] = 'mostRecentHireDate'
  @_hash['end_date'] = 'endDate'
  @_hash['status'] = 'status'
  @_hash['supplemental_status'] = 'supplementalStatus'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
# File 'lib/fdx_v660_api/models/employment1.rb', line 72

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
# File 'lib/fdx_v660_api/models/employment1.rb', line 60

def self.optionals
  %w[
    job_title
    original_hire_date
    most_recent_hire_date
    end_date
    supplemental_status
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



140
141
142
143
144
145
146
147
# File 'lib/fdx_v660_api/models/employment1.rb', line 140

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} employer: #{@employer.inspect}, job_title: #{@job_title.inspect},"\
  " original_hire_date: #{@original_hire_date.inspect}, most_recent_hire_date:"\
  " #{@most_recent_hire_date.inspect}, end_date: #{@end_date.inspect}, status:"\
  " #{@status.inspect}, supplemental_status: #{@supplemental_status.inspect}, type:"\
  " #{@type.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



131
132
133
134
135
136
137
# File 'lib/fdx_v660_api/models/employment1.rb', line 131

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} employer: #{@employer}, job_title: #{@job_title}, original_hire_date:"\
  " #{@original_hire_date}, most_recent_hire_date: #{@most_recent_hire_date}, end_date:"\
  " #{@end_date}, status: #{@status}, supplemental_status: #{@supplemental_status}, type:"\
  " #{@type}, additional_properties: #{@additional_properties}>"
end