Class: Samsara::Types::SafetyEventBehaviorLabel

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

Overview

The label and source of the label associated with the safety event.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, name: OMIT, source:, additional_properties: nil) ⇒ Samsara::Types::SafetyEventBehaviorLabel

Parameters:



30
31
32
33
34
35
36
37
38
# File 'lib/samsara_api/types/safety_event_behavior_label.rb', line 30

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



18
19
20
# File 'lib/samsara_api/types/safety_event_behavior_label.rb', line 18

def additional_properties
  @additional_properties
end

#label ⇒ Samsara::Types::SafetyEventBehaviorLabelType (readonly)



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

def label
  @label
end

#name ⇒ String (readonly)

Returns:

  • (String)


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

def name
  @name
end

#source ⇒ Samsara::Types::SafetyEventBehaviorLabelSource (readonly)



16
17
18
# File 'lib/samsara_api/types/safety_event_behavior_label.rb', line 16

def source
  @source
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/samsara_api/types/safety_event_behavior_label.rb', line 43

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

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

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


59
60
61
# File 'lib/samsara_api/types/safety_event_behavior_label.rb', line 59

def to_json
  @_field_set&.to_json
end