Class: Samsara::Types::FormsSelectOptionObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::FormsSelectOptionObjectResponseBody
- Defined in:
- lib/samsara_api/types/forms_select_option_object_response_body.rb
Overview
Multiple choice or checkbox value option object.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#id ⇒ String
readonly
Identifier of the option.
-
#ignore_question_from_score_if_selected ⇒ Object
readonly
Only present when the select form field has scoring.
-
#label ⇒ String
readonly
Label of the option.
-
#option_score_weight ⇒ Object
readonly
option is selected.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::FormsSelectOptionObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(id:, ignore_question_from_score_if_selected: OMIT, label:, option_score_weight: OMIT, additional_properties: nil) ⇒ Samsara::Types::FormsSelectOptionObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, ignore_question_from_score_if_selected: OMIT, label:, option_score_weight: OMIT, additional_properties: nil) ⇒ Samsara::Types::FormsSelectOptionObjectResponseBody
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/samsara_api/types/forms_select_option_object_response_body.rb', line 37 def initialize(id:, ignore_question_from_score_if_selected: OMIT, label:, option_score_weight: OMIT, additional_properties: nil) @id = id @ignore_question_from_score_if_selected = ignore_question_from_score_if_selected if ignore_question_from_score_if_selected != OMIT @label = label @option_score_weight = option_score_weight if option_score_weight != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "ignoreQuestionFromScoreIfSelected": ignore_question_from_score_if_selected, "label": label, "optionScoreWeight": option_score_weight }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
21 22 23 |
# File 'lib/samsara_api/types/forms_select_option_object_response_body.rb', line 21 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns Identifier of the option.
10 11 12 |
# File 'lib/samsara_api/types/forms_select_option_object_response_body.rb', line 10 def id @id end |
#ignore_question_from_score_if_selected ⇒ Object (readonly)
Only present when the select form field has scoring.
14 15 16 |
# File 'lib/samsara_api/types/forms_select_option_object_response_body.rb', line 14 def ignore_question_from_score_if_selected @ignore_question_from_score_if_selected end |
#label ⇒ String (readonly)
Returns Label of the option.
16 17 18 |
# File 'lib/samsara_api/types/forms_select_option_object_response_body.rb', line 16 def label @label end |
#option_score_weight ⇒ Object (readonly)
option is selected. Only present if the select form field has scoring.
19 20 21 |
# File 'lib/samsara_api/types/forms_select_option_object_response_body.rb', line 19 def option_score_weight @option_score_weight end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::FormsSelectOptionObjectResponseBody
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/samsara_api/types/forms_select_option_object_response_body.rb', line 51 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] ignore_question_from_score_if_selected = parsed_json["ignoreQuestionFromScoreIfSelected"] label = parsed_json["label"] option_score_weight = parsed_json["optionScoreWeight"] new( id: id, ignore_question_from_score_if_selected: ignore_question_from_score_if_selected, label: label, option_score_weight: option_score_weight, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
78 79 80 81 82 83 |
# File 'lib/samsara_api/types/forms_select_option_object_response_body.rb', line 78 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.ignore_question_from_score_if_selected&.is_a?(Boolean) != false || raise("Passed value for field obj.ignore_question_from_score_if_selected is not the expected type, validation failed.") obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.") obj.option_score_weight&.is_a?(Long) != false || raise("Passed value for field obj.option_score_weight is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
69 70 71 |
# File 'lib/samsara_api/types/forms_select_option_object_response_body.rb', line 69 def to_json @_field_set&.to_json end |