Class: Samsara::Types::DefectTypesResponseDataResponseBody

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

Overview

Defect type data.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(created_at_time:, id:, label:, section_type:, additional_properties: nil) ⇒ Samsara::Types::DefectTypesResponseDataResponseBody



36
37
38
39
40
41
42
43
# File 'lib/samsara_api/types/defect_types_response_data_response_body.rb', line 36

def initialize(created_at_time:, id:, label:, section_type:, additional_properties: nil)
  @created_at_time = created_at_time
  @id = id
  @label = label
  @section_type = section_type
  @additional_properties = additional_properties
  @_field_set = { "createdAtTime": created_at_time, "id": id, "label": label, "sectionType": section_type }
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)



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

def additional_properties
  @additional_properties
end

#created_at_time ⇒ String (readonly)



11
12
13
# File 'lib/samsara_api/types/defect_types_response_data_response_body.rb', line 11

def created_at_time
  @created_at_time
end

#id ⇒ String (readonly)



13
14
15
# File 'lib/samsara_api/types/defect_types_response_data_response_body.rb', line 13

def id
  @id
end

#label ⇒ String (readonly)



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

def label
  @label
end

#section_type ⇒ Object (readonly)

unknown



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

def section_type
  @section_type
end

Class Method Details

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



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  created_at_time = parsed_json["createdAtTime"]
  id = parsed_json["id"]
  label = parsed_json["label"]
  section_type = parsed_json["sectionType"]
  new(
    created_at_time: created_at_time,
    id: id,
    label: label,
    section_type: section_type,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void



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

def self.validate_raw(obj:)
  obj.created_at_time.is_a?(String) != false || raise("Passed value for field obj.created_at_time is not the expected type, validation failed.")
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id 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.section_type.is_a?(Samsara::Types::DefectTypesResponseDataResponseBodySectionType) != false || raise("Passed value for field obj.section_type is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String



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

def to_json
  @_field_set&.to_json
end