Class: Samsara::Types::AlertEventDevice

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, name: OMIT, serial: OMIT, vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertEventDevice

Parameters:

  • id (Integer) (defaults to: OMIT)

    ID of the Vehicle or Asset

  • name (String) (defaults to: OMIT)

    Name of the Vehicle or Asset

  • serial (String) (defaults to: OMIT)

    Device serial number

  • vin (String) (defaults to: OMIT)

    VIN if the gateway is tied to a vehicle

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#idInteger (readonly)

Returns ID of the Vehicle or Asset.

Returns:

  • (Integer)

    ID of the Vehicle or Asset



9
10
11
# File 'lib/samsara_api/types/alert_event_device.rb', line 9

def id
  @id
end

#nameString (readonly)

Returns Name of the Vehicle or Asset.

Returns:

  • (String)

    Name of the Vehicle or Asset



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

def name
  @name
end

#serialString (readonly)

Returns Device serial number.

Returns:

  • (String)

    Device serial number



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

def serial
  @serial
end

#vinString (readonly)

Returns VIN if the gateway is tied to a vehicle.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (String)


62
63
64
# File 'lib/samsara_api/types/alert_event_device.rb', line 62

def to_json
  @_field_set&.to_json
end