Class: Samsara::Types::FollowingDistanceDetectionAlertSettingsObjectResponseBody

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

Overview

Distance will impact the drivers' safety score.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(duration_ms: OMIT, has_in_cab_audio_alerts_enabled: OMIT, is_enabled: OMIT, speeding_threshold_mph: OMIT, additional_properties: nil) ⇒ Samsara::Types::FollowingDistanceDetectionAlertSettingsObjectResponseBody

Parameters:

  • duration_ms (Long) (defaults to: OMIT) —

    Duration of following distance at which to alert, measured in milliseconds.

  • has_in_cab_audio_alerts_enabled (Boolean) (defaults to: OMIT) —

    Indicates whether in-cab audio alerts for following distance are turned on.

  • is_enabled (Boolean) (defaults to: OMIT) —

    Indicates whether AI event detection for following distance is turned on.

  • 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



33
34
35
36
37
38
39
40
41
42
# File 'lib/samsara_api/types/following_distance_detection_alert_settings_object_response_body.rb', line 33

def initialize(duration_ms: OMIT, has_in_cab_audio_alerts_enabled: OMIT, is_enabled: OMIT, speeding_threshold_mph: OMIT, additional_properties: nil)
  @duration_ms = duration_ms if duration_ms != OMIT
  @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
  @speeding_threshold_mph = speeding_threshold_mph if speeding_threshold_mph != OMIT
  @additional_properties = additional_properties
  @_field_set = { "durationMs": duration_ms, "hasInCabAudioAlertsEnabled": has_in_cab_audio_alerts_enabled, "isEnabled": is_enabled, "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



20
21
22
# File 'lib/samsara_api/types/following_distance_detection_alert_settings_object_response_body.rb', line 20

def additional_properties
  @additional_properties
end

#duration_ms ⇒ Long (readonly)

Returns Duration of following distance at which to alert, measured in milliseconds.

Returns:

  • (Long) —

    Duration of following distance at which to alert, measured in milliseconds.



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

def duration_ms
  @duration_ms
end

#has_in_cab_audio_alerts_enabled ⇒ Boolean (readonly)

Returns Indicates whether in-cab audio alerts for following distance are turned on.

Returns:

  • (Boolean) —

    Indicates whether in-cab audio alerts for following distance are turned on.



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

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 following distance is turned on.

Returns:

  • (Boolean) —

    Indicates whether AI event detection for following distance is turned on.



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

def is_enabled
  @is_enabled
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.



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

def speeding_threshold_mph
  @speeding_threshold_mph
end

Class Method Details

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



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/samsara_api/types/following_distance_detection_alert_settings_object_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)
  duration_ms = parsed_json["durationMs"]
  has_in_cab_audio_alerts_enabled = parsed_json["hasInCabAudioAlertsEnabled"]
  is_enabled = parsed_json["isEnabled"]
  speeding_threshold_mph = parsed_json["speedingThresholdMph"]
  new(
    duration_ms: duration_ms,
    has_in_cab_audio_alerts_enabled: has_in_cab_audio_alerts_enabled,
    is_enabled: is_enabled,
    speeding_threshold_mph: speeding_threshold_mph,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

def self.validate_raw(obj:)
  obj.duration_ms&.is_a?(Long) != false || raise("Passed value for field obj.duration_ms is not the expected type, validation failed.")
  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.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)


67
68
69
# File 'lib/samsara_api/types/following_distance_detection_alert_settings_object_response_body.rb', line 67

def to_json
  @_field_set&.to_json
end