Class: Gusto::HistoricalEmployeeBody

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/types/historical_employee_body.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first_name:, middle_initial: OMIT, last_name:, preferred_first_name: OMIT, date_of_birth:, ssn:, work_address:, home_address:, termination:, job:, employee_state_taxes: OMIT, additional_properties: nil) ⇒ Gusto::HistoricalEmployeeBody

Parameters:



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 55

def initialize(first_name:, middle_initial: OMIT, last_name:, preferred_first_name: OMIT, date_of_birth:, ssn:, work_address:, home_address:, termination:, job:, employee_state_taxes: OMIT, additional_properties: nil)
  @first_name = first_name
  @middle_initial = middle_initial if middle_initial != OMIT
  @last_name = last_name
  @preferred_first_name = preferred_first_name if preferred_first_name != OMIT
  @date_of_birth = date_of_birth
  @ssn = ssn
  @work_address = work_address
  @home_address = home_address
  @termination = termination
  @job = job
  @employee_state_taxes = employee_state_taxes if employee_state_taxes != OMIT
  @additional_properties = additional_properties
  @_field_set = { "first_name": first_name, "middle_initial": middle_initial, "last_name": last_name, "preferred_first_name": preferred_first_name, "date_of_birth": date_of_birth, "ssn": ssn, "work_address": work_address, "home_address": home_address, "termination": termination, "job": job, "employee_state_taxes": employee_state_taxes }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



35
36
37
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 35

def additional_properties
  @additional_properties
end

#date_of_birthString (readonly)

Returns:

  • (String)


21
22
23
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 21

def date_of_birth
  @date_of_birth
end

#employee_state_taxesGusto::HistoricalEmployeeBodyEmployeeStateTaxes (readonly)



33
34
35
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 33

def employee_state_taxes
  @employee_state_taxes
end

#first_nameString (readonly)

Returns:

  • (String)


13
14
15
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 13

def first_name
  @first_name
end

#home_addressGusto::HistoricalEmployeeBodyHomeAddress (readonly)



27
28
29
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 27

def home_address
  @home_address
end

#jobGusto::HistoricalEmployeeBodyJob (readonly)



31
32
33
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 31

def job
  @job
end

#last_nameString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 17

def last_name
  @last_name
end

#middle_initialString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 15

def middle_initial
  @middle_initial
end

#preferred_first_nameString (readonly)

Returns:

  • (String)


19
20
21
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 19

def preferred_first_name
  @preferred_first_name
end

#ssnString (readonly)

Returns:

  • (String)


23
24
25
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 23

def ssn
  @ssn
end

#terminationGusto::HistoricalEmployeeBodyTermination (readonly)



29
30
31
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 29

def termination
  @termination
end

#work_addressGusto::HistoricalEmployeeBodyWorkAddress (readonly)



25
26
27
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 25

def work_address
  @work_address
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::HistoricalEmployeeBody

Parameters:

  • json_object (String)

Returns:



76
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
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
129
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 76

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  first_name = parsed_json["first_name"]
  middle_initial = parsed_json["middle_initial"]
  last_name = parsed_json["last_name"]
  preferred_first_name = parsed_json["preferred_first_name"]
  date_of_birth = parsed_json["date_of_birth"]
  ssn = parsed_json["ssn"]
  unless parsed_json["work_address"].nil?
    work_address = parsed_json["work_address"].to_json
    work_address = Gusto::HistoricalEmployeeBodyWorkAddress.from_json(json_object: work_address)
  else
    work_address = nil
  end
  unless parsed_json["home_address"].nil?
    home_address = parsed_json["home_address"].to_json
    home_address = Gusto::HistoricalEmployeeBodyHomeAddress.from_json(json_object: home_address)
  else
    home_address = nil
  end
  unless parsed_json["termination"].nil?
    termination = parsed_json["termination"].to_json
    termination = Gusto::HistoricalEmployeeBodyTermination.from_json(json_object: termination)
  else
    termination = nil
  end
  unless parsed_json["job"].nil?
    job = parsed_json["job"].to_json
    job = Gusto::HistoricalEmployeeBodyJob.from_json(json_object: job)
  else
    job = nil
  end
  unless parsed_json["employee_state_taxes"].nil?
    employee_state_taxes = parsed_json["employee_state_taxes"].to_json
    employee_state_taxes = Gusto::HistoricalEmployeeBodyEmployeeStateTaxes.from_json(json_object: employee_state_taxes)
  else
    employee_state_taxes = nil
  end
  new(
    first_name: first_name,
    middle_initial: middle_initial,
    last_name: last_name,
    preferred_first_name: preferred_first_name,
    date_of_birth: date_of_birth,
    ssn: ssn,
    work_address: work_address,
    home_address: home_address,
    termination: termination,
    job: job,
    employee_state_taxes: employee_state_taxes,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 142

def self.validate_raw(obj:)
  obj.first_name.is_a?(String) != false || raise("Passed value for field obj.first_name is not the expected type, validation failed.")
  obj.middle_initial&.is_a?(String) != false || raise("Passed value for field obj.middle_initial is not the expected type, validation failed.")
  obj.last_name.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.")
  obj.preferred_first_name&.is_a?(String) != false || raise("Passed value for field obj.preferred_first_name is not the expected type, validation failed.")
  obj.date_of_birth.is_a?(String) != false || raise("Passed value for field obj.date_of_birth is not the expected type, validation failed.")
  obj.ssn.is_a?(String) != false || raise("Passed value for field obj.ssn is not the expected type, validation failed.")
  Gusto::HistoricalEmployeeBodyWorkAddress.validate_raw(obj: obj.work_address)
  Gusto::HistoricalEmployeeBodyHomeAddress.validate_raw(obj: obj.home_address)
  Gusto::HistoricalEmployeeBodyTermination.validate_raw(obj: obj.termination)
  Gusto::HistoricalEmployeeBodyJob.validate_raw(obj: obj.job)
  obj.employee_state_taxes.nil? || Gusto::HistoricalEmployeeBodyEmployeeStateTaxes.validate_raw(obj: obj.employee_state_taxes)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


133
134
135
# File 'lib/fern_gusto/types/historical_employee_body.rb', line 133

def to_json
  @_field_set&.to_json
end