Class: Gusto::EmployeeBenefitBaseObjectContribution
- Inherits:
-
Object
- Object
- Gusto::EmployeeBenefitBaseObjectContribution
- Defined in:
- lib/fern_gusto/types/employee_benefit_base_object_contribution.rb
Overview
An object representing the type and value of the company contribution.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#type ⇒ Object
readonly
deduction.
-
#value ⇒ Object
readonly
For the ‘tiered` contribution type, an array of tiers.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(type: OMIT, value: OMIT, additional_properties: nil) ⇒ Gusto::EmployeeBenefitBaseObjectContribution constructor
- #to_json ⇒ String
Constructor Details
#initialize(type: OMIT, value: OMIT, additional_properties: nil) ⇒ Gusto::EmployeeBenefitBaseObjectContribution
43 44 45 46 47 48 49 50 |
# File 'lib/fern_gusto/types/employee_benefit_base_object_contribution.rb', line 43 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_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
23 24 25 |
# File 'lib/fern_gusto/types/employee_benefit_base_object_contribution.rb', line 23 def additional_properties @additional_properties end |
#type ⇒ Object (readonly)
deduction.
17 18 19 |
# File 'lib/fern_gusto/types/employee_benefit_base_object_contribution.rb', line 17 def type @type end |
#value ⇒ Object (readonly)
For the ‘tiered` contribution type, an array of tiers.
21 22 23 |
# File 'lib/fern_gusto/types/employee_benefit_base_object_contribution.rb', line 21 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::EmployeeBenefitBaseObjectContribution
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fern_gusto/types/employee_benefit_base_object_contribution.rb', line 56 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::EmployeeBenefitBaseObjectContributionValue.from_json(json_object: value) else value = nil end new( type: type, value: value, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
84 85 86 87 |
# File 'lib/fern_gusto/types/employee_benefit_base_object_contribution.rb', line 84 def self.validate_raw(obj:) obj.type&.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.value.nil? || Gusto::EmployeeBenefitBaseObjectContributionValue.validate_raw(obj: obj.value) end |
Instance Method Details
#to_json ⇒ String
75 76 77 |
# File 'lib/fern_gusto/types/employee_benefit_base_object_contribution.rb', line 75 def to_json @_field_set&.to_json end |