Class: Samsara::Types::AlertEvent
- Inherits:
-
Object
- Object
- Samsara::Types::AlertEvent
- Defined in:
- lib/samsara_api/types/alert_event.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#alert_condition_description ⇒ String
readonly
Human-readable description of the alert condition.
-
#alert_condition_id ⇒ Samsara::Types::AlertEventAlertConditionId
readonly
Identifier for the type of alert.
-
#alert_event_url ⇒ String
readonly
Link to the alert in the Samsara dashboard.
-
#details ⇒ String
readonly
Human-readable string with dynamic details about the alert.
- #device ⇒ Samsara::Types::AlertEventDevice readonly
- #driver ⇒ Samsara::Types::AlertEventDriver readonly
-
#dvir ⇒ Samsara::Types::AlertEventDvir
readonly
DVIR-specific fields.
-
#org_id ⇒ Integer
readonly
Organization ID.
-
#resolved ⇒ Boolean
readonly
Whether the alert has been resolved.
-
#start_ms ⇒ Long
readonly
Unix epoch timestamp when the event was triggered.
-
#summary ⇒ String
readonly
Brief summary of the event.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(alert_event_url:, alert_condition_description:, alert_condition_id:, details:, org_id:, resolved:, start_ms:, summary:, device: OMIT, driver: OMIT, dvir: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertEvent constructor
- #to_json ⇒ String
Constructor Details
#initialize(alert_event_url:, alert_condition_description:, alert_condition_id:, details:, org_id:, resolved:, start_ms:, summary:, device: OMIT, driver: OMIT, dvir: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertEvent
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/samsara_api/types/alert_event.rb', line 55 def initialize(alert_event_url:, alert_condition_description:, alert_condition_id:, details:, org_id:, resolved:, start_ms:, summary:, device: OMIT, driver: OMIT, dvir: OMIT, additional_properties: nil) @alert_event_url = alert_event_url @alert_condition_description = alert_condition_description @alert_condition_id = alert_condition_id @details = details @org_id = org_id @resolved = resolved @start_ms = start_ms @summary = summary @device = device if device != OMIT @driver = driver if driver != OMIT @dvir = dvir if dvir != OMIT @additional_properties = additional_properties @_field_set = { "alertEventUrl": alert_event_url, "alertConditionDescription": alert_condition_description, "alertConditionId": alert_condition_id, "details": details, "orgId": org_id, "resolved": resolved, "startMs": start_ms, "summary": summary, "device": device, "driver": driver, "dvir": dvir }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
35 36 37 |
# File 'lib/samsara_api/types/alert_event.rb', line 35 def additional_properties @additional_properties end |
#alert_condition_description ⇒ String (readonly)
Returns Human-readable description of the alert condition.
15 16 17 |
# File 'lib/samsara_api/types/alert_event.rb', line 15 def alert_condition_description @alert_condition_description end |
#alert_condition_id ⇒ Samsara::Types::AlertEventAlertConditionId (readonly)
Returns Identifier for the type of alert.
17 18 19 |
# File 'lib/samsara_api/types/alert_event.rb', line 17 def alert_condition_id @alert_condition_id end |
#alert_event_url ⇒ String (readonly)
Returns Link to the alert in the Samsara dashboard.
13 14 15 |
# File 'lib/samsara_api/types/alert_event.rb', line 13 def alert_event_url @alert_event_url end |
#details ⇒ String (readonly)
Returns Human-readable string with dynamic details about the alert.
19 20 21 |
# File 'lib/samsara_api/types/alert_event.rb', line 19 def details @details end |
#device ⇒ Samsara::Types::AlertEventDevice (readonly)
29 30 31 |
# File 'lib/samsara_api/types/alert_event.rb', line 29 def device @device end |
#driver ⇒ Samsara::Types::AlertEventDriver (readonly)
31 32 33 |
# File 'lib/samsara_api/types/alert_event.rb', line 31 def driver @driver end |
#dvir ⇒ Samsara::Types::AlertEventDvir (readonly)
Returns DVIR-specific fields.
33 34 35 |
# File 'lib/samsara_api/types/alert_event.rb', line 33 def dvir @dvir end |
#org_id ⇒ Integer (readonly)
Returns Organization ID.
21 22 23 |
# File 'lib/samsara_api/types/alert_event.rb', line 21 def org_id @org_id end |
#resolved ⇒ Boolean (readonly)
Returns Whether the alert has been resolved.
23 24 25 |
# File 'lib/samsara_api/types/alert_event.rb', line 23 def resolved @resolved end |
#start_ms ⇒ Long (readonly)
Returns Unix epoch timestamp when the event was triggered.
25 26 27 |
# File 'lib/samsara_api/types/alert_event.rb', line 25 def start_ms @start_ms end |
#summary ⇒ String (readonly)
Returns Brief summary of the event.
27 28 29 |
# File 'lib/samsara_api/types/alert_event.rb', line 27 def summary @summary end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::AlertEvent
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/samsara_api/types/alert_event.rb', line 76 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) alert_event_url = parsed_json["alertEventUrl"] alert_condition_description = parsed_json["alertConditionDescription"] alert_condition_id = parsed_json["alertConditionId"] details = parsed_json["details"] org_id = parsed_json["orgId"] resolved = parsed_json["resolved"] start_ms = parsed_json["startMs"] summary = parsed_json["summary"] unless parsed_json["device"].nil? device = parsed_json["device"].to_json device = Samsara::Types::AlertEventDevice.from_json(json_object: device) else device = nil end unless parsed_json["driver"].nil? driver = parsed_json["driver"].to_json driver = Samsara::Types::AlertEventDriver.from_json(json_object: driver) else driver = nil end unless parsed_json["dvir"].nil? dvir = parsed_json["dvir"].to_json dvir = Samsara::Types::AlertEventDvir.from_json(json_object: dvir) else dvir = nil end new( alert_event_url: alert_event_url, alert_condition_description: alert_condition_description, alert_condition_id: alert_condition_id, details: details, org_id: org_id, resolved: resolved, start_ms: start_ms, summary: summary, device: device, driver: driver, dvir: dvir, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/samsara_api/types/alert_event.rb', line 132 def self.validate_raw(obj:) obj.alert_event_url.is_a?(String) != false || raise("Passed value for field obj.alert_event_url is not the expected type, validation failed.") obj.alert_condition_description.is_a?(String) != false || raise("Passed value for field obj.alert_condition_description is not the expected type, validation failed.") obj.alert_condition_id.is_a?(Samsara::Types::AlertEventAlertConditionId) != false || raise("Passed value for field obj.alert_condition_id is not the expected type, validation failed.") obj.details.is_a?(String) != false || raise("Passed value for field obj.details is not the expected type, validation failed.") obj.org_id.is_a?(Integer) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.resolved.is_a?(Boolean) != false || raise("Passed value for field obj.resolved is not the expected type, validation failed.") obj.start_ms.is_a?(Long) != false || raise("Passed value for field obj.start_ms is not the expected type, validation failed.") obj.summary.is_a?(String) != false || raise("Passed value for field obj.summary is not the expected type, validation failed.") obj.device.nil? || Samsara::Types::AlertEventDevice.validate_raw(obj: obj.device) obj.driver.nil? || Samsara::Types::AlertEventDriver.validate_raw(obj: obj.driver) obj.dvir.nil? || Samsara::Types::AlertEventDvir.validate_raw(obj: obj.dvir) end |
Instance Method Details
#to_json ⇒ String
123 124 125 |
# File 'lib/samsara_api/types/alert_event.rb', line 123 def to_json @_field_set&.to_json end |