Class: Samsara::Types::PolicyViolationsDetectionAlertSettingsObjectResponseBody

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

Overview

recommended for testing use only.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(events_available_for_testing: OMIT, events_to_coach: OMIT, has_in_cab_audio_alerts_enabled: OMIT, is_enabled: OMIT, speeding_threshold_mph: OMIT, additional_properties: nil) ⇒ Samsara::Types::PolicyViolationsDetectionAlertSettingsObjectResponseBody

Parameters:



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/samsara_api/types/policy_violations_detection_alert_settings_object_response_body.rb', line 38

def initialize(events_available_for_testing: OMIT, events_to_coach: OMIT, has_in_cab_audio_alerts_enabled: OMIT, is_enabled: OMIT, speeding_threshold_mph: OMIT, additional_properties: nil)
  @events_available_for_testing = events_available_for_testing if events_available_for_testing != OMIT
  @events_to_coach = events_to_coach if events_to_coach != 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 = { "eventsAvailableForTesting": events_available_for_testing, "eventsToCoach": events_to_coach, "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



24
25
26
# File 'lib/samsara_api/types/policy_violations_detection_alert_settings_object_response_body.rb', line 24

def additional_properties
  @additional_properties
end

#events_available_for_testing ⇒ Array<Samsara::Types::PolicyViolationsDetectionAlertSettingsObjectResponseBodyEventsAvailableForTestingItem> (readonly)

Returns List of selectable beta policy violation events to be tested.

Returns:



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

def events_available_for_testing
  @events_available_for_testing
end

#events_to_coach ⇒ Array<Samsara::Types::PolicyViolationsDetectionAlertSettingsObjectResponseBodyEventsToCoachItem> (readonly)

Returns List of selectable policy violation events to enable coaching for.

Returns:



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

def events_to_coach
  @events_to_coach
end

#has_in_cab_audio_alerts_enabled ⇒ Boolean (readonly)

Returns Indicates whether in-cab audio alerts for rolling stops are turned on.

Returns:

  • (Boolean) —

    Indicates whether in-cab audio alerts for rolling stops are turned on.



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

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 rolling stops is turned on.

Returns:

  • (Boolean) —

    Indicates whether AI event detection for rolling stops is turned on.



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

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.



22
23
24
# File 'lib/samsara_api/types/policy_violations_detection_alert_settings_object_response_body.rb', line 22

def speeding_threshold_mph
  @speeding_threshold_mph
end

Class Method Details

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



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/samsara_api/types/policy_violations_detection_alert_settings_object_response_body.rb', line 54

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  events_available_for_testing = parsed_json["eventsAvailableForTesting"]
  events_to_coach = parsed_json["eventsToCoach"]
  has_in_cab_audio_alerts_enabled = parsed_json["hasInCabAudioAlertsEnabled"]
  is_enabled = parsed_json["isEnabled"]
  speeding_threshold_mph = parsed_json["speedingThresholdMph"]
  new(
    events_available_for_testing: events_available_for_testing,
    events_to_coach: events_to_coach,
    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)


84
85
86
87
88
89
90
# File 'lib/samsara_api/types/policy_violations_detection_alert_settings_object_response_body.rb', line 84

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


75
76
77
# File 'lib/samsara_api/types/policy_violations_detection_alert_settings_object_response_body.rb', line 75

def to_json
  @_field_set&.to_json
end