Class: Gusto::EmployeeBenefitBaseObject

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(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::EmployeeBenefitBaseObject

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 98

def initialize(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)
  @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 = { "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.



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

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



58
59
60
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 58

def additional_properties
  @additional_properties
end

#catch_upObject (readonly)

401k benefits use this value for employees over 50.



38
39
40
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 38

def catch_up
  @catch_up
end

#company_contributionObject (readonly)

appear for tiered contribution types.



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

def company_contribution
  @company_contribution
end

#company_contribution_annual_maximumObject (readonly)

limit.



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

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.



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

def contribute_as_percentage
  @contribute_as_percentage
end

#contributionGusto::EmployeeBenefitBaseObjectContribution (readonly)

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

Returns:



24
25
26
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 24

def contribution
  @contribution
end

#coverage_amountObject (readonly)

be present if coverage amount is set.



43
44
45
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 43

def coverage_amount
  @coverage_amount
end

#coverage_salary_multiplierObject (readonly)

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



50
51
52
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 50

def coverage_salary_multiplier
  @coverage_salary_multiplier
end

#deduct_as_percentageObject (readonly)

deducted from each payroll.



20
21
22
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 20

def deduct_as_percentage
  @deduct_as_percentage
end

#deduction_reduces_taxable_incomeObject (readonly)

and coverage salary multiplier are ignored.



47
48
49
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 47

def deduction_reduces_taxable_income
  @deduction_reduces_taxable_income
end

#electiveObject (readonly)

contribution types, this is always true.



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

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.



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

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.



22
23
24
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 22

def employee_deduction_annual_maximum
  @employee_deduction_annual_maximum
end

#limit_optionObject (readonly)

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



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

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



40
41
42
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 40

def retirement_loan_identifier
  @retirement_loan_identifier
end

#versionObject (readonly)

on how to use this field.



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

def version
  @version
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::EmployeeBenefitBaseObject

Parameters:

  • json_object (String)

Returns:



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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 124

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  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(
    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)


180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 180

def self.validate_raw(obj:)
  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)


171
172
173
# File 'lib/fern_gusto/types/employee_benefit_base_object.rb', line 171

def to_json
  @_field_set&.to_json
end