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

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (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/defect_types_response_data_response_body.rb', line 21

def additional_properties
  @additional_properties
end

#created_at_timeString (readonly)

Returns Time when defect type was created in RFC 3339 format.

Returns:

  • (String)

    Time when defect type was created in RFC 3339 format.



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

#idString (readonly)

Returns The unique ID of the DVIR defect type.

Returns:

  • (String)

    The unique ID of the DVIR defect type.



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

def id
  @id
end

#labelString (readonly)

Returns DVIR defect type label.

Returns:

  • (String)

    DVIR defect type label.



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

def label
  @label
end

#section_typeObject (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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (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