Class: Gusto::Employees::Benefits::BenefitsCreateRequestContribution

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/employees/benefits/types/benefits_create_request_contribution.rb

Overview

An object representing the company contribution type and value.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: OMIT, value: OMIT, additional_properties: nil) ⇒ Gusto::Employees::Benefits::BenefitsCreateRequestContribution

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



46
47
48
49
50
51
52
53
# File 'lib/fern_gusto/employees/benefits/types/benefits_create_request_contribution.rb', line 46

def initialize(type: OMIT, value: OMIT, additional_properties: nil)
  @type = type if type != OMIT
  @value = value if value != OMIT
  @additional_properties = additional_properties
  @_field_set = { "type": type, "value": value }.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



26
27
28
# File 'lib/fern_gusto/employees/benefits/types/benefits_create_request_contribution.rb', line 26

def additional_properties
  @additional_properties
end

#typeObject (readonly)

employee deduction relative to a tiered matching scheme.



20
21
22
# File 'lib/fern_gusto/employees/benefits/types/benefits_create_request_contribution.rb', line 20

def type
  @type
end

#valueObject (readonly)

For the ‘tiered` contribution type, an array of tiers.



24
25
26
# File 'lib/fern_gusto/employees/benefits/types/benefits_create_request_contribution.rb', line 24

def value
  @value
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Employees::Benefits::BenefitsCreateRequestContribution

Parameters:

  • json_object (String)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/fern_gusto/employees/benefits/types/benefits_create_request_contribution.rb', line 58

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  type = parsed_json["type"]
  unless parsed_json["value"].nil?
    value = parsed_json["value"].to_json
    value = Gusto::Employees::Benefits::BenefitsCreateRequestContributionValue.from_json(json_object: value)
  else
    value = nil
  end
  new(
    type: type,
    value: value,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


86
87
88
89
# File 'lib/fern_gusto/employees/benefits/types/benefits_create_request_contribution.rb', line 86

def self.validate_raw(obj:)
  obj.type&.is_a?(Gusto::Employees::Benefits::BenefitsCreateRequestContributionType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.value.nil? || Gusto::Employees::Benefits::BenefitsCreateRequestContributionValue.validate_raw(obj: obj.value)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


77
78
79
# File 'lib/fern_gusto/employees/benefits/types/benefits_create_request_contribution.rb', line 77

def to_json
  @_field_set&.to_json
end