Class: Samsara::Types::DvirGetDvirResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::DvirGetDvirResponseBody
- Defined in:
- lib/samsara_api/types/dvir_get_dvir_response_body.rb
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::AuthorSignatureObjectResponseBody readonly
-
#defect_ids ⇒ Array<String>
readonly
IDs of defects registered for the DVIR.
-
#dvir_submission_begin_time ⇒ String
readonly
Time when driver created DVIR.
-
#dvir_submission_time ⇒ String
readonly
Time when driver submitted the DVIR.
- #formatted_address ⇒ String readonly
-
#id ⇒ String
readonly
The unique id of the DVIR.
-
#mechanic_notes ⇒ String
readonly
The mechanics notes on the DVIR.
-
#odometer_meters ⇒ Long
readonly
The odometer reading in meters.
-
#safety_status ⇒ Object
readonly
‘safe`, `unsafe`, `resolved`.
- #second_signature ⇒ Samsara::Types::AuthorSignatureObjectResponseBody readonly
- #third_signature ⇒ Samsara::Types::AuthorSignatureObjectResponseBody readonly
- #trailer ⇒ Samsara::Types::TrailerDvirObjectResponseBody readonly
-
#type ⇒ Object
readonly
‘unspecified`.
-
#updated_at_time ⇒ String
readonly
Time of any DVIR updates.
- #vehicle ⇒ Samsara::Types::VehicleDvirObjectResponseBody readonly
-
#walkaround_photos ⇒ Array<Samsara::Types::WalkaroundPhotoObjectResponseBody>
readonly
List of walkaround photos.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(author_signature:, defect_ids: OMIT, dvir_submission_begin_time:, dvir_submission_time:, formatted_address: OMIT, id:, mechanic_notes: OMIT, odometer_meters: OMIT, safety_status: OMIT, second_signature: OMIT, third_signature: OMIT, trailer: OMIT, type:, updated_at_time:, vehicle: OMIT, walkaround_photos: OMIT, additional_properties: nil) ⇒ Samsara::Types::DvirGetDvirResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(author_signature:, defect_ids: OMIT, dvir_submission_begin_time:, dvir_submission_time:, formatted_address: OMIT, id:, mechanic_notes: OMIT, odometer_meters: OMIT, safety_status: OMIT, second_signature: OMIT, third_signature: OMIT, trailer: OMIT, type:, updated_at_time:, vehicle: OMIT, walkaround_photos: OMIT, additional_properties: nil) ⇒ Samsara::Types::DvirGetDvirResponseBody
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 76 def initialize(author_signature:, defect_ids: OMIT, dvir_submission_begin_time:, dvir_submission_time:, formatted_address: OMIT, id:, mechanic_notes: OMIT, odometer_meters: OMIT, safety_status: OMIT, second_signature: OMIT, third_signature: OMIT, trailer: OMIT, type:, updated_at_time:, vehicle: OMIT, walkaround_photos: OMIT, additional_properties: nil) @author_signature = @defect_ids = defect_ids if defect_ids != OMIT @dvir_submission_begin_time = dvir_submission_begin_time @dvir_submission_time = dvir_submission_time @formatted_address = formatted_address if formatted_address != OMIT @id = id @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 @third_signature = third_signature if third_signature != OMIT @trailer = trailer if trailer != OMIT @type = type @updated_at_time = updated_at_time @vehicle = vehicle if vehicle != OMIT @walkaround_photos = walkaround_photos if walkaround_photos != OMIT @additional_properties = additional_properties @_field_set = { "authorSignature": , "defectIds": defect_ids, "dvirSubmissionBeginTime": dvir_submission_begin_time, "dvirSubmissionTime": dvir_submission_time, "formattedAddress": formatted_address, "id": id, "mechanicNotes": mechanic_notes, "odometerMeters": odometer_meters, "safetyStatus": safety_status, "secondSignature": second_signature, "thirdSignature": third_signature, "trailer": trailer, "type": type, "updatedAtTime": updated_at_time, "vehicle": vehicle, "walkaroundPhotos": walkaround_photos }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
49 50 51 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 49 def additional_properties @additional_properties end |
#author_signature ⇒ Samsara::Types::AuthorSignatureObjectResponseBody (readonly)
15 16 17 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 15 def @author_signature end |
#defect_ids ⇒ Array<String> (readonly)
Returns IDs of defects registered for the DVIR.
17 18 19 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 17 def defect_ids @defect_ids end |
#dvir_submission_begin_time ⇒ String (readonly)
Returns Time when driver created DVIR. UTC timestamp in RFC 3339 format.
19 20 21 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 19 def dvir_submission_begin_time @dvir_submission_begin_time end |
#dvir_submission_time ⇒ String (readonly)
Returns Time when driver submitted the DVIR. UTC timestamp in RFC 3339 format.
21 22 23 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 21 def dvir_submission_time @dvir_submission_time end |
#formatted_address ⇒ String (readonly)
23 24 25 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 23 def formatted_address @formatted_address end |
#id ⇒ String (readonly)
Returns The unique id of the DVIR.
25 26 27 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 25 def id @id end |
#mechanic_notes ⇒ String (readonly)
Returns The mechanics notes on the DVIR.
27 28 29 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 27 def mechanic_notes @mechanic_notes end |
#odometer_meters ⇒ Long (readonly)
Returns The odometer reading in meters.
29 30 31 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 29 def odometer_meters @odometer_meters end |
#safety_status ⇒ Object (readonly)
‘safe`, `unsafe`, `resolved`
32 33 34 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 32 def safety_status @safety_status end |
#second_signature ⇒ Samsara::Types::AuthorSignatureObjectResponseBody (readonly)
34 35 36 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 34 def second_signature @second_signature end |
#third_signature ⇒ Samsara::Types::AuthorSignatureObjectResponseBody (readonly)
36 37 38 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 36 def third_signature @third_signature end |
#trailer ⇒ Samsara::Types::TrailerDvirObjectResponseBody (readonly)
38 39 40 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 38 def trailer @trailer end |
#type ⇒ Object (readonly)
‘unspecified`
41 42 43 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 41 def type @type end |
#updated_at_time ⇒ String (readonly)
Returns Time of any DVIR updates. UTC timestamp in RFC 3339 format.
43 44 45 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 43 def updated_at_time @updated_at_time end |
#vehicle ⇒ Samsara::Types::VehicleDvirObjectResponseBody (readonly)
45 46 47 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 45 def vehicle @vehicle end |
#walkaround_photos ⇒ Array<Samsara::Types::WalkaroundPhotoObjectResponseBody> (readonly)
Returns List of walkaround photos.
47 48 49 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 47 def walkaround_photos @walkaround_photos end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::DvirGetDvirResponseBody
102 103 104 105 106 107 108 109 110 111 112 113 114 115 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 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 102 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::AuthorSignatureObjectResponseBody.from_json(json_object: ) else = nil end defect_ids = parsed_json["defectIds"] dvir_submission_begin_time = parsed_json["dvirSubmissionBeginTime"] dvir_submission_time = parsed_json["dvirSubmissionTime"] formatted_address = parsed_json["formattedAddress"] id = parsed_json["id"] 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::AuthorSignatureObjectResponseBody.from_json(json_object: second_signature) else second_signature = nil end unless parsed_json["thirdSignature"].nil? third_signature = parsed_json["thirdSignature"].to_json third_signature = Samsara::Types::AuthorSignatureObjectResponseBody.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::TrailerDvirObjectResponseBody.from_json(json_object: trailer) else trailer = nil end type = parsed_json["type"] updated_at_time = parsed_json["updatedAtTime"] unless parsed_json["vehicle"].nil? vehicle = parsed_json["vehicle"].to_json vehicle = Samsara::Types::VehicleDvirObjectResponseBody.from_json(json_object: vehicle) else vehicle = nil end walkaround_photos = parsed_json["walkaroundPhotos"]&.map do | item | item = item.to_json Samsara::Types::WalkaroundPhotoObjectResponseBody.from_json(json_object: item) end new( author_signature: , defect_ids: defect_ids, dvir_submission_begin_time: dvir_submission_begin_time, dvir_submission_time: dvir_submission_time, formatted_address: formatted_address, id: id, mechanic_notes: mechanic_notes, odometer_meters: odometer_meters, safety_status: safety_status, second_signature: second_signature, third_signature: third_signature, trailer: trailer, type: type, updated_at_time: updated_at_time, vehicle: vehicle, walkaround_photos: walkaround_photos, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 181 def self.validate_raw(obj:) Samsara::Types::AuthorSignatureObjectResponseBody.validate_raw(obj: obj.) obj.defect_ids&.is_a?(Array) != false || raise("Passed value for field obj.defect_ids is not the expected type, validation failed.") obj.dvir_submission_begin_time.is_a?(String) != false || raise("Passed value for field obj.dvir_submission_begin_time is not the expected type, validation failed.") obj.dvir_submission_time.is_a?(String) != false || raise("Passed value for field obj.dvir_submission_time is not the expected type, validation failed.") obj.formatted_address&.is_a?(String) != false || raise("Passed value for field obj.formatted_address 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.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?(Long) != false || raise("Passed value for field obj.odometer_meters is not the expected type, validation failed.") obj.safety_status&.is_a?(Samsara::Types::DvirGetDvirResponseBodySafetyStatus) != false || raise("Passed value for field obj.safety_status is not the expected type, validation failed.") obj.second_signature.nil? || Samsara::Types::AuthorSignatureObjectResponseBody.validate_raw(obj: obj.second_signature) obj.third_signature.nil? || Samsara::Types::AuthorSignatureObjectResponseBody.validate_raw(obj: obj.third_signature) obj.trailer.nil? || Samsara::Types::TrailerDvirObjectResponseBody.validate_raw(obj: obj.trailer) obj.type.is_a?(Samsara::Types::DvirGetDvirResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.updated_at_time.is_a?(String) != false || raise("Passed value for field obj.updated_at_time is not the expected type, validation failed.") obj.vehicle.nil? || Samsara::Types::VehicleDvirObjectResponseBody.validate_raw(obj: obj.vehicle) obj.walkaround_photos&.is_a?(Array) != false || raise("Passed value for field obj.walkaround_photos is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
172 173 174 |
# File 'lib/samsara_api/types/dvir_get_dvir_response_body.rb', line 172 def to_json @_field_set&.to_json end |