Class: Gusto::EmployeeBenefit

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

Overview

The representation of an employee benefit.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(employee_uuid: OMIT, company_benefit_uuid: OMIT, uuid: OMIT, version: OMIT, active: OMIT, employee_deduction: OMIT, deduct_as_percentage: OMIT, employee_deduction_annual_maximum: OMIT, contribution: OMIT, elective: OMIT, company_contribution_annual_maximum: OMIT, limit_option: OMIT, catch_up: OMIT, retirement_loan_identifier: OMIT, coverage_amount: OMIT, deduction_reduces_taxable_income: OMIT, coverage_salary_multiplier: OMIT, company_contribution: OMIT, contribute_as_percentage: OMIT, additional_properties: nil) ⇒ Gusto::EmployeeBenefit

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/fern_gusto/types/employee_benefit.rb', line 107

def initialize(employee_uuid: OMIT, company_benefit_uuid: OMIT, uuid: OMIT, version: OMIT, active: OMIT, employee_deduction: OMIT, deduct_as_percentage: OMIT, employee_deduction_annual_maximum: OMIT, contribution: OMIT, elective: OMIT, company_contribution_annual_maximum: OMIT, limit_option: OMIT, catch_up: OMIT, retirement_loan_identifier: OMIT, coverage_amount: OMIT, deduction_reduces_taxable_income: OMIT, coverage_salary_multiplier: OMIT, company_contribution: OMIT, contribute_as_percentage: OMIT, additional_properties: nil)
  @employee_uuid = employee_uuid if employee_uuid != OMIT
  @company_benefit_uuid = company_benefit_uuid if company_benefit_uuid != OMIT
  @uuid = uuid if uuid != OMIT
  @version = version if version != OMIT
  @active = active if active != OMIT
  @employee_deduction = employee_deduction if employee_deduction != OMIT
  @deduct_as_percentage = deduct_as_percentage if deduct_as_percentage != OMIT
  @employee_deduction_annual_maximum = employee_deduction_annual_maximum if employee_deduction_annual_maximum != OMIT
  @contribution = contribution if contribution != OMIT
  @elective = elective if elective != OMIT
  @company_contribution_annual_maximum = company_contribution_annual_maximum if company_contribution_annual_maximum != OMIT
  @limit_option = limit_option if limit_option != OMIT
  @catch_up = catch_up if catch_up != OMIT
  @retirement_loan_identifier = retirement_loan_identifier if retirement_loan_identifier != OMIT
  @coverage_amount = coverage_amount if coverage_amount != OMIT
  @deduction_reduces_taxable_income = deduction_reduces_taxable_income if deduction_reduces_taxable_income != OMIT
  @coverage_salary_multiplier = coverage_salary_multiplier if coverage_salary_multiplier != OMIT
  @company_contribution = company_contribution if company_contribution != OMIT
  @contribute_as_percentage = contribute_as_percentage if contribute_as_percentage != OMIT
  @additional_properties = additional_properties
  @_field_set = { "employee_uuid": employee_uuid, "company_benefit_uuid": company_benefit_uuid, "uuid": uuid, "version": version, "active": active, "employee_deduction": employee_deduction, "deduct_as_percentage": deduct_as_percentage, "employee_deduction_annual_maximum": employee_deduction_annual_maximum, "contribution": contribution, "elective": elective, "company_contribution_annual_maximum": company_contribution_annual_maximum, "limit_option": limit_option, "catch_up": catch_up, "retirement_loan_identifier": retirement_loan_identifier, "coverage_amount": coverage_amount, "deduction_reduces_taxable_income": deduction_reduces_taxable_income, "coverage_salary_multiplier": coverage_salary_multiplier, "company_contribution": company_contribution, "contribute_as_percentage": contribute_as_percentage }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#activeBoolean (readonly)

Returns Whether the employee benefit is active.

Returns:

  • (Boolean)

    Whether the employee benefit is active.



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

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



64
65
66
# File 'lib/fern_gusto/types/employee_benefit.rb', line 64

def additional_properties
  @additional_properties
end

#catch_upObject (readonly)

401k benefits use this value for employees over 50.



44
45
46
# File 'lib/fern_gusto/types/employee_benefit.rb', line 44

def catch_up
  @catch_up
end

#company_benefit_uuidString (readonly)

Returns The UUID of the company benefit.

Returns:

  • (String)

    The UUID of the company benefit.



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

def company_benefit_uuid
  @company_benefit_uuid
end

#company_contributionObject (readonly)

appear for tiered contribution types.



59
60
61
# File 'lib/fern_gusto/types/employee_benefit.rb', line 59

def company_contribution
  @company_contribution
end

#company_contribution_annual_maximumObject (readonly)

limit.



36
37
38
# File 'lib/fern_gusto/types/employee_benefit.rb', line 36

def company_contribution_annual_maximum
  @company_contribution_annual_maximum
end

#contribute_as_percentageObject (readonly)

added to each payroll. This field will not appear for tiered contribution types.



62
63
64
# File 'lib/fern_gusto/types/employee_benefit.rb', line 62

def contribute_as_percentage
  @contribute_as_percentage
end

#contributionGusto::EmployeeBenefitBaseObjectContribution (readonly)

Returns An object representing the type and value of the company contribution.

Returns:



30
31
32
# File 'lib/fern_gusto/types/employee_benefit.rb', line 30

def contribution
  @contribution
end

#coverage_amountObject (readonly)

be present if coverage amount is set.



49
50
51
# File 'lib/fern_gusto/types/employee_benefit.rb', line 49

def coverage_amount
  @coverage_amount
end

#coverage_salary_multiplierObject (readonly)

Group Term Life benefits. Note: cannot be set if coverage amount is also set.



56
57
58
# File 'lib/fern_gusto/types/employee_benefit.rb', line 56

def coverage_salary_multiplier
  @coverage_salary_multiplier
end

#deduct_as_percentageObject (readonly)

deducted from each payroll.



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

def deduct_as_percentage
  @deduct_as_percentage
end

#deduction_reduces_taxable_incomeObject (readonly)

and coverage salary multiplier are ignored.



53
54
55
# File 'lib/fern_gusto/types/employee_benefit.rb', line 53

def deduction_reduces_taxable_income
  @deduction_reduces_taxable_income
end

#electiveObject (readonly)

contribution types, this is always true.



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

def elective
  @elective
end

#employee_deductionString (readonly)

Returns The amount to be deducted, per pay period, from the employee’s pay.

Returns:

  • (String)

    The amount to be deducted, per pay period, from the employee’s pay.



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

def employee_deduction
  @employee_deduction
end

#employee_deduction_annual_maximumString (readonly)

Returns The maximum employee deduction amount per year. A null value signifies no limit.

Returns:

  • (String)

    The maximum employee deduction amount per year. A null value signifies no limit.



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

def employee_deduction_annual_maximum
  @employee_deduction_annual_maximum
end

#employee_uuidString (readonly)

Returns The UUID of the employee to which the benefit belongs.

Returns:

  • (String)

    The UUID of the employee to which the benefit belongs.



11
12
13
# File 'lib/fern_gusto/types/employee_benefit.rb', line 11

def employee_uuid
  @employee_uuid
end

#limit_optionObject (readonly)

either “Joint Filing or Single” or “Married and Filing Separately”.



41
42
43
# File 'lib/fern_gusto/types/employee_benefit.rb', line 41

def limit_option
  @limit_option
end

#retirement_loan_identifierString (readonly)

Returns Identifier for a 401(k) loan assigned by the 401(k) provider.

Returns:

  • (String)

    Identifier for a 401(k) loan assigned by the 401(k) provider



46
47
48
# File 'lib/fern_gusto/types/employee_benefit.rb', line 46

def retirement_loan_identifier
  @retirement_loan_identifier
end

#uuidString (readonly)

Returns The UUID of the employee benefit.

Returns:

  • (String)

    The UUID of the employee benefit.



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

def uuid
  @uuid
end

#versionObject (readonly)

on how to use this field.



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

def version
  @version
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::EmployeeBenefit

Parameters:

  • json_object (String)

Returns:



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/fern_gusto/types/employee_benefit.rb', line 136

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  employee_uuid = parsed_json["employee_uuid"]
  company_benefit_uuid = parsed_json["company_benefit_uuid"]
  uuid = parsed_json["uuid"]
  version = parsed_json["version"]
  active = parsed_json["active"]
  employee_deduction = parsed_json["employee_deduction"]
  deduct_as_percentage = parsed_json["deduct_as_percentage"]
  employee_deduction_annual_maximum = parsed_json["employee_deduction_annual_maximum"]
  unless parsed_json["contribution"].nil?
    contribution = parsed_json["contribution"].to_json
    contribution = Gusto::EmployeeBenefitBaseObjectContribution.from_json(json_object: contribution)
  else
    contribution = nil
  end
  elective = parsed_json["elective"]
  company_contribution_annual_maximum = parsed_json["company_contribution_annual_maximum"]
  limit_option = parsed_json["limit_option"]
  catch_up = parsed_json["catch_up"]
  retirement_loan_identifier = parsed_json["retirement_loan_identifier"]
  coverage_amount = parsed_json["coverage_amount"]
  deduction_reduces_taxable_income = parsed_json["deduction_reduces_taxable_income"]
  coverage_salary_multiplier = parsed_json["coverage_salary_multiplier"]
  company_contribution = parsed_json["company_contribution"]
  contribute_as_percentage = parsed_json["contribute_as_percentage"]
  new(
    employee_uuid: employee_uuid,
    company_benefit_uuid: company_benefit_uuid,
    uuid: uuid,
    version: version,
    active: active,
    employee_deduction: employee_deduction,
    deduct_as_percentage: deduct_as_percentage,
    employee_deduction_annual_maximum: employee_deduction_annual_maximum,
    contribution: contribution,
    elective: elective,
    company_contribution_annual_maximum: company_contribution_annual_maximum,
    limit_option: limit_option,
    catch_up: catch_up,
    retirement_loan_identifier: retirement_loan_identifier,
    coverage_amount: coverage_amount,
    deduction_reduces_taxable_income: deduction_reduces_taxable_income,
    coverage_salary_multiplier: coverage_salary_multiplier,
    company_contribution: company_contribution,
    contribute_as_percentage: contribute_as_percentage,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/fern_gusto/types/employee_benefit.rb', line 198

def self.validate_raw(obj:)
  obj.employee_uuid&.is_a?(String) != false || raise("Passed value for field obj.employee_uuid is not the expected type, validation failed.")
  obj.company_benefit_uuid&.is_a?(String) != false || raise("Passed value for field obj.company_benefit_uuid is not the expected type, validation failed.")
  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.active&.is_a?(Boolean) != false || raise("Passed value for field obj.active is not the expected type, validation failed.")
  obj.employee_deduction&.is_a?(String) != false || raise("Passed value for field obj.employee_deduction is not the expected type, validation failed.")
  obj.deduct_as_percentage&.is_a?(Boolean) != false || raise("Passed value for field obj.deduct_as_percentage is not the expected type, validation failed.")
  obj.employee_deduction_annual_maximum&.is_a?(String) != false || raise("Passed value for field obj.employee_deduction_annual_maximum is not the expected type, validation failed.")
  obj.contribution.nil? || Gusto::EmployeeBenefitBaseObjectContribution.validate_raw(obj: obj.contribution)
  obj.elective&.is_a?(Boolean) != false || raise("Passed value for field obj.elective is not the expected type, validation failed.")
  obj.company_contribution_annual_maximum&.is_a?(String) != false || raise("Passed value for field obj.company_contribution_annual_maximum is not the expected type, validation failed.")
  obj.limit_option&.is_a?(String) != false || raise("Passed value for field obj.limit_option is not the expected type, validation failed.")
  obj.catch_up&.is_a?(Boolean) != false || raise("Passed value for field obj.catch_up is not the expected type, validation failed.")
  obj.retirement_loan_identifier&.is_a?(String) != false || raise("Passed value for field obj.retirement_loan_identifier is not the expected type, validation failed.")
  obj.coverage_amount&.is_a?(String) != false || raise("Passed value for field obj.coverage_amount is not the expected type, validation failed.")
  obj.deduction_reduces_taxable_income&.is_a?(Gusto::EmployeeBenefitBaseObjectDeductionReducesTaxableIncome) != false || raise("Passed value for field obj.deduction_reduces_taxable_income is not the expected type, validation failed.")
  obj.coverage_salary_multiplier&.is_a?(String) != false || raise("Passed value for field obj.coverage_salary_multiplier is not the expected type, validation failed.")
  obj.company_contribution&.is_a?(String) != false || raise("Passed value for field obj.company_contribution is not the expected type, validation failed.")
  obj.contribute_as_percentage&.is_a?(Boolean) != false || raise("Passed value for field obj.contribute_as_percentage is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


189
190
191
# File 'lib/fern_gusto/types/employee_benefit.rb', line 189

def to_json
  @_field_set&.to_json
end