Class: Samsara::Types::VehicleStatsTirePressures

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

Overview

Tire pressure readings for each of four tires in kilopascals.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(back_left_tire_pressure_k_pa: OMIT, back_right_tire_pressure_k_pa: OMIT, front_left_tire_pressure_k_pa: OMIT, front_right_tire_pressure_k_pa: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsTirePressures

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



39
40
41
42
43
44
45
46
47
48
# File 'lib/samsara_api/types/vehicle_stats_tire_pressures.rb', line 39

def initialize(back_left_tire_pressure_k_pa: OMIT, back_right_tire_pressure_k_pa: OMIT, front_left_tire_pressure_k_pa: OMIT, front_right_tire_pressure_k_pa: OMIT, additional_properties: nil)
  @back_left_tire_pressure_k_pa = back_left_tire_pressure_k_pa if back_left_tire_pressure_k_pa != OMIT
  @back_right_tire_pressure_k_pa = back_right_tire_pressure_k_pa if back_right_tire_pressure_k_pa != OMIT
  @front_left_tire_pressure_k_pa = front_left_tire_pressure_k_pa if front_left_tire_pressure_k_pa != OMIT
  @front_right_tire_pressure_k_pa = front_right_tire_pressure_k_pa if front_right_tire_pressure_k_pa != OMIT
  @additional_properties = additional_properties
  @_field_set = { "backLeftTirePressureKPa": back_left_tire_pressure_k_pa, "backRightTirePressureKPa": back_right_tire_pressure_k_pa, "frontLeftTirePressureKPa": front_left_tire_pressure_k_pa, "frontRightTirePressureKPa": front_right_tire_pressure_k_pa }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



22
23
24
# File 'lib/samsara_api/types/vehicle_stats_tire_pressures.rb', line 22

def additional_properties
  @additional_properties
end

#back_left_tire_pressure_k_paObject (readonly)

in kilopascals.



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

def back_left_tire_pressure_k_pa
  @back_left_tire_pressure_k_pa
end

#back_right_tire_pressure_k_paObject (readonly)

vehicle in kilopascals.



14
15
16
# File 'lib/samsara_api/types/vehicle_stats_tire_pressures.rb', line 14

def back_right_tire_pressure_k_pa
  @back_right_tire_pressure_k_pa
end

#front_left_tire_pressure_k_paObject (readonly)

vehicle in kilopascals.



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

def front_left_tire_pressure_k_pa
  @front_left_tire_pressure_k_pa
end

#front_right_tire_pressure_k_paObject (readonly)

vehicle in kilopascals.



20
21
22
# File 'lib/samsara_api/types/vehicle_stats_tire_pressures.rb', line 20

def front_right_tire_pressure_k_pa
  @front_right_tire_pressure_k_pa
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/samsara_api/types/vehicle_stats_tire_pressures.rb', line 53

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  back_left_tire_pressure_k_pa = parsed_json["backLeftTirePressureKPa"]
  back_right_tire_pressure_k_pa = parsed_json["backRightTirePressureKPa"]
  front_left_tire_pressure_k_pa = parsed_json["frontLeftTirePressureKPa"]
  front_right_tire_pressure_k_pa = parsed_json["frontRightTirePressureKPa"]
  new(
    back_left_tire_pressure_k_pa: back_left_tire_pressure_k_pa,
    back_right_tire_pressure_k_pa: back_right_tire_pressure_k_pa,
    front_left_tire_pressure_k_pa: front_left_tire_pressure_k_pa,
    front_right_tire_pressure_k_pa: front_right_tire_pressure_k_pa,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


80
81
82
83
84
85
# File 'lib/samsara_api/types/vehicle_stats_tire_pressures.rb', line 80

def self.validate_raw(obj:)
  obj.back_left_tire_pressure_k_pa&.is_a?(Long) != false || raise("Passed value for field obj.back_left_tire_pressure_k_pa is not the expected type, validation failed.")
  obj.back_right_tire_pressure_k_pa&.is_a?(Long) != false || raise("Passed value for field obj.back_right_tire_pressure_k_pa is not the expected type, validation failed.")
  obj.front_left_tire_pressure_k_pa&.is_a?(Long) != false || raise("Passed value for field obj.front_left_tire_pressure_k_pa is not the expected type, validation failed.")
  obj.front_right_tire_pressure_k_pa&.is_a?(Long) != false || raise("Passed value for field obj.front_right_tire_pressure_k_pa is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


71
72
73
# File 'lib/samsara_api/types/vehicle_stats_tire_pressures.rb', line 71

def to_json
  @_field_set&.to_json
end