Class: Samsara::Types::VehicleStatsFaultCodesValueJ1939
- Inherits:
-
Object
- Object
- Samsara::Types::VehicleStatsFaultCodesValueJ1939
- Defined in:
- lib/samsara_api/types/vehicle_stats_fault_codes_value_j_1939.rb
Overview
Vehicle fault codes for J1939 vehicles.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #check_engine_lights ⇒ Samsara::Types::VehicleStatsFaultCodesValueJ1939CheckEngineLights readonly
-
#diagnostic_trouble_codes ⇒ Array<Samsara::Types::VehicleStatsFaultCodesValueJ1939DiagnosticTroubleCodes>
readonly
Diagnostic trouble codes for J1939 vehicles.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::VehicleStatsFaultCodesValueJ1939
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(check_engine_lights: OMIT, diagnostic_trouble_codes: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsFaultCodesValueJ1939 constructor
- #to_json ⇒ String
Constructor Details
#initialize(check_engine_lights: OMIT, diagnostic_trouble_codes: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsFaultCodesValueJ1939
27 28 29 30 31 32 33 34 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value_j_1939.rb', line 27 def initialize(check_engine_lights: OMIT, diagnostic_trouble_codes: OMIT, additional_properties: nil) @check_engine_lights = check_engine_lights if check_engine_lights != OMIT @diagnostic_trouble_codes = diagnostic_trouble_codes if diagnostic_trouble_codes != OMIT @additional_properties = additional_properties @_field_set = { "checkEngineLights": check_engine_lights, "diagnosticTroubleCodes": diagnostic_trouble_codes }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value_j_1939.rb', line 16 def additional_properties @additional_properties end |
#check_engine_lights ⇒ Samsara::Types::VehicleStatsFaultCodesValueJ1939CheckEngineLights (readonly)
12 13 14 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value_j_1939.rb', line 12 def check_engine_lights @check_engine_lights end |
#diagnostic_trouble_codes ⇒ Array<Samsara::Types::VehicleStatsFaultCodesValueJ1939DiagnosticTroubleCodes> (readonly)
Returns Diagnostic trouble codes for J1939 vehicles.
14 15 16 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value_j_1939.rb', line 14 def diagnostic_trouble_codes @diagnostic_trouble_codes end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::VehicleStatsFaultCodesValueJ1939
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value_j_1939.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unless parsed_json["checkEngineLights"].nil? check_engine_lights = parsed_json["checkEngineLights"].to_json check_engine_lights = Samsara::Types::VehicleStatsFaultCodesValueJ1939CheckEngineLights.from_json(json_object: check_engine_lights) else check_engine_lights = nil end diagnostic_trouble_codes = parsed_json["diagnosticTroubleCodes"]&.map do | item | item = item.to_json Samsara::Types::VehicleStatsFaultCodesValueJ1939DiagnosticTroubleCodes.from_json(json_object: item) end new( check_engine_lights: check_engine_lights, diagnostic_trouble_codes: diagnostic_trouble_codes, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
70 71 72 73 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value_j_1939.rb', line 70 def self.validate_raw(obj:) obj.check_engine_lights.nil? || Samsara::Types::VehicleStatsFaultCodesValueJ1939CheckEngineLights.validate_raw(obj: obj.check_engine_lights) obj.diagnostic_trouble_codes&.is_a?(Array) != false || raise("Passed value for field obj.diagnostic_trouble_codes is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
61 62 63 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_value_j_1939.rb', line 61 def to_json @_field_set&.to_json end |