Class: Samsara::Types::DvirDefectGetDefectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::DvirDefectGetDefectResponseBody
- Defined in:
- lib/samsara_api/types/dvir_defect_get_defect_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.
-
#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::DvirDefectGetDefectResponseBody
- .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::DvirDefectGetDefectResponseBody 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::DvirDefectGetDefectResponseBody
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 63 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.
40 41 42 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 40 def additional_properties @additional_properties end |
#comment ⇒ String (readonly)
Returns Comment on the defect.
13 14 15 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 13 def comment @comment end |
#created_at_time ⇒ String (readonly)
Returns Time when defect was created in RFC 3339 format.
15 16 17 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 15 def created_at_time @created_at_time end |
#defect_photos ⇒ Array<Samsara::Types::DefectPhotoResponseResponseBody> (readonly)
Returns List of DVIR defect's photos.
17 18 19 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 17 def defect_photos @defect_photos end |
#defect_type_id ⇒ String (readonly)
Returns The unique ID of the defect type.
19 20 21 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 19 def defect_type_id @defect_type_id end |
#dvir_id ⇒ String (readonly)
Returns The unique ID of the defect's DVIR.
21 22 23 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 21 def dvir_id @dvir_id end |
#id ⇒ String (readonly)
Returns The unique ID of the DVIR defect.
23 24 25 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 23 def id @id end |
#is_resolved ⇒ Boolean (readonly)
Returns Signifies if this defect is resolved.
25 26 27 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 25 def is_resolved @is_resolved end |
#mechanic_notes ⇒ String (readonly)
Returns The mechanics notes on the defect.
27 28 29 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 27 def mechanic_notes @mechanic_notes end |
#resolved_at_time ⇒ Object (readonly)
the defect is unresolved.
30 31 32 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 30 def resolved_at_time @resolved_at_time end |
#resolved_by ⇒ Samsara::Types::DvirResolvedByObjectResponseBody (readonly)
32 33 34 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 32 def resolved_by @resolved_by end |
#trailer ⇒ Samsara::Types::DefectTrailerResponseResponseBody (readonly)
34 35 36 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 34 def trailer @trailer end |
#updated_at_time ⇒ String (readonly)
Returns Time when defect was last updated in RFC 3339 format.
36 37 38 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 36 def updated_at_time @updated_at_time end |
#vehicle ⇒ Samsara::Types::DefectVehicleResponseResponseBody (readonly)
38 39 40 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 38 def vehicle @vehicle end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::DvirDefectGetDefectResponseBody
86 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 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 86 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
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 149 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
140 141 142 |
# File 'lib/samsara_api/types/dvir_defect_get_defect_response_body.rb', line 140 def to_json @_field_set&.to_json end |