Class: Samsara::Types::VehicleStatsFaultCodesValue

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

Overview

Fault codes for the vehicle

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(can_bus_type: OMIT, j_1939: OMIT, obdii: OMIT, oem: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsFaultCodesValue

Parameters:



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

def initialize(can_bus_type: OMIT, j_1939: OMIT, obdii: OMIT, oem: OMIT, additional_properties: nil)
  @can_bus_type = can_bus_type if can_bus_type != OMIT
  @j_1939 = j_1939 if j_1939 != OMIT
  @obdii = obdii if obdii != OMIT
  @oem = oem if oem != OMIT
  @additional_properties = additional_properties
  @_field_set = { "canBusType": can_bus_type, "j1939": j_1939, "obdii": obdii, "oem": oem }.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



21
22
23
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value.rb', line 21

def additional_properties
  @additional_properties
end

#can_bus_type ⇒ String (readonly)

Returns The CAN bus type of the vehicle.

Returns:

  • (String) —

    The CAN bus type of the vehicle.



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

def can_bus_type
  @can_bus_type
end

#j_1939 ⇒ Samsara::Types::VehicleStatsFaultCodesValueJ1939 (readonly)



15
16
17
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value.rb', line 15

def j_1939
  @j_1939
end

#obdii ⇒ Samsara::Types::VehicleStatsFaultCodesValueObdii (readonly)



17
18
19
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value.rb', line 17

def obdii
  @obdii
end

#oem ⇒ Samsara::Types::VehicleStatsFaultCodesValueOem (readonly)



19
20
21
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value.rb', line 19

def oem
  @oem
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value.rb', line 48

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  can_bus_type = parsed_json["canBusType"]
  unless parsed_json["j1939"].nil?
    j_1939 = parsed_json["j1939"].to_json
    j_1939 = Samsara::Types::VehicleStatsFaultCodesValueJ1939.from_json(json_object: j_1939)
  else
    j_1939 = nil
  end
  unless parsed_json["obdii"].nil?
    obdii = parsed_json["obdii"].to_json
    obdii = Samsara::Types::VehicleStatsFaultCodesValueObdii.from_json(json_object: obdii)
  else
    obdii = nil
  end
  unless parsed_json["oem"].nil?
    oem = parsed_json["oem"].to_json
    oem = Samsara::Types::VehicleStatsFaultCodesValueOem.from_json(json_object: oem)
  else
    oem = nil
  end
  new(
    can_bus_type: can_bus_type,
    j_1939: j_1939,
    obdii: obdii,
    oem: oem,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


90
91
92
93
94
95
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value.rb', line 90

def self.validate_raw(obj:)
  obj.can_bus_type&.is_a?(String) != false || raise("Passed value for field obj.can_bus_type is not the expected type, validation failed.")
  obj.j_1939.nil? || Samsara::Types::VehicleStatsFaultCodesValueJ1939.validate_raw(obj: obj.j_1939)
  obj.obdii.nil? || Samsara::Types::VehicleStatsFaultCodesValueObdii.validate_raw(obj: obj.obdii)
  obj.oem.nil? || Samsara::Types::VehicleStatsFaultCodesValueOem.validate_raw(obj: obj.oem)
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


81
82
83
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value.rb', line 81

def to_json
  @_field_set&.to_json
end