Class: Samsara::Types::FormsConditionObjectResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/forms_condition_object_response_body.rb

Overview

Forms condition object.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(selected_option_ids: OMIT, type:, additional_properties: nil) ⇒ Samsara::Types::FormsConditionObjectResponseBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



34
35
36
37
38
39
40
41
# File 'lib/samsara_api/types/forms_condition_object_response_body.rb', line 34

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



19
20
21
# File 'lib/samsara_api/types/forms_condition_object_response_body.rb', line 19

def additional_properties
  @additional_properties
end

#selected_option_idsObject (readonly)

‘multipleChoiceValueCondition` or `checkBoxesValueCondition`.



14
15
16
# File 'lib/samsara_api/types/forms_condition_object_response_body.rb', line 14

def selected_option_ids
  @selected_option_ids
end

#typeObject (readonly)

‘multipleChoiceValueCondition`, `checkBoxesValueCondition`



17
18
19
# File 'lib/samsara_api/types/forms_condition_object_response_body.rb', line 17

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::FormsConditionObjectResponseBody

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/samsara_api/types/forms_condition_object_response_body.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  selected_option_ids = parsed_json["selectedOptionIds"]
  type = parsed_json["type"]
  new(
    selected_option_ids: selected_option_ids,
    type: type,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


69
70
71
72
# File 'lib/samsara_api/types/forms_condition_object_response_body.rb', line 69

def self.validate_raw(obj:)
  obj.selected_option_ids&.is_a?(Array) != false || raise("Passed value for field obj.selected_option_ids is not the expected type, validation failed.")
  obj.type.is_a?(Samsara::Types::FormsConditionObjectResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


60
61
62
# File 'lib/samsara_api/types/forms_condition_object_response_body.rb', line 60

def to_json
  @_field_set&.to_json
end