Class: Samsara::Types::Dvir
- Inherits:
-
Object
- Object
- Samsara::Types::Dvir
- Defined in:
- lib/samsara_api/types/dvir.rb
Overview
Information about a DVIR.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #author_signature ⇒ Samsara::Types::DvirAuthorSignature readonly
-
#end_time ⇒ Object
readonly
format.
-
#id ⇒ String
readonly
Unique Samsara ID for the DVIR.
- #license_plate ⇒ String readonly
- #location ⇒ String readonly
- #mechanic_notes ⇒ String readonly
- #odometer_meters ⇒ Integer readonly
-
#safety_status ⇒ Object
readonly
resolved. - #second_signature ⇒ Samsara::Types::DvirSecondSignature readonly
-
#start_time ⇒ Object
readonly
Example:
2020-01-27T07:06:25Z. - #third_signature ⇒ Samsara::Types::DvirThirdSignature readonly
- #trailer ⇒ Samsara::Types::DvirTrailer readonly
- #trailer_defects ⇒ Samsara::Types::DVIR_TRAILER_DEFECTS readonly
-
#trailer_name ⇒ Object
readonly
tractor+trailer DVIRs.
-
#type ⇒ Object
readonly
unspecified. - #vehicle ⇒ Samsara::Types::DvirVehicle readonly
- #vehicle_defects ⇒ Samsara::Types::DVIR_VEHICLE_DEFECTS readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(author_signature: OMIT, end_time: OMIT, id:, license_plate: OMIT, location: OMIT, mechanic_notes: OMIT, odometer_meters: OMIT, safety_status: OMIT, second_signature: OMIT, start_time: OMIT, third_signature: OMIT, trailer: OMIT, trailer_defects: OMIT, trailer_name: OMIT, type: OMIT, vehicle: OMIT, vehicle_defects: OMIT, additional_properties: nil) ⇒ Samsara::Types::Dvir constructor
- #to_json ⇒ String
Constructor Details
#initialize(author_signature: OMIT, end_time: OMIT, id:, license_plate: OMIT, location: OMIT, mechanic_notes: OMIT, odometer_meters: OMIT, safety_status: OMIT, second_signature: OMIT, start_time: OMIT, third_signature: OMIT, trailer: OMIT, trailer_defects: OMIT, trailer_name: OMIT, type: OMIT, vehicle: OMIT, vehicle_defects: OMIT, additional_properties: nil) ⇒ Samsara::Types::Dvir
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/samsara_api/types/dvir.rb', line 89 def initialize(author_signature: OMIT, end_time: OMIT, id:, license_plate: OMIT, location: OMIT, mechanic_notes: OMIT, odometer_meters: OMIT, safety_status: OMIT, second_signature: OMIT, start_time: OMIT, third_signature: OMIT, trailer: OMIT, trailer_defects: OMIT, trailer_name: OMIT, type: OMIT, vehicle: OMIT, vehicle_defects: OMIT, additional_properties: nil) @author_signature = if != OMIT @end_time = end_time if end_time != OMIT @id = id @license_plate = license_plate if license_plate != OMIT @location = location if location != OMIT @mechanic_notes = mechanic_notes if mechanic_notes != OMIT @odometer_meters = odometer_meters if odometer_meters != OMIT @safety_status = safety_status if safety_status != OMIT @second_signature = second_signature if second_signature != OMIT @start_time = start_time if start_time != OMIT @third_signature = third_signature if third_signature != OMIT @trailer = trailer if trailer != OMIT @trailer_defects = trailer_defects if trailer_defects != OMIT @trailer_name = trailer_name if trailer_name != OMIT @type = type if type != OMIT @vehicle = vehicle if vehicle != OMIT @vehicle_defects = vehicle_defects if vehicle_defects != OMIT @additional_properties = additional_properties @_field_set = { "authorSignature": , "endTime": end_time, "id": id, "licensePlate": license_plate, "location": location, "mechanicNotes": mechanic_notes, "odometerMeters": odometer_meters, "safetyStatus": safety_status, "secondSignature": second_signature, "startTime": start_time, "thirdSignature": third_signature, "trailer": trailer, "trailerDefects": trailer_defects, "trailerName": trailer_name, "type": type, "vehicle": vehicle, "vehicleDefects": vehicle_defects }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
58 59 60 |
# File 'lib/samsara_api/types/dvir.rb', line 58 def additional_properties @additional_properties end |
#author_signature ⇒ Samsara::Types::DvirAuthorSignature (readonly)
19 20 21 |
# File 'lib/samsara_api/types/dvir.rb', line 19 def @author_signature end |
#end_time ⇒ Object (readonly)
format. Example: 2020-01-27T07:06:25Z.
22 23 24 |
# File 'lib/samsara_api/types/dvir.rb', line 22 def end_time @end_time end |
#id ⇒ String (readonly)
Returns Unique Samsara ID for the DVIR.
24 25 26 |
# File 'lib/samsara_api/types/dvir.rb', line 24 def id @id end |
#license_plate ⇒ String (readonly)
26 27 28 |
# File 'lib/samsara_api/types/dvir.rb', line 26 def license_plate @license_plate end |
#location ⇒ String (readonly)
28 29 30 |
# File 'lib/samsara_api/types/dvir.rb', line 28 def location @location end |
#mechanic_notes ⇒ String (readonly)
30 31 32 |
# File 'lib/samsara_api/types/dvir.rb', line 30 def mechanic_notes @mechanic_notes end |
#odometer_meters ⇒ Integer (readonly)
32 33 34 |
# File 'lib/samsara_api/types/dvir.rb', line 32 def odometer_meters @odometer_meters end |
#safety_status ⇒ Object (readonly)
resolved.
35 36 37 |
# File 'lib/samsara_api/types/dvir.rb', line 35 def safety_status @safety_status end |
#second_signature ⇒ Samsara::Types::DvirSecondSignature (readonly)
37 38 39 |
# File 'lib/samsara_api/types/dvir.rb', line 37 def second_signature @second_signature end |
#start_time ⇒ Object (readonly)
Example: 2020-01-27T07:06:25Z.
40 41 42 |
# File 'lib/samsara_api/types/dvir.rb', line 40 def start_time @start_time end |
#third_signature ⇒ Samsara::Types::DvirThirdSignature (readonly)
42 43 44 |
# File 'lib/samsara_api/types/dvir.rb', line 42 def third_signature @third_signature end |
#trailer ⇒ Samsara::Types::DvirTrailer (readonly)
44 45 46 |
# File 'lib/samsara_api/types/dvir.rb', line 44 def trailer @trailer end |
#trailer_defects ⇒ Samsara::Types::DVIR_TRAILER_DEFECTS (readonly)
46 47 48 |
# File 'lib/samsara_api/types/dvir.rb', line 46 def trailer_defects @trailer_defects end |
#trailer_name ⇒ Object (readonly)
tractor+trailer DVIRs.
49 50 51 |
# File 'lib/samsara_api/types/dvir.rb', line 49 def trailer_name @trailer_name end |
#type ⇒ Object (readonly)
unspecified.
52 53 54 |
# File 'lib/samsara_api/types/dvir.rb', line 52 def type @type end |
#vehicle ⇒ Samsara::Types::DvirVehicle (readonly)
54 55 56 |
# File 'lib/samsara_api/types/dvir.rb', line 54 def vehicle @vehicle end |
#vehicle_defects ⇒ Samsara::Types::DVIR_VEHICLE_DEFECTS (readonly)
56 57 58 |
# File 'lib/samsara_api/types/dvir.rb', line 56 def vehicle_defects @vehicle_defects end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::Dvir
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/samsara_api/types/dvir.rb', line 116 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unless parsed_json["authorSignature"].nil? = parsed_json["authorSignature"].to_json = Samsara::Types::DvirAuthorSignature.from_json(json_object: ) else = nil end end_time = parsed_json["endTime"] id = parsed_json["id"] license_plate = parsed_json["licensePlate"] location = parsed_json["location"] mechanic_notes = parsed_json["mechanicNotes"] odometer_meters = parsed_json["odometerMeters"] safety_status = parsed_json["safetyStatus"] unless parsed_json["secondSignature"].nil? second_signature = parsed_json["secondSignature"].to_json second_signature = Samsara::Types::DvirSecondSignature.from_json(json_object: second_signature) else second_signature = nil end start_time = parsed_json["startTime"] unless parsed_json["thirdSignature"].nil? third_signature = parsed_json["thirdSignature"].to_json third_signature = Samsara::Types::DvirThirdSignature.from_json(json_object: third_signature) else third_signature = nil end unless parsed_json["trailer"].nil? trailer = parsed_json["trailer"].to_json trailer = Samsara::Types::DvirTrailer.from_json(json_object: trailer) else trailer = nil end trailer_defects = parsed_json["trailerDefects"]&.map do | item | item = item.to_json Samsara::Types::DvirTrailerDefectsItems.from_json(json_object: item) end trailer_name = parsed_json["trailerName"] type = parsed_json["type"] unless parsed_json["vehicle"].nil? vehicle = parsed_json["vehicle"].to_json vehicle = Samsara::Types::DvirVehicle.from_json(json_object: vehicle) else vehicle = nil end vehicle_defects = parsed_json["vehicleDefects"]&.map do | item | item = item.to_json Samsara::Types::DvirTrailerDefectsItems.from_json(json_object: item) end new( author_signature: , end_time: end_time, id: id, license_plate: license_plate, location: location, mechanic_notes: mechanic_notes, odometer_meters: odometer_meters, safety_status: safety_status, second_signature: second_signature, start_time: start_time, third_signature: third_signature, trailer: trailer, trailer_defects: trailer_defects, trailer_name: trailer_name, type: type, vehicle: vehicle, vehicle_defects: vehicle_defects, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/samsara_api/types/dvir.rb', line 200 def self.validate_raw(obj:) obj..nil? || Samsara::Types::DvirAuthorSignature.validate_raw(obj: obj.) obj.end_time&.is_a?(String) != false || raise("Passed value for field obj.end_time is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.license_plate&.is_a?(String) != false || raise("Passed value for field obj.license_plate is not the expected type, validation failed.") obj.location&.is_a?(String) != false || raise("Passed value for field obj.location is not the expected type, validation failed.") obj.mechanic_notes&.is_a?(String) != false || raise("Passed value for field obj.mechanic_notes is not the expected type, validation failed.") obj.odometer_meters&.is_a?(Integer) != false || raise("Passed value for field obj.odometer_meters is not the expected type, validation failed.") obj.safety_status&.is_a?(Samsara::Types::DvirSafetyStatus) != false || raise("Passed value for field obj.safety_status is not the expected type, validation failed.") obj.second_signature.nil? || Samsara::Types::DvirSecondSignature.validate_raw(obj: obj.second_signature) obj.start_time&.is_a?(String) != false || raise("Passed value for field obj.start_time is not the expected type, validation failed.") obj.third_signature.nil? || Samsara::Types::DvirThirdSignature.validate_raw(obj: obj.third_signature) obj.trailer.nil? || Samsara::Types::DvirTrailer.validate_raw(obj: obj.trailer) obj.trailer_defects&.is_a?(Array) != false || raise("Passed value for field obj.trailer_defects is not the expected type, validation failed.") obj.trailer_name&.is_a?(String) != false || raise("Passed value for field obj.trailer_name is not the expected type, validation failed.") obj.type&.is_a?(Samsara::Types::DvirType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.vehicle.nil? || Samsara::Types::DvirVehicle.validate_raw(obj: obj.vehicle) obj.vehicle_defects&.is_a?(Array) != false || raise("Passed value for field obj.vehicle_defects is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
191 192 193 |
# File 'lib/samsara_api/types/dvir.rb', line 191 def to_json @_field_set&.to_json end |