Class: Gusto::CompanyBenefit

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

Overview

The representation of a company benefit.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version: OMIT, uuid:, benefit_type: OMIT, active: OMIT, description: OMIT, deletable: OMIT, supports_percentage_amounts: OMIT, responsible_for_employer_taxes: OMIT, responsible_for_employee_w2: OMIT, additional_properties: nil) ⇒ Gusto::CompanyBenefit

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/fern_gusto/types/company_benefit.rb', line 67

def initialize(version: OMIT, uuid:, benefit_type: OMIT, active: OMIT, description: OMIT, deletable: OMIT, supports_percentage_amounts: OMIT, responsible_for_employer_taxes: OMIT, responsible_for_employee_w2: OMIT, additional_properties: nil)
  @version = version if version != OMIT
  @uuid = uuid
  @benefit_type = benefit_type if benefit_type != OMIT
  @active = active if active != OMIT
  @description = description if description != OMIT
  @deletable = deletable if deletable != OMIT
  @supports_percentage_amounts = supports_percentage_amounts if supports_percentage_amounts != OMIT
  @responsible_for_employer_taxes = responsible_for_employer_taxes if responsible_for_employer_taxes != OMIT
  @responsible_for_employee_w2 = responsible_for_employee_w2 if responsible_for_employee_w2 != OMIT
  @additional_properties = additional_properties
  @_field_set = { "version": version, "uuid": uuid, "benefit_type": benefit_type, "active": active, "description": description, "deletable": deletable, "supports_percentage_amounts": supports_percentage_amounts, "responsible_for_employer_taxes": responsible_for_employer_taxes, "responsible_for_employee_w2": responsible_for_employee_w2 }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#activeObject (readonly)

only be deactivated if no employees are actively participating.



18
19
20
# File 'lib/fern_gusto/types/company_benefit.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



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

def additional_properties
  @additional_properties
end

#benefit_typeFloat (readonly)

Returns The type of the benefit to which the company benefit belongs.

Returns:

  • (Float)

    The type of the benefit to which the company benefit belongs.



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

def benefit_type
  @benefit_type
end

#deletableObject (readonly)

and the benefit is not owned by Gusto or a Partner



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

def deletable
  @deletable
end

#descriptionObject (readonly)

something more specific like “Kaiser Permanente” or “Blue Cross/ Blue Shield”.



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

def description
  @description
end

#responsible_for_employee_w2Object (readonly)

applicable to third party sick pay benefits.



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

def responsible_for_employee_w2
  @responsible_for_employee_w2
end

#responsible_for_employer_taxesObject (readonly)

leave. Only applicable to third party sick pay benefits.



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

def responsible_for_employer_taxes
  @responsible_for_employer_taxes
end

#supports_percentage_amountsObject (readonly)

and is not configurable by the company.



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

def supports_percentage_amounts
  @supports_percentage_amounts
end

#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/company_benefit.rb', line 13

def uuid
  @uuid
end

#versionObject (readonly)

on how to use this field.



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

def version
  @version
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::CompanyBenefit

Parameters:

  • json_object (String)

Returns:



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
# File 'lib/fern_gusto/types/company_benefit.rb', line 86

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  version = parsed_json["version"]
  uuid = parsed_json["uuid"]
  benefit_type = parsed_json["benefit_type"]
  active = parsed_json["active"]
  description = parsed_json["description"]
  deletable = parsed_json["deletable"]
  supports_percentage_amounts = parsed_json["supports_percentage_amounts"]
  responsible_for_employer_taxes = parsed_json["responsible_for_employer_taxes"]
  responsible_for_employee_w2 = parsed_json["responsible_for_employee_w2"]
  new(
    version: version,
    uuid: uuid,
    benefit_type: benefit_type,
    active: active,
    description: description,
    deletable: deletable,
    supports_percentage_amounts: supports_percentage_amounts,
    responsible_for_employer_taxes: responsible_for_employer_taxes,
    responsible_for_employee_w2: responsible_for_employee_w2,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


123
124
125
126
127
128
129
130
131
132
133
# File 'lib/fern_gusto/types/company_benefit.rb', line 123

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.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.")
  obj.benefit_type&.is_a?(Float) != false || raise("Passed value for field obj.benefit_type 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.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.deletable&.is_a?(Boolean) != false || raise("Passed value for field obj.deletable is not the expected type, validation failed.")
  obj.supports_percentage_amounts&.is_a?(Boolean) != false || raise("Passed value for field obj.supports_percentage_amounts is not the expected type, validation failed.")
  obj.responsible_for_employer_taxes&.is_a?(Boolean) != false || raise("Passed value for field obj.responsible_for_employer_taxes is not the expected type, validation failed.")
  obj.responsible_for_employee_w2&.is_a?(Boolean) != false || raise("Passed value for field obj.responsible_for_employee_w2 is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


114
115
116
# File 'lib/fern_gusto/types/company_benefit.rb', line 114

def to_json
  @_field_set&.to_json
end