Class: Samsara::Types::GrossVehicleWeight
- Inherits:
-
Object
- Object
- Samsara::Types::GrossVehicleWeight
- Defined in:
- lib/samsara_api/types/gross_vehicle_weight.rb
Overview
returned for customers with commercial speed limits (CSL) enabled.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#unit ⇒ Samsara::Types::GrossVehicleWeightUnit
readonly
The unit of weight for the vehicle.
-
#weight ⇒ Long
readonly
The weight value of the vehicle.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(unit: OMIT, weight: OMIT, additional_properties: nil) ⇒ Samsara::Types::GrossVehicleWeight constructor
- #to_json ⇒ String
Constructor Details
#initialize(unit: OMIT, weight: OMIT, additional_properties: nil) ⇒ Samsara::Types::GrossVehicleWeight
27 28 29 30 31 32 33 34 |
# File 'lib/samsara_api/types/gross_vehicle_weight.rb', line 27 def initialize(unit: OMIT, weight: OMIT, additional_properties: nil) @unit = unit if unit != OMIT @weight = weight if weight != OMIT @additional_properties = additional_properties @_field_set = { "unit": unit, "weight": weight }.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/gross_vehicle_weight.rb', line 16 def additional_properties @additional_properties end |
#unit ⇒ Samsara::Types::GrossVehicleWeightUnit (readonly)
Returns The unit of weight for the vehicle.
12 13 14 |
# File 'lib/samsara_api/types/gross_vehicle_weight.rb', line 12 def unit @unit end |
#weight ⇒ Long (readonly)
Returns The weight value of the vehicle.
14 15 16 |
# File 'lib/samsara_api/types/gross_vehicle_weight.rb', line 14 def weight @weight end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::GrossVehicleWeight
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/samsara_api/types/gross_vehicle_weight.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unit = parsed_json["unit"] weight = parsed_json["weight"] new( unit: unit, weight: weight, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
62 63 64 65 |
# File 'lib/samsara_api/types/gross_vehicle_weight.rb', line 62 def self.validate_raw(obj:) obj.unit&.is_a?(Samsara::Types::GrossVehicleWeightUnit) != false || raise("Passed value for field obj.unit is not the expected type, validation failed.") obj.weight&.is_a?(Long) != false || raise("Passed value for field obj.weight is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
53 54 55 |
# File 'lib/samsara_api/types/gross_vehicle_weight.rb', line 53 def to_json @_field_set&.to_json end |