Class: Samsara::Types::DvirDefectsObjectV20220913ResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::DvirDefectsObjectV20220913ResponseBody
- Defined in:
- lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb
Overview
A description of a DVIR defect
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 the defect was created.
-
#defect_type ⇒ String
readonly
The type of DVIR defect.
-
#id ⇒ String
readonly
The ID of the defect.
-
#is_resolved ⇒ Boolean
readonly
Signifies if this defect is resolved.
-
#mechanic_notes ⇒ String
readonly
The mechanic notes on this defect.
-
#mechanic_notes_updated_at_time ⇒ String
readonly
Time when mechanic notes were last updated.
-
#resolved_at_time ⇒ Object
readonly
unresolved.
- #resolved_by ⇒ Samsara::Types::DvirResolvedByObjectResponseBody readonly
- #trailer ⇒ Samsara::Types::GoaTrailerTinyResponseResponseBody readonly
- #vehicle ⇒ Samsara::Types::VehicleWithGatewayTinyResponseResponseBody readonly
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::DvirDefectsObjectV20220913ResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(comment: OMIT, created_at_time:, defect_type:, id:, is_resolved:, mechanic_notes: OMIT, mechanic_notes_updated_at_time: OMIT, resolved_at_time: OMIT, resolved_by: OMIT, trailer: OMIT, vehicle: OMIT, additional_properties: nil) ⇒ Samsara::Types::DvirDefectsObjectV20220913ResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(comment: OMIT, created_at_time:, defect_type:, id:, is_resolved:, mechanic_notes: OMIT, mechanic_notes_updated_at_time: OMIT, resolved_at_time: OMIT, resolved_by: OMIT, trailer: OMIT, vehicle: OMIT, additional_properties: nil) ⇒ Samsara::Types::DvirDefectsObjectV20220913ResponseBody
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 57 def initialize(comment: OMIT, created_at_time:, defect_type:, id:, is_resolved:, mechanic_notes: OMIT, mechanic_notes_updated_at_time: OMIT, resolved_at_time: OMIT, resolved_by: OMIT, trailer: OMIT, vehicle: OMIT, additional_properties: nil) @comment = comment if comment != OMIT @created_at_time = created_at_time @defect_type = defect_type @id = id @is_resolved = is_resolved @mechanic_notes = mechanic_notes if mechanic_notes != OMIT @mechanic_notes_updated_at_time = mechanic_notes_updated_at_time if mechanic_notes_updated_at_time != 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 @vehicle = vehicle if vehicle != OMIT @additional_properties = additional_properties @_field_set = { "comment": comment, "createdAtTime": created_at_time, "defectType": defect_type, "id": id, "isResolved": is_resolved, "mechanicNotes": mechanic_notes, "mechanicNotesUpdatedAtTime": mechanic_notes_updated_at_time, "resolvedAtTime": resolved_at_time, "resolvedBy": resolved_by, "trailer": trailer, "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.
36 37 38 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 36 def additional_properties @additional_properties end |
#comment ⇒ String (readonly)
Returns Comment on the defect.
13 14 15 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 13 def comment @comment end |
#created_at_time ⇒ String (readonly)
Returns Time when the defect was created. UTC timestamp in RFC 3339 format.
15 16 17 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 15 def created_at_time @created_at_time end |
#defect_type ⇒ String (readonly)
Returns The type of DVIR defect.
17 18 19 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 17 def defect_type @defect_type end |
#id ⇒ String (readonly)
Returns The ID of the defect.
19 20 21 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 19 def id @id end |
#is_resolved ⇒ Boolean (readonly)
Returns Signifies if this defect is resolved.
21 22 23 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 21 def is_resolved @is_resolved end |
#mechanic_notes ⇒ String (readonly)
Returns The mechanic notes on this defect.
23 24 25 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 23 def mechanic_notes @mechanic_notes end |
#mechanic_notes_updated_at_time ⇒ String (readonly)
Returns Time when mechanic notes were last updated. UTC timestamp in RFC 3339 format.
25 26 27 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 25 def mechanic_notes_updated_at_time @mechanic_notes_updated_at_time end |
#resolved_at_time ⇒ Object (readonly)
unresolved. UTC timestamp in RFC 3339 format.
28 29 30 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 28 def resolved_at_time @resolved_at_time end |
#resolved_by ⇒ Samsara::Types::DvirResolvedByObjectResponseBody (readonly)
30 31 32 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 30 def resolved_by @resolved_by end |
#trailer ⇒ Samsara::Types::GoaTrailerTinyResponseResponseBody (readonly)
32 33 34 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 32 def trailer @trailer end |
#vehicle ⇒ Samsara::Types::VehicleWithGatewayTinyResponseResponseBody (readonly)
34 35 36 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 34 def vehicle @vehicle end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::DvirDefectsObjectV20220913ResponseBody
79 80 81 82 83 84 85 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 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 79 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_type = parsed_json["defectType"] id = parsed_json["id"] is_resolved = parsed_json["isResolved"] mechanic_notes = parsed_json["mechanicNotes"] mechanic_notes_updated_at_time = parsed_json["mechanicNotesUpdatedAtTime"] 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::GoaTrailerTinyResponseResponseBody.from_json(json_object: trailer) else trailer = nil end unless parsed_json["vehicle"].nil? vehicle = parsed_json["vehicle"].to_json vehicle = Samsara::Types::VehicleWithGatewayTinyResponseResponseBody.from_json(json_object: vehicle) else vehicle = nil end new( comment: comment, created_at_time: created_at_time, defect_type: defect_type, id: id, is_resolved: is_resolved, mechanic_notes: mechanic_notes, mechanic_notes_updated_at_time: mechanic_notes_updated_at_time, resolved_at_time: resolved_at_time, resolved_by: resolved_by, trailer: trailer, vehicle: vehicle, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 135 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_type.is_a?(String) != false || raise("Passed value for field obj.defect_type 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.mechanic_notes_updated_at_time&.is_a?(String) != false || raise("Passed value for field obj.mechanic_notes_updated_at_time 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::GoaTrailerTinyResponseResponseBody.validate_raw(obj: obj.trailer) obj.vehicle.nil? || Samsara::Types::VehicleWithGatewayTinyResponseResponseBody.validate_raw(obj: obj.vehicle) end |
Instance Method Details
#to_json ⇒ String
126 127 128 |
# File 'lib/samsara_api/types/dvir_defects_object_v_20220913_response_body.rb', line 126 def to_json @_field_set&.to_json end |