Class: Samsara::Types::FormsActionObjectResponseBody

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

Overview

Action object.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field_id: OMIT, section_id: OMIT, type:, additional_properties: nil) ⇒ Samsara::Types::FormsActionObjectResponseBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
44
45
# File 'lib/samsara_api/types/forms_action_object_response_body.rb', line 37

def initialize(field_id: OMIT, section_id: OMIT, type:, additional_properties: nil)
  @field_id = field_id if field_id != OMIT
  @section_id = section_id if section_id != OMIT
  @type = type
  @additional_properties = additional_properties
  @_field_set = { "fieldId": field_id, "sectionId": section_id, "type": type }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



21
22
23
# File 'lib/samsara_api/types/forms_action_object_response_body.rb', line 21

def additional_properties
  @additional_properties
end

#field_id ⇒ Object (readonly)

Only returned when the action type is askFollowupQuestion.



12
13
14
# File 'lib/samsara_api/types/forms_action_object_response_body.rb', line 12

def field_id
  @field_id
end

#section_id ⇒ Object (readonly)

met. Only returned when the action type is showSection.



15
16
17
# File 'lib/samsara_api/types/forms_action_object_response_body.rb', line 15

def section_id
  @section_id
end

#type ⇒ Object (readonly)

createIssue



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

def type
  @type
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/samsara_api/types/forms_action_object_response_body.rb', line 50

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  field_id = parsed_json["fieldId"]
  section_id = parsed_json["sectionId"]
  type = parsed_json["type"]
  new(
    field_id: field_id,
    section_id: section_id,
    type: type,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


75
76
77
78
79
# File 'lib/samsara_api/types/forms_action_object_response_body.rb', line 75

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

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


66
67
68
# File 'lib/samsara_api/types/forms_action_object_response_body.rb', line 66

def to_json
  @_field_set&.to_json
end