Class: Samsara::Types::VehicleStatsFaultCodesJ1939TroubleCode

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

Overview

Diagnostic trouble code for J1939 vehicles.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fmi_description: OMIT, fmi_id:, mil_status:, occurrence_count:, source_address_name: OMIT, spn_description: OMIT, spn_id:, tx_id:, vendor_specific_fields: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsFaultCodesJ1939TroubleCode

Parameters:

  • fmi_description (String) (defaults to: OMIT) —

    A short description of the FMI identifier, if available.

  • fmi_id (Integer) —

    The FMI identifier.

  • mil_status (Integer) —

    The MIL status, indicating a check engine light.

  • occurrence_count (Integer) —

    The number of times this fault has triggered.

  • source_address_name (String) (defaults to: OMIT) —

    The source address name corresponding to the txId

  • spn_description (String) (defaults to: OMIT) —

    A short description of the SPN identifier, if available.

  • spn_id (Integer) —

    The SPN identifier.

  • tx_id (Integer)
  • vendor_specific_fields (Samsara::Types::VehicleStatsFaultCodesVendorSpecificFields) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_j_1939_trouble_code.rb', line 47

def initialize(fmi_description: OMIT, fmi_id:, mil_status:, occurrence_count:, source_address_name: OMIT, spn_description: OMIT, spn_id:, tx_id:, vendor_specific_fields: OMIT, additional_properties: nil)
  @fmi_description = fmi_description if fmi_description != OMIT
  @fmi_id = fmi_id
  @mil_status = mil_status
  @occurrence_count = occurrence_count
  @source_address_name = source_address_name if source_address_name != OMIT
  @spn_description = spn_description if spn_description != OMIT
  @spn_id = spn_id
  @tx_id = tx_id
  @vendor_specific_fields = vendor_specific_fields if vendor_specific_fields != OMIT
  @additional_properties = additional_properties
  @_field_set = { "fmiDescription": fmi_description, "fmiId": fmi_id, "milStatus": mil_status, "occurrenceCount": occurrence_count, "sourceAddressName": source_address_name, "spnDescription": spn_description, "spnId": spn_id, "txId": tx_id, "vendorSpecificFields": vendor_specific_fields }.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



29
30
31
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_j_1939_trouble_code.rb', line 29

def additional_properties
  @additional_properties
end

#fmi_description ⇒ String (readonly)

Returns A short description of the FMI identifier, if available.

Returns:

  • (String) —

    A short description of the FMI identifier, if available.



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

def fmi_description
  @fmi_description
end

#fmi_id ⇒ Integer (readonly)

Returns The FMI identifier.

Returns:

  • (Integer) —

    The FMI identifier.



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

def fmi_id
  @fmi_id
end

#mil_status ⇒ Integer (readonly)

Returns The MIL status, indicating a check engine light.

Returns:

  • (Integer) —

    The MIL status, indicating a check engine light.



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

def mil_status
  @mil_status
end

#occurrence_count ⇒ Integer (readonly)

Returns The number of times this fault has triggered.

Returns:

  • (Integer) —

    The number of times this fault has triggered.



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

def occurrence_count
  @occurrence_count
end

#source_address_name ⇒ String (readonly)

Returns The source address name corresponding to the txId.

Returns:

  • (String) —

    The source address name corresponding to the txId



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

def source_address_name
  @source_address_name
end

#spn_description ⇒ String (readonly)

Returns A short description of the SPN identifier, if available.

Returns:

  • (String) —

    A short description of the SPN identifier, if available.



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

def spn_description
  @spn_description
end

#spn_id ⇒ Integer (readonly)

Returns The SPN identifier.

Returns:

  • (Integer) —

    The SPN identifier.



23
24
25
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_j_1939_trouble_code.rb', line 23

def spn_id
  @spn_id
end

#tx_id ⇒ Integer (readonly)

Returns:

  • (Integer)


25
26
27
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_j_1939_trouble_code.rb', line 25

def tx_id
  @tx_id
end

#vendor_specific_fields ⇒ Samsara::Types::VehicleStatsFaultCodesVendorSpecificFields (readonly)



27
28
29
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_j_1939_trouble_code.rb', line 27

def vendor_specific_fields
  @vendor_specific_fields
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_j_1939_trouble_code.rb', line 67

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  fmi_description = parsed_json["fmiDescription"]
  fmi_id = parsed_json["fmiId"]
  mil_status = parsed_json["milStatus"]
  occurrence_count = parsed_json["occurrenceCount"]
  source_address_name = parsed_json["sourceAddressName"]
  spn_description = parsed_json["spnDescription"]
  spn_id = parsed_json["spnId"]
  tx_id = parsed_json["txId"]
  unless parsed_json["vendorSpecificFields"].nil?
    vendor_specific_fields = parsed_json["vendorSpecificFields"].to_json
    vendor_specific_fields = Samsara::Types::VehicleStatsFaultCodesVendorSpecificFields.from_json(json_object: vendor_specific_fields)
  else
    vendor_specific_fields = nil
  end
  new(
    fmi_description: fmi_description,
    fmi_id: fmi_id,
    mil_status: mil_status,
    occurrence_count: occurrence_count,
    source_address_name: source_address_name,
    spn_description: spn_description,
    spn_id: spn_id,
    tx_id: tx_id,
    vendor_specific_fields: vendor_specific_fields,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


109
110
111
112
113
114
115
116
117
118
119
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_j_1939_trouble_code.rb', line 109

def self.validate_raw(obj:)
  obj.fmi_description&.is_a?(String) != false || raise("Passed value for field obj.fmi_description is not the expected type, validation failed.")
  obj.fmi_id.is_a?(Integer) != false || raise("Passed value for field obj.fmi_id is not the expected type, validation failed.")
  obj.mil_status.is_a?(Integer) != false || raise("Passed value for field obj.mil_status is not the expected type, validation failed.")
  obj.occurrence_count.is_a?(Integer) != false || raise("Passed value for field obj.occurrence_count is not the expected type, validation failed.")
  obj.source_address_name&.is_a?(String) != false || raise("Passed value for field obj.source_address_name is not the expected type, validation failed.")
  obj.spn_description&.is_a?(String) != false || raise("Passed value for field obj.spn_description is not the expected type, validation failed.")
  obj.spn_id.is_a?(Integer) != false || raise("Passed value for field obj.spn_id is not the expected type, validation failed.")
  obj.tx_id.is_a?(Integer) != false || raise("Passed value for field obj.tx_id is not the expected type, validation failed.")
  obj.vendor_specific_fields.nil? || Samsara::Types::VehicleStatsFaultCodesVendorSpecificFields.validate_raw(obj: obj.vendor_specific_fields)
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


100
101
102
# File 'lib/samsara_api/types/vehicle_stats_fault_codes_j_1939_trouble_code.rb', line 100

def to_json
  @_field_set&.to_json
end