Class: Gusto::CompanyBenefits::BenefitSummary

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_date: OMIT, end_date: OMIT, description: OMIT, company_benefit_deduction: OMIT, company_benefit_contribution: OMIT, employees: OMIT, additional_properties: nil) ⇒ Gusto::CompanyBenefits::BenefitSummary

Parameters:



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fern_gusto/company_benefits/types/benefit_summary.rb', line 42

def initialize(start_date: OMIT, end_date: OMIT, description: OMIT, company_benefit_deduction: OMIT, company_benefit_contribution: OMIT, employees: OMIT, additional_properties: nil)
  @start_date = start_date if start_date != OMIT
  @end_date = end_date if end_date != OMIT
  @description = description if description != OMIT
  @company_benefit_deduction = company_benefit_deduction if company_benefit_deduction != OMIT
  @company_benefit_contribution = company_benefit_contribution if company_benefit_contribution != OMIT
  @employees = employees if employees != OMIT
  @additional_properties = additional_properties
  @_field_set = { "start_date": start_date, "end_date": end_date, "description": description, "company_benefit_deduction": company_benefit_deduction, "company_benefit_contribution": company_benefit_contribution, "employees": employees }.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



25
26
27
# File 'lib/fern_gusto/company_benefits/types/benefit_summary.rb', line 25

def additional_properties
  @additional_properties
end

#company_benefit_contributionObject (readonly)

and benefit type.



21
22
23
# File 'lib/fern_gusto/company_benefits/types/benefit_summary.rb', line 21

def company_benefit_contribution
  @company_benefit_contribution
end

#company_benefit_deductionObject (readonly)

and benefit type.



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

def company_benefit_deduction
  @company_benefit_deduction
end

#descriptionString (readonly)

Returns Description of the benefit.

Returns:

  • (String)

    Description of the benefit.



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

def description
  @description
end

#employeesGusto::CompanyBenefits::BenefitSummaryEmployees (readonly)



23
24
25
# File 'lib/fern_gusto/company_benefits/types/benefit_summary.rb', line 23

def employees
  @employees
end

#end_dateString (readonly)

Returns The end date of benefit summary.

Returns:

  • (String)

    The end date of benefit summary.



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

def end_date
  @end_date
end

#start_dateString (readonly)

Returns The start date of benefit summary.

Returns:

  • (String)

    The start date of benefit summary.



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

def start_date
  @start_date
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::CompanyBenefits::BenefitSummary

Parameters:

  • json_object (String)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/fern_gusto/company_benefits/types/benefit_summary.rb', line 58

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  start_date = parsed_json["start_date"]
  end_date = parsed_json["end_date"]
  description = parsed_json["description"]
  company_benefit_deduction = parsed_json["company_benefit_deduction"]
  company_benefit_contribution = parsed_json["company_benefit_contribution"]
  unless parsed_json["employees"].nil?
    employees = parsed_json["employees"].to_json
    employees = Gusto::CompanyBenefits::BenefitSummaryEmployees.from_json(json_object: employees)
  else
    employees = nil
  end
  new(
    start_date: start_date,
    end_date: end_date,
    description: description,
    company_benefit_deduction: company_benefit_deduction,
    company_benefit_contribution: company_benefit_contribution,
    employees: employees,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


94
95
96
97
98
99
100
101
# File 'lib/fern_gusto/company_benefits/types/benefit_summary.rb', line 94

def self.validate_raw(obj:)
  obj.start_date&.is_a?(String) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.")
  obj.end_date&.is_a?(String) != false || raise("Passed value for field obj.end_date 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.company_benefit_deduction&.is_a?(String) != false || raise("Passed value for field obj.company_benefit_deduction is not the expected type, validation failed.")
  obj.company_benefit_contribution&.is_a?(String) != false || raise("Passed value for field obj.company_benefit_contribution is not the expected type, validation failed.")
  obj.employees.nil? || Gusto::CompanyBenefits::BenefitSummaryEmployees.validate_raw(obj: obj.employees)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


85
86
87
# File 'lib/fern_gusto/company_benefits/types/benefit_summary.rb', line 85

def to_json
  @_field_set&.to_json
end