Class: Samsara::Types::InattentiveDrivingDetectionAlertSettingsObjectResponseBody

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

Overview

Enables AI detection of inattentive driving events.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(has_in_cab_audio_alerts_enabled: OMIT, is_enabled: OMIT, severity: OMIT, speeding_threshold_mph: OMIT, additional_properties: nil) ⇒ Samsara::Types::InattentiveDrivingDetectionAlertSettingsObjectResponseBody

Parameters:

  • speeding_threshold_mph (Float) (defaults to: OMIT) —

    Alert when speed is over this many miles per hour.

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

    Additional properties unmapped to the current class definition



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

def initialize(has_in_cab_audio_alerts_enabled: OMIT, is_enabled: OMIT, severity: OMIT, speeding_threshold_mph: OMIT, additional_properties: nil)
  @has_in_cab_audio_alerts_enabled = has_in_cab_audio_alerts_enabled if has_in_cab_audio_alerts_enabled != OMIT
  @is_enabled = is_enabled if is_enabled != OMIT
  @severity = severity if severity != OMIT
  @speeding_threshold_mph = speeding_threshold_mph if speeding_threshold_mph != OMIT
  @additional_properties = additional_properties
  @_field_set = { "hasInCabAudioAlertsEnabled": has_in_cab_audio_alerts_enabled, "isEnabled": is_enabled, "severity": severity, "speedingThresholdMph": speeding_threshold_mph }.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/inattentive_driving_detection_alert_settings_object_response_body.rb', line 21

def additional_properties
  @additional_properties
end

#has_in_cab_audio_alerts_enabled ⇒ Boolean (readonly)

Returns Indicates whether in-cab audio alerts for inattentive driving are turned on.

Returns:

  • (Boolean) —

    Indicates whether in-cab audio alerts for inattentive driving are turned on.



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

def has_in_cab_audio_alerts_enabled
  @has_in_cab_audio_alerts_enabled
end

#is_enabled ⇒ Boolean (readonly)

Returns Indicates whether AI event detection for inattentive driving is turned on.

Returns:

  • (Boolean) —

    Indicates whether AI event detection for inattentive driving is turned on.



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

def is_enabled
  @is_enabled
end

#severity ⇒ Object (readonly)

for high severity events only). Valid values: low, medium, high



17
18
19
# File 'lib/samsara_api/types/inattentive_driving_detection_alert_settings_object_response_body.rb', line 17

def severity
  @severity
end

#speeding_threshold_mph ⇒ Float (readonly)

Returns Alert when speed is over this many miles per hour.

Returns:

  • (Float) —

    Alert when speed is over this many miles per hour.



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

def speeding_threshold_mph
  @speeding_threshold_mph
end

Class Method Details

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



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/samsara_api/types/inattentive_driving_detection_alert_settings_object_response_body.rb', line 51

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  has_in_cab_audio_alerts_enabled = parsed_json["hasInCabAudioAlertsEnabled"]
  is_enabled = parsed_json["isEnabled"]
  severity = parsed_json["severity"]
  speeding_threshold_mph = parsed_json["speedingThresholdMph"]
  new(
    has_in_cab_audio_alerts_enabled: has_in_cab_audio_alerts_enabled,
    is_enabled: is_enabled,
    severity: severity,
    speeding_threshold_mph: speeding_threshold_mph,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


79
80
81
82
83
84
# File 'lib/samsara_api/types/inattentive_driving_detection_alert_settings_object_response_body.rb', line 79

def self.validate_raw(obj:)
  obj.has_in_cab_audio_alerts_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.has_in_cab_audio_alerts_enabled is not the expected type, validation failed.")
  obj.is_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.is_enabled is not the expected type, validation failed.")
  obj.severity&.is_a?(Samsara::Types::InattentiveDrivingDetectionAlertSettingsObjectResponseBodySeverity) != false || raise("Passed value for field obj.severity is not the expected type, validation failed.")
  obj.speeding_threshold_mph&.is_a?(Float) != false || raise("Passed value for field obj.speeding_threshold_mph is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


70
71
72
# File 'lib/samsara_api/types/inattentive_driving_detection_alert_settings_object_response_body.rb', line 70

def to_json
  @_field_set&.to_json
end