Class: Gusto::TimeOffPolicy
- Inherits:
-
Object
- Object
- Gusto::TimeOffPolicy
- Defined in:
- lib/fern_gusto/types/time_off_policy.rb
Overview
Representation of a Time Off Policy
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#accrual_method ⇒ String
readonly
Policy time off accrual method.
-
#accrual_rate ⇒ Object
readonly
Represented as a float, e.g.
-
#accrual_rate_unit ⇒ Object
readonly
Represented as a float, e.g.
-
#accrual_waiting_period_days ⇒ Object
readonly
hours.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#carryover_limit_hours ⇒ String
readonly
The max number of hours and employee can carryover from one year to the next.
-
#company_uuid ⇒ String
readonly
Unique identifier for the company owning the time off policy.
-
#complete ⇒ Boolean
readonly
Boolean representing if a policy has completed configuration.
-
#employees ⇒ Array<Gusto::TimeOffPolicyEmployeesItem>
readonly
List of employee UUIDs under a time off policy.
-
#is_active ⇒ Boolean
readonly
Boolean representing if a policy is active or not.
-
#max_accrual_hours_per_year ⇒ String
readonly
The max number of hours and employee can accrue in a year.
-
#max_hours ⇒ String
readonly
The max number of hours an employee can accrue.
-
#name ⇒ String
readonly
Name of the time off policy.
-
#paid_out_on_termination ⇒ Object
readonly
termination.
-
#policy_type ⇒ Gusto::TimeOffPolicyPolicyType
readonly
Type of the time off policy.
-
#uuid ⇒ String
readonly
Unique identifier of a time off policy.
-
#version ⇒ Object
readonly
information on how to use this field.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(uuid:, company_uuid:, name:, policy_type:, accrual_method:, accrual_rate: OMIT, accrual_rate_unit: OMIT, paid_out_on_termination: OMIT, accrual_waiting_period_days: OMIT, carryover_limit_hours: OMIT, max_accrual_hours_per_year: OMIT, max_hours: OMIT, complete: OMIT, version: OMIT, is_active:, employees:, additional_properties: nil) ⇒ Gusto::TimeOffPolicy constructor
- #to_json ⇒ String
Constructor Details
#initialize(uuid:, company_uuid:, name:, policy_type:, accrual_method:, accrual_rate: OMIT, accrual_rate_unit: OMIT, paid_out_on_termination: OMIT, accrual_waiting_period_days: OMIT, carryover_limit_hours: OMIT, max_accrual_hours_per_year: OMIT, max_hours: OMIT, complete: OMIT, version: OMIT, is_active:, employees:, additional_properties: nil) ⇒ Gusto::TimeOffPolicy
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 84 def initialize(uuid:, company_uuid:, name:, policy_type:, accrual_method:, accrual_rate: OMIT, accrual_rate_unit: OMIT, paid_out_on_termination: OMIT, accrual_waiting_period_days: OMIT, carryover_limit_hours: OMIT, max_accrual_hours_per_year: OMIT, max_hours: OMIT, complete: OMIT, version: OMIT, is_active:, employees:, additional_properties: nil) @uuid = uuid @company_uuid = company_uuid @name = name @policy_type = policy_type @accrual_method = accrual_method @accrual_rate = accrual_rate if accrual_rate != OMIT @accrual_rate_unit = accrual_rate_unit if accrual_rate_unit != OMIT @paid_out_on_termination = paid_out_on_termination if paid_out_on_termination != OMIT @accrual_waiting_period_days = accrual_waiting_period_days if accrual_waiting_period_days != OMIT @carryover_limit_hours = carryover_limit_hours if carryover_limit_hours != OMIT @max_accrual_hours_per_year = max_accrual_hours_per_year if max_accrual_hours_per_year != OMIT @max_hours = max_hours if max_hours != OMIT @complete = complete if complete != OMIT @version = version if version != OMIT @is_active = is_active @employees = employees @additional_properties = additional_properties @_field_set = { "uuid": uuid, "company_uuid": company_uuid, "name": name, "policy_type": policy_type, "accrual_method": accrual_method, "accrual_rate": accrual_rate, "accrual_rate_unit": accrual_rate_unit, "paid_out_on_termination": paid_out_on_termination, "accrual_waiting_period_days": accrual_waiting_period_days, "carryover_limit_hours": carryover_limit_hours, "max_accrual_hours_per_year": max_accrual_hours_per_year, "max_hours": max_hours, "complete": complete, "version": version, "is_active": is_active, "employees": employees }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#accrual_method ⇒ String (readonly)
Returns Policy time off accrual method.
19 20 21 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 19 def accrual_method @accrual_method end |
#accrual_rate ⇒ Object (readonly)
Represented as a float, e.g. “40.0”.
22 23 24 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 22 def accrual_rate @accrual_rate end |
#accrual_rate_unit ⇒ Object (readonly)
Represented as a float, e.g. “40.0”.
27 28 29 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 27 def accrual_rate_unit @accrual_rate_unit end |
#accrual_waiting_period_days ⇒ Object (readonly)
hours
33 34 35 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 33 def accrual_waiting_period_days @accrual_waiting_period_days end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
51 52 53 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 51 def additional_properties @additional_properties end |
#carryover_limit_hours ⇒ String (readonly)
Returns The max number of hours and employee can carryover from one year to the next.
35 36 37 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 35 def carryover_limit_hours @carryover_limit_hours end |
#company_uuid ⇒ String (readonly)
Returns Unique identifier for the company owning the time off policy.
13 14 15 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 13 def company_uuid @company_uuid end |
#complete ⇒ Boolean (readonly)
Returns boolean representing if a policy has completed configuration.
41 42 43 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 41 def complete @complete end |
#employees ⇒ Array<Gusto::TimeOffPolicyEmployeesItem> (readonly)
Returns List of employee UUIDs under a time off policy.
49 50 51 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 49 def employees @employees end |
#is_active ⇒ Boolean (readonly)
Returns boolean representing if a policy is active or not.
47 48 49 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 47 def is_active @is_active end |
#max_accrual_hours_per_year ⇒ String (readonly)
Returns The max number of hours and employee can accrue in a year.
37 38 39 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 37 def max_accrual_hours_per_year @max_accrual_hours_per_year end |
#max_hours ⇒ String (readonly)
Returns The max number of hours an employee can accrue.
39 40 41 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 39 def max_hours @max_hours end |
#name ⇒ String (readonly)
Returns Name of the time off policy.
15 16 17 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 15 def name @name end |
#paid_out_on_termination ⇒ Object (readonly)
termination
30 31 32 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 30 def paid_out_on_termination @paid_out_on_termination end |
#policy_type ⇒ Gusto::TimeOffPolicyPolicyType (readonly)
Returns Type of the time off policy.
17 18 19 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 17 def policy_type @policy_type end |
#uuid ⇒ String (readonly)
Returns Unique identifier of a time off policy.
11 12 13 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 11 def uuid @uuid end |
#version ⇒ Object (readonly)
information on how to use this field.
45 46 47 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 45 def version @version end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::TimeOffPolicy
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 110 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) uuid = parsed_json["uuid"] company_uuid = parsed_json["company_uuid"] name = parsed_json["name"] policy_type = parsed_json["policy_type"] accrual_method = parsed_json["accrual_method"] accrual_rate = parsed_json["accrual_rate"] accrual_rate_unit = parsed_json["accrual_rate_unit"] paid_out_on_termination = parsed_json["paid_out_on_termination"] accrual_waiting_period_days = parsed_json["accrual_waiting_period_days"] carryover_limit_hours = parsed_json["carryover_limit_hours"] max_accrual_hours_per_year = parsed_json["max_accrual_hours_per_year"] max_hours = parsed_json["max_hours"] complete = parsed_json["complete"] version = parsed_json["version"] is_active = parsed_json["is_active"] employees = parsed_json["employees"]&.map do | item | item = item.to_json Gusto::TimeOffPolicyEmployeesItem.from_json(json_object: item) end new( uuid: uuid, company_uuid: company_uuid, name: name, policy_type: policy_type, accrual_method: accrual_method, accrual_rate: accrual_rate, accrual_rate_unit: accrual_rate_unit, paid_out_on_termination: paid_out_on_termination, accrual_waiting_period_days: accrual_waiting_period_days, carryover_limit_hours: carryover_limit_hours, max_accrual_hours_per_year: max_accrual_hours_per_year, max_hours: max_hours, complete: complete, version: version, is_active: is_active, employees: employees, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 164 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.company_uuid.is_a?(String) != false || raise("Passed value for field obj.company_uuid is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.policy_type.is_a?(Gusto::TimeOffPolicyPolicyType) != false || raise("Passed value for field obj.policy_type is not the expected type, validation failed.") obj.accrual_method.is_a?(String) != false || raise("Passed value for field obj.accrual_method is not the expected type, validation failed.") obj.accrual_rate&.is_a?(String) != false || raise("Passed value for field obj.accrual_rate is not the expected type, validation failed.") obj.accrual_rate_unit&.is_a?(String) != false || raise("Passed value for field obj.accrual_rate_unit is not the expected type, validation failed.") obj.paid_out_on_termination&.is_a?(Boolean) != false || raise("Passed value for field obj.paid_out_on_termination is not the expected type, validation failed.") obj.accrual_waiting_period_days&.is_a?(Integer) != false || raise("Passed value for field obj.accrual_waiting_period_days is not the expected type, validation failed.") obj.carryover_limit_hours&.is_a?(String) != false || raise("Passed value for field obj.carryover_limit_hours is not the expected type, validation failed.") obj.max_accrual_hours_per_year&.is_a?(String) != false || raise("Passed value for field obj.max_accrual_hours_per_year is not the expected type, validation failed.") obj.max_hours&.is_a?(String) != false || raise("Passed value for field obj.max_hours is not the expected type, validation failed.") obj.complete&.is_a?(Boolean) != false || raise("Passed value for field obj.complete 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.is_active.is_a?(Boolean) != false || raise("Passed value for field obj.is_active is not the expected type, validation failed.") obj.employees.is_a?(Array) != false || raise("Passed value for field obj.employees is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
155 156 157 |
# File 'lib/fern_gusto/types/time_off_policy.rb', line 155 def to_json @_field_set&.to_json end |