Class: Samsara::Types::VehicleStatsFaultCodesObdii
- Inherits:
-
Object
- Object
- Samsara::Types::VehicleStatsFaultCodesObdii
- Defined in:
- lib/samsara_api/types/vehicle_stats_fault_codes_obdii.rb
Overview
Vehicle fault codes for passenger 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_light_is_on ⇒ Object
readonly
any faults).
-
#diagnostic_trouble_codes ⇒ Array<Samsara::Types::VehicleStatsFaultCodesObdiiTroubleCode>
readonly
Diagnostic trouble codes for passenger vehicles.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(check_engine_light_is_on: OMIT, diagnostic_trouble_codes: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsFaultCodesObdii constructor
- #to_json ⇒ String
Constructor Details
#initialize(check_engine_light_is_on: OMIT, diagnostic_trouble_codes: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsFaultCodesObdii
28 29 30 31 32 33 34 35 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_obdii.rb', line 28 def initialize(check_engine_light_is_on: OMIT, diagnostic_trouble_codes: OMIT, additional_properties: nil) @check_engine_light_is_on = check_engine_light_is_on if check_engine_light_is_on != OMIT @diagnostic_trouble_codes = diagnostic_trouble_codes if diagnostic_trouble_codes != OMIT @additional_properties = additional_properties @_field_set = { "checkEngineLightIsOn": check_engine_light_is_on, "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_obdii.rb', line 16 def additional_properties @additional_properties end |
#check_engine_light_is_on ⇒ Object (readonly)
any faults).
12 13 14 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_obdii.rb', line 12 def check_engine_light_is_on @check_engine_light_is_on end |
#diagnostic_trouble_codes ⇒ Array<Samsara::Types::VehicleStatsFaultCodesObdiiTroubleCode> (readonly)
Returns Diagnostic trouble codes for passenger vehicles.
14 15 16 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_obdii.rb', line 14 def diagnostic_trouble_codes @diagnostic_trouble_codes end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::VehicleStatsFaultCodesObdii
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_obdii.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) check_engine_light_is_on = parsed_json["checkEngineLightIsOn"] diagnostic_trouble_codes = parsed_json["diagnosticTroubleCodes"]&.map do | item | item = item.to_json Samsara::Types::VehicleStatsFaultCodesObdiiTroubleCode.from_json(json_object: item) end new( check_engine_light_is_on: check_engine_light_is_on, diagnostic_trouble_codes: diagnostic_trouble_codes, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
66 67 68 69 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_obdii.rb', line 66 def self.validate_raw(obj:) obj.check_engine_light_is_on&.is_a?(Boolean) != false || raise("Passed value for field obj.check_engine_light_is_on is not the expected type, validation failed.") 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
57 58 59 |
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_obdii.rb', line 57 def to_json @_field_set&.to_json end |