Class: Samsara::Types::VehicleStatsFaultCodes
- Inherits:
-
Object
- Object
- Samsara::Types::VehicleStatsFaultCodes
- Defined in:
- lib/samsara_api/types/vehicle_stats_fault_codes.rb
Overview
Engine fault codes read from J1939, OBDII, and OEM vehicles.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #can_bus_type ⇒ String readonly
- #j_1939 ⇒ Samsara::Types::VehicleStatsFaultCodesJ1939 readonly
- #obdii ⇒ Samsara::Types::VehicleStatsFaultCodesObdii readonly
- #oem ⇒ Samsara::Types::VehicleStatsFaultCodesOem readonly
- #time ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(can_bus_type: OMIT, j_1939: OMIT, obdii: OMIT, oem: OMIT, time:, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsFaultCodes constructor
- #to_json ⇒ String
Constructor Details
#initialize(can_bus_type: OMIT, j_1939: OMIT, obdii: OMIT, oem: OMIT, time:, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsFaultCodes
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 37 def initialize(can_bus_type: OMIT, j_1939: OMIT, obdii: OMIT, oem: OMIT, time:, 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 @time = time @additional_properties = additional_properties @_field_set = { "canBusType": can_bus_type, "j1939": j_1939, "obdii": obdii, "oem": oem, "time": time }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
23 24 25 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 23 def additional_properties @additional_properties end |
#can_bus_type ⇒ String (readonly)
13 14 15 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 13 def can_bus_type @can_bus_type end |
#j_1939 ⇒ Samsara::Types::VehicleStatsFaultCodesJ1939 (readonly)
15 16 17 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 15 def j_1939 @j_1939 end |
#obdii ⇒ Samsara::Types::VehicleStatsFaultCodesObdii (readonly)
17 18 19 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 17 def obdii @obdii end |
#oem ⇒ Samsara::Types::VehicleStatsFaultCodesOem (readonly)
19 20 21 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 19 def oem @oem end |
#time ⇒ String (readonly)
21 22 23 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 21 def time @time end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::VehicleStatsFaultCodes
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 78 79 80 81 82 83 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 52 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::VehicleStatsFaultCodesJ1939.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::VehicleStatsFaultCodesObdii.from_json(json_object: obdii) else obdii = nil end unless parsed_json["oem"].nil? oem = parsed_json["oem"].to_json oem = Samsara::Types::VehicleStatsFaultCodesOem.from_json(json_object: oem) else oem = nil end time = parsed_json["time"] new( can_bus_type: can_bus_type, j_1939: j_1939, obdii: obdii, oem: oem, time: time, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
96 97 98 99 100 101 102 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 96 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::VehicleStatsFaultCodesJ1939.validate_raw(obj: obj.j_1939) obj.obdii.nil? || Samsara::Types::VehicleStatsFaultCodesObdii.validate_raw(obj: obj.obdii) obj.oem.nil? || Samsara::Types::VehicleStatsFaultCodesOem.validate_raw(obj: obj.oem) obj.time.is_a?(String) != false || raise("Passed value for field obj.time is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
87 88 89 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes.rb', line 87 def to_json @_field_set&.to_json end |