Class: Samsara::Types::DefectsResponseDataResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::DefectsResponseDataResponseBody
- Defined in:
- lib/samsara_api/types/defects_response_data_response_body.rb
Overview
DVIR defects data.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#comment ⇒ String
readonly
Comment on the defect.
-
#created_at_time ⇒ String
readonly
Time when defect was created in RFC 3339 format.
-
#defect_photos ⇒ Array<Samsara::Types::DefectPhotoResponseResponseBody>
readonly
List of DVIR defect's photos.
-
#defect_type_id ⇒ String
readonly
The unique ID of the defect type.
-
#dvir_id ⇒ String
readonly
The unique ID of the defect's DVIR.
-
#id ⇒ String
readonly
The unique ID of the DVIR defect.
-
#is_resolved ⇒ Boolean
readonly
Signifies if this defect is resolved.
-
#mechanic_notes ⇒ String
readonly
The mechanics notes on the defect.
-
#resolved_at_time ⇒ Object
readonly
the defect is unresolved.
- #resolved_by ⇒ Samsara::Types::DvirResolvedByObjectResponseBody readonly
- #trailer ⇒ Samsara::Types::DefectTrailerResponseResponseBody readonly
-
#updated_at_time ⇒ String
readonly
Time when defect was last updated in RFC 3339 format.
- #vehicle ⇒ Samsara::Types::DefectVehicleResponseResponseBody readonly
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::DefectsResponseDataResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(comment:, created_at_time: OMIT, defect_photos: OMIT, defect_type_id: OMIT, dvir_id:, id:, is_resolved:, mechanic_notes: OMIT, resolved_at_time: OMIT, resolved_by: OMIT, trailer: OMIT, updated_at_time: OMIT, vehicle: OMIT, additional_properties: nil) ⇒ Samsara::Types::DefectsResponseDataResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(comment:, created_at_time: OMIT, defect_photos: OMIT, defect_type_id: OMIT, dvir_id:, id:, is_resolved:, mechanic_notes: OMIT, resolved_at_time: OMIT, resolved_by: OMIT, trailer: OMIT, updated_at_time: OMIT, vehicle: OMIT, additional_properties: nil) ⇒ Samsara::Types::DefectsResponseDataResponseBody
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 64 def initialize(comment:, created_at_time: OMIT, defect_photos: OMIT, defect_type_id: OMIT, dvir_id:, id:, is_resolved:, mechanic_notes: OMIT, resolved_at_time: OMIT, resolved_by: OMIT, trailer: OMIT, updated_at_time: OMIT, vehicle: OMIT, additional_properties: nil) @comment = comment @created_at_time = created_at_time if created_at_time != OMIT @defect_photos = defect_photos if defect_photos != OMIT @defect_type_id = defect_type_id if defect_type_id != OMIT @dvir_id = dvir_id @id = id @is_resolved = is_resolved @mechanic_notes = mechanic_notes if mechanic_notes != OMIT @resolved_at_time = resolved_at_time if resolved_at_time != OMIT @resolved_by = resolved_by if resolved_by != OMIT @trailer = trailer if trailer != OMIT @updated_at_time = updated_at_time if updated_at_time != OMIT @vehicle = vehicle if vehicle != OMIT @additional_properties = additional_properties @_field_set = { "comment": comment, "createdAtTime": created_at_time, "defectPhotos": defect_photos, "defectTypeId": defect_type_id, "dvirId": dvir_id, "id": id, "isResolved": is_resolved, "mechanicNotes": mechanic_notes, "resolvedAtTime": resolved_at_time, "resolvedBy": resolved_by, "trailer": trailer, "updatedAtTime": updated_at_time, "vehicle": vehicle }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
41 42 43 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 41 def additional_properties @additional_properties end |
#comment ⇒ String (readonly)
Returns Comment on the defect.
14 15 16 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 14 def comment @comment end |
#created_at_time ⇒ String (readonly)
Returns Time when defect was created in RFC 3339 format.
16 17 18 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 16 def created_at_time @created_at_time end |
#defect_photos ⇒ Array<Samsara::Types::DefectPhotoResponseResponseBody> (readonly)
Returns List of DVIR defect's photos.
18 19 20 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 18 def defect_photos @defect_photos end |
#defect_type_id ⇒ String (readonly)
Returns The unique ID of the defect type.
20 21 22 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 20 def defect_type_id @defect_type_id end |
#dvir_id ⇒ String (readonly)
Returns The unique ID of the defect's DVIR.
22 23 24 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 22 def dvir_id @dvir_id end |
#id ⇒ String (readonly)
Returns The unique ID of the DVIR defect.
24 25 26 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 24 def id @id end |
#is_resolved ⇒ Boolean (readonly)
Returns Signifies if this defect is resolved.
26 27 28 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 26 def is_resolved @is_resolved end |
#mechanic_notes ⇒ String (readonly)
Returns The mechanics notes on the defect.
28 29 30 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 28 def mechanic_notes @mechanic_notes end |
#resolved_at_time ⇒ Object (readonly)
the defect is unresolved.
31 32 33 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 31 def resolved_at_time @resolved_at_time end |
#resolved_by ⇒ Samsara::Types::DvirResolvedByObjectResponseBody (readonly)
33 34 35 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 33 def resolved_by @resolved_by end |
#trailer ⇒ Samsara::Types::DefectTrailerResponseResponseBody (readonly)
35 36 37 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 35 def trailer @trailer end |
#updated_at_time ⇒ String (readonly)
Returns Time when defect was last updated in RFC 3339 format.
37 38 39 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 37 def updated_at_time @updated_at_time end |
#vehicle ⇒ Samsara::Types::DefectVehicleResponseResponseBody (readonly)
39 40 41 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 39 def vehicle @vehicle end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::DefectsResponseDataResponseBody
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 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 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 87 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) comment = parsed_json["comment"] created_at_time = parsed_json["createdAtTime"] defect_photos = parsed_json["defectPhotos"]&.map do | item | item = item.to_json Samsara::Types::DefectPhotoResponseResponseBody.from_json(json_object: item) end defect_type_id = parsed_json["defectTypeId"] dvir_id = parsed_json["dvirId"] id = parsed_json["id"] is_resolved = parsed_json["isResolved"] mechanic_notes = parsed_json["mechanicNotes"] resolved_at_time = parsed_json["resolvedAtTime"] unless parsed_json["resolvedBy"].nil? resolved_by = parsed_json["resolvedBy"].to_json resolved_by = Samsara::Types::DvirResolvedByObjectResponseBody.from_json(json_object: resolved_by) else resolved_by = nil end unless parsed_json["trailer"].nil? trailer = parsed_json["trailer"].to_json trailer = Samsara::Types::DefectTrailerResponseResponseBody.from_json(json_object: trailer) else trailer = nil end updated_at_time = parsed_json["updatedAtTime"] unless parsed_json["vehicle"].nil? vehicle = parsed_json["vehicle"].to_json vehicle = Samsara::Types::DefectVehicleResponseResponseBody.from_json(json_object: vehicle) else vehicle = nil end new( comment: comment, created_at_time: created_at_time, defect_photos: defect_photos, defect_type_id: defect_type_id, dvir_id: dvir_id, id: id, is_resolved: is_resolved, mechanic_notes: mechanic_notes, resolved_at_time: resolved_at_time, resolved_by: resolved_by, trailer: trailer, updated_at_time: updated_at_time, vehicle: vehicle, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 150 def self.validate_raw(obj:) obj.comment.is_a?(String) != false || raise("Passed value for field obj.comment is not the expected type, validation failed.") obj.created_at_time&.is_a?(String) != false || raise("Passed value for field obj.created_at_time is not the expected type, validation failed.") obj.defect_photos&.is_a?(Array) != false || raise("Passed value for field obj.defect_photos is not the expected type, validation failed.") obj.defect_type_id&.is_a?(String) != false || raise("Passed value for field obj.defect_type_id is not the expected type, validation failed.") obj.dvir_id.is_a?(String) != false || raise("Passed value for field obj.dvir_id 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.is_resolved.is_a?(Boolean) != false || raise("Passed value for field obj.is_resolved 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.resolved_at_time&.is_a?(String) != false || raise("Passed value for field obj.resolved_at_time is not the expected type, validation failed.") obj.resolved_by.nil? || Samsara::Types::DvirResolvedByObjectResponseBody.validate_raw(obj: obj.resolved_by) obj.trailer.nil? || Samsara::Types::DefectTrailerResponseResponseBody.validate_raw(obj: obj.trailer) 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::DefectVehicleResponseResponseBody.validate_raw(obj: obj.vehicle) end |
Instance Method Details
#to_json ⇒ String
141 142 143 |
# File 'lib/samsara_api/types/defects_response_data_response_body.rb', line 141 def to_json @_field_set&.to_json end |