Class: Gusto::SupportedBenefit

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(benefit_type: OMIT, name: OMIT, description: OMIT, pretax: OMIT, posttax: OMIT, imputed: OMIT, healthcare: OMIT, retirement: OMIT, yearly_limit: OMIT, category: OMIT, additional_properties: nil) ⇒ Gusto::SupportedBenefit

Parameters:

  • posttax (Boolean) (defaults to: OMIT)

    Whether the benefit is deducted after tax calculations.

  • imputed (Boolean) (defaults to: OMIT)

    Whether the benefit is considered imputed income.

  • healthcare (Boolean) (defaults to: OMIT)

    Whether the benefit is healthcare related.

  • retirement (Boolean) (defaults to: OMIT)

    Whether the benefit is associated with retirement planning.

  • yearly_limit (Boolean) (defaults to: OMIT)

    Whether the benefit has a government mandated yearly limit.

  • category (String) (defaults to: OMIT)

    Category where the benefit belongs to.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fern_gusto/types/supported_benefit.rb', line 50

def initialize(benefit_type: OMIT, name: OMIT, description: OMIT, pretax: OMIT, posttax: OMIT, imputed: OMIT, healthcare: OMIT, retirement: OMIT, yearly_limit: OMIT, category: OMIT, additional_properties: nil)
  @benefit_type = benefit_type if benefit_type != OMIT
  @name = name if name != OMIT
  @description = description if description != OMIT
  @pretax = pretax if pretax != OMIT
  @posttax = posttax if posttax != OMIT
  @imputed = imputed if imputed != OMIT
  @healthcare = healthcare if healthcare != OMIT
  @retirement = retirement if retirement != OMIT
  @yearly_limit = yearly_limit if yearly_limit != OMIT
  @category = category if category != OMIT
  @additional_properties = additional_properties
  @_field_set = { "benefit_type": benefit_type, "name": name, "description": description, "pretax": pretax, "posttax": posttax, "imputed": imputed, "healthcare": healthcare, "retirement": retirement, "yearly_limit": yearly_limit, "category": category }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#benefit_typeFloat (readonly)

Returns The benefit type in Gusto.

Returns:

  • (Float)

    The benefit type in Gusto.



9
10
11
# File 'lib/fern_gusto/types/supported_benefit.rb', line 9

def benefit_type
  @benefit_type
end

#categoryString (readonly)

Returns Category where the benefit belongs to.

Returns:

  • (String)

    Category where the benefit belongs to.



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

def category
  @category
end

#descriptionString (readonly)

Returns The description of the benefit.

Returns:

  • (String)

    The description of the benefit.



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

def description
  @description
end

#healthcareBoolean (readonly)

Returns Whether the benefit is healthcare related.

Returns:

  • (Boolean)

    Whether the benefit is healthcare related.



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

def healthcare
  @healthcare
end

#imputedBoolean (readonly)

Returns Whether the benefit is considered imputed income.

Returns:

  • (Boolean)

    Whether the benefit is considered imputed income.



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

def imputed
  @imputed
end

#nameString (readonly)

Returns The name of the benefit.

Returns:

  • (String)

    The name of the benefit.



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

def name
  @name
end

#posttaxBoolean (readonly)

Returns Whether the benefit is deducted after tax calculations.

Returns:

  • (Boolean)

    Whether the benefit is deducted after tax calculations.



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

def posttax
  @posttax
end

#pretaxObject (readonly)

taxable income



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

def pretax
  @pretax
end

#retirementBoolean (readonly)

Returns Whether the benefit is associated with retirement planning.

Returns:

  • (Boolean)

    Whether the benefit is associated with retirement planning.



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

def retirement
  @retirement
end

#yearly_limitBoolean (readonly)

Returns Whether the benefit has a government mandated yearly limit.

Returns:

  • (Boolean)

    Whether the benefit has a government mandated yearly limit.



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

def yearly_limit
  @yearly_limit
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::SupportedBenefit

Parameters:

  • json_object (String)

Returns:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/fern_gusto/types/supported_benefit.rb', line 70

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  benefit_type = parsed_json["benefit_type"]
  name = parsed_json["name"]
  description = parsed_json["description"]
  pretax = parsed_json["pretax"]
  posttax = parsed_json["posttax"]
  imputed = parsed_json["imputed"]
  healthcare = parsed_json["healthcare"]
  retirement = parsed_json["retirement"]
  yearly_limit = parsed_json["yearly_limit"]
  category = parsed_json["category"]
  new(
    benefit_type: benefit_type,
    name: name,
    description: description,
    pretax: pretax,
    posttax: posttax,
    imputed: imputed,
    healthcare: healthcare,
    retirement: retirement,
    yearly_limit: yearly_limit,
    category: category,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/fern_gusto/types/supported_benefit.rb', line 109

def self.validate_raw(obj:)
  obj.benefit_type&.is_a?(Float) != false || raise("Passed value for field obj.benefit_type 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.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.pretax&.is_a?(Boolean) != false || raise("Passed value for field obj.pretax is not the expected type, validation failed.")
  obj.posttax&.is_a?(Boolean) != false || raise("Passed value for field obj.posttax is not the expected type, validation failed.")
  obj.imputed&.is_a?(Boolean) != false || raise("Passed value for field obj.imputed is not the expected type, validation failed.")
  obj.healthcare&.is_a?(Boolean) != false || raise("Passed value for field obj.healthcare is not the expected type, validation failed.")
  obj.retirement&.is_a?(Boolean) != false || raise("Passed value for field obj.retirement is not the expected type, validation failed.")
  obj.yearly_limit&.is_a?(Boolean) != false || raise("Passed value for field obj.yearly_limit is not the expected type, validation failed.")
  obj.category&.is_a?(String) != false || raise("Passed value for field obj.category is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


100
101
102
# File 'lib/fern_gusto/types/supported_benefit.rb', line 100

def to_json
  @_field_set&.to_json
end