Class: Gusto::Terminations::Termination

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

Overview

The representation of a termination in Gusto.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid:, version: OMIT, employee_uuid: OMIT, active: OMIT, cancelable: OMIT, effective_date: OMIT, run_termination_payroll: OMIT, additional_properties: nil) ⇒ Gusto::Terminations::Termination

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/fern_gusto/terminations/types/termination.rb', line 48

def initialize(uuid:, version: OMIT, employee_uuid: OMIT, active: OMIT, cancelable: OMIT, effective_date: OMIT, run_termination_payroll: OMIT, additional_properties: nil)
  @uuid = uuid
  @version = version if version != OMIT
  @employee_uuid = employee_uuid if employee_uuid != OMIT
  @active = active if active != OMIT
  @cancelable = cancelable if cancelable != OMIT
  @effective_date = effective_date if effective_date != OMIT
  @run_termination_payroll = run_termination_payroll if run_termination_payroll != OMIT
  @additional_properties = additional_properties
  @_field_set = { "uuid": uuid, "version": version, "employee_uuid": employee_uuid, "active": active, "cancelable": cancelable, "effective_date": effective_date, "run_termination_payroll": run_termination_payroll }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#activeBoolean (readonly)

Returns Whether the employee’s termination has gone into effect.

Returns:

  • (Boolean)

    Whether the employee’s termination has gone into effect.



18
19
20
# File 'lib/fern_gusto/terminations/types/termination.rb', line 18

def active
  @active
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



28
29
30
# File 'lib/fern_gusto/terminations/types/termination.rb', line 28

def additional_properties
  @additional_properties
end

#cancelableObject (readonly)

‘run_termination_payroll` is false and `effective_date` is in the future.



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

def cancelable
  @cancelable
end

#effective_dateString (readonly)

Returns The employee’s last day of work.

Returns:

  • (String)

    The employee’s last day of work.



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

def effective_date
  @effective_date
end

#employee_uuidInteger (readonly)

Returns The UUID of the employee to which this termination is attached.

Returns:

  • (Integer)

    The UUID of the employee to which this termination is attached.



16
17
18
# File 'lib/fern_gusto/terminations/types/termination.rb', line 16

def employee_uuid
  @employee_uuid
end

#run_termination_payrollObject (readonly)

If false, they should receive their final wages on their current pay schedule.



26
27
28
# File 'lib/fern_gusto/terminations/types/termination.rb', line 26

def run_termination_payroll
  @run_termination_payroll
end

#uuidString (readonly)

Returns The UUID of the termination object.

Returns:

  • (String)

    The UUID of the termination object.



10
11
12
# File 'lib/fern_gusto/terminations/types/termination.rb', line 10

def uuid
  @uuid
end

#versionObject (readonly)

on how to use this field.



14
15
16
# File 'lib/fern_gusto/terminations/types/termination.rb', line 14

def version
  @version
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Terminations::Termination

Parameters:

  • json_object (String)

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/fern_gusto/terminations/types/termination.rb', line 65

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  uuid = parsed_json["uuid"]
  version = parsed_json["version"]
  employee_uuid = parsed_json["employee_uuid"]
  active = parsed_json["active"]
  cancelable = parsed_json["cancelable"]
  effective_date = parsed_json["effective_date"]
  run_termination_payroll = parsed_json["run_termination_payroll"]
  new(
    uuid: uuid,
    version: version,
    employee_uuid: employee_uuid,
    active: active,
    cancelable: cancelable,
    effective_date: effective_date,
    run_termination_payroll: run_termination_payroll,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


98
99
100
101
102
103
104
105
106
# File 'lib/fern_gusto/terminations/types/termination.rb', line 98

def self.validate_raw(obj:)
  obj.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.")
  obj.version&.is_a?(String) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
  obj.employee_uuid&.is_a?(Integer) != false || raise("Passed value for field obj.employee_uuid is not the expected type, validation failed.")
  obj.active&.is_a?(Boolean) != false || raise("Passed value for field obj.active is not the expected type, validation failed.")
  obj.cancelable&.is_a?(Boolean) != false || raise("Passed value for field obj.cancelable is not the expected type, validation failed.")
  obj.effective_date&.is_a?(String) != false || raise("Passed value for field obj.effective_date is not the expected type, validation failed.")
  obj.run_termination_payroll&.is_a?(Boolean) != false || raise("Passed value for field obj.run_termination_payroll is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


89
90
91
# File 'lib/fern_gusto/terminations/types/termination.rb', line 89

def to_json
  @_field_set&.to_json
end