Class: Samsara::Types::SafetyEventBehaviorLabelsResponseBody

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

Overview

Behavior label for a safety event.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: OMIT, type: OMIT, additional_properties: nil) ⇒ Samsara::Types::SafetyEventBehaviorLabelsResponseBody

Parameters:

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

    Additional properties unmapped to the current class definition



42
43
44
45
46
47
48
49
# File 'lib/samsara_api/types/safety_event_behavior_labels_response_body.rb', line 42

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



23
24
25
# File 'lib/samsara_api/types/safety_event_behavior_labels_response_body.rb', line 23

def additional_properties
  @additional_properties
end

#name ⇒ String (readonly)

Returns Name of the behavior label.

Returns:

  • (String) —

    Name of the behavior label.



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

def name
  @name
end

#type ⇒ Object (readonly)

Smoking, Speeding, VulnerableRoadUserCollisionWarning, YawControl



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

def type
  @type
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/samsara_api/types/safety_event_behavior_labels_response_body.rb', line 55

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


78
79
80
81
# File 'lib/samsara_api/types/safety_event_behavior_labels_response_body.rb', line 78

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

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


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

def to_json
  @_field_set&.to_json
end