Class: Gusto::EmployeeTaxSetup::EmployeeStateTaxQuestion

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, description:, key:, input_question_format:, answers:, additional_properties: nil) ⇒ Gusto::EmployeeTaxSetup::EmployeeStateTaxQuestion

Parameters:



37
38
39
40
41
42
43
44
45
# File 'lib/fern_gusto/employee_tax_setup/types/employee_state_tax_question.rb', line 37

def initialize(label:, description:, key:, input_question_format:, answers:, additional_properties: nil)
  @label = label
  @description = description
  @key = key
  @input_question_format = input_question_format
  @answers = answers
  @additional_properties = additional_properties
  @_field_set = { "label": label, "description": description, "key": key, "input_question_format": input_question_format, "answers": answers }
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



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

def additional_properties
  @additional_properties
end

#answersArray<Gusto::EmployeeTaxSetup::EmployeeStateTaxAnswer> (readonly)



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

def answers
  @answers
end

#descriptionString (readonly)

Returns An explaination of the question - this may contain inline html formatted links.

Returns:

  • (String)

    An explaination of the question - this may contain inline html formatted links.



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

def description
  @description
end

#input_question_formatGusto::EmployeeTaxSetup::EmployeeStateTaxInputQuestionFormat (readonly)



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

def input_question_format
  @input_question_format
end

#keyObject (readonly)

the answer.



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

def key
  @key
end

#labelString (readonly)

Returns A short title for the question.

Returns:

  • (String)

    A short title for the question



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

def label
  @label
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::EmployeeTaxSetup::EmployeeStateTaxQuestion

Parameters:

  • json_object (String)

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/fern_gusto/employee_tax_setup/types/employee_state_tax_question.rb', line 50

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  label = parsed_json["label"]
  description = parsed_json["description"]
  key = parsed_json["key"]
  unless parsed_json["input_question_format"].nil?
    input_question_format = parsed_json["input_question_format"].to_json
    input_question_format = Gusto::EmployeeTaxSetup::EmployeeStateTaxInputQuestionFormat.from_json(json_object: input_question_format)
  else
    input_question_format = nil
  end
  answers = parsed_json["answers"]&.map do | item |
  item = item.to_json
  Gusto::EmployeeTaxSetup::EmployeeStateTaxAnswer.from_json(json_object: item)
end
  new(
    label: label,
    description: description,
    key: key,
    input_question_format: input_question_format,
    answers: answers,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


87
88
89
90
91
92
93
# File 'lib/fern_gusto/employee_tax_setup/types/employee_state_tax_question.rb', line 87

def self.validate_raw(obj:)
  obj.label.is_a?(String) != false || raise("Passed value for field obj.label 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.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
  Gusto::EmployeeTaxSetup::EmployeeStateTaxInputQuestionFormat.validate_raw(obj: obj.input_question_format)
  obj.answers.is_a?(Array) != false || raise("Passed value for field obj.answers is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


78
79
80
# File 'lib/fern_gusto/employee_tax_setup/types/employee_state_tax_question.rb', line 78

def to_json
  @_field_set&.to_json
end