Class: Samsara::Types::AlertEventDevice
- Inherits:
-
Object
- Object
- Samsara::Types::AlertEventDevice
- Defined in:
- lib/samsara_api/types/alert_event_device.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#id ⇒ Integer
readonly
ID of the Vehicle or Asset.
-
#name ⇒ String
readonly
Name of the Vehicle or Asset.
-
#serial ⇒ String
readonly
Device serial number.
-
#vin ⇒ String
readonly
VIN if the gateway is tied to a vehicle.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id: OMIT, name: OMIT, serial: OMIT, vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertEventDevice constructor
- #to_json ⇒ String
Constructor Details
#initialize(id: OMIT, name: OMIT, serial: OMIT, vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertEventDevice
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/samsara_api/types/alert_event_device.rb', line 30 def initialize(id: OMIT, name: OMIT, serial: OMIT, vin: OMIT, additional_properties: nil) @id = id if id != OMIT @name = name if name != OMIT @serial = serial if serial != OMIT @vin = vin if vin != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "serial": serial, "vin": vin }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/samsara_api/types/alert_event_device.rb', line 17 def additional_properties @additional_properties end |
#id ⇒ Integer (readonly)
Returns ID of the Vehicle or Asset.
9 10 11 |
# File 'lib/samsara_api/types/alert_event_device.rb', line 9 def id @id end |
#name ⇒ String (readonly)
Returns Name of the Vehicle or Asset.
11 12 13 |
# File 'lib/samsara_api/types/alert_event_device.rb', line 11 def name @name end |
#serial ⇒ String (readonly)
Returns Device serial number.
13 14 15 |
# File 'lib/samsara_api/types/alert_event_device.rb', line 13 def serial @serial end |
#vin ⇒ String (readonly)
Returns VIN if the gateway is tied to a vehicle.
15 16 17 |
# File 'lib/samsara_api/types/alert_event_device.rb', line 15 def vin @vin end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::AlertEventDevice
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/samsara_api/types/alert_event_device.rb', line 44 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] name = parsed_json["name"] serial = parsed_json["serial"] vin = parsed_json["vin"] new( id: id, name: name, serial: serial, vin: vin, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
71 72 73 74 75 76 |
# File 'lib/samsara_api/types/alert_event_device.rb', line 71 def self.validate_raw(obj:) obj.id&.is_a?(Integer) != false || raise("Passed value for field obj.id 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.serial&.is_a?(String) != false || raise("Passed value for field obj.serial is not the expected type, validation failed.") obj.vin&.is_a?(String) != false || raise("Passed value for field obj.vin is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
62 63 64 |
# File 'lib/samsara_api/types/alert_event_device.rb', line 62 def to_json @_field_set&.to_json end |