Class: Samsara::Types::WorkOrderObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::WorkOrderObjectResponseBody
- Defined in:
- lib/samsara_api/types/work_order_object_response_body.rb
Overview
A work order object.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#archived_at_time ⇒ DateTime
readonly
The time the work order was archived in RFC 3339 format.
-
#asset_id ⇒ String
readonly
The ID of the asset.
-
#assigned_user_id ⇒ String
readonly
The ID of the assigned mechanic.
-
#attachments ⇒ Array<Samsara::Types::WorkOrderAttachmentObjectResponseBody>
readonly
Files attached to the work order.
-
#category ⇒ Object
readonly
Repair
,Preventive,Recall,Unspecified`. -
#closing_notes ⇒ String
readonly
Notes on the work order.
-
#completed_at_time ⇒ DateTime
readonly
The time the work order was completed in RFC 3339 format.
-
#created_at_time ⇒ DateTime
readonly
The time the work order was created in RFC 3339 format.
-
#created_by_user_id ⇒ String
readonly
The ID of the creator of the work order.
-
#description ⇒ String
readonly
A description of what needs to be fixed.
- #discount ⇒ Samsara::Types::WorkOrderDiscountObjectResponseBody readonly
-
#due_at_time ⇒ DateTime
readonly
The due date of the work order in RFC 3339 format.
-
#engine_hours ⇒ Long
readonly
The engine hours at the time of the work order.
-
#id ⇒ String
readonly
The unique id of the work order.
-
#items ⇒ Array<Samsara::Types::WorkOrderItemObjectResponseBody>
readonly
Items related to the work order.
-
#odometer_meters ⇒ Long
readonly
The odometer reading at the time of the work order.
-
#priority ⇒ Samsara::Types::WorkOrderObjectResponseBodyPriority
readonly
The priority of the work order Valid values:
High,Low,Medium,Urgent. -
#service_task_instances ⇒ Array<Samsara::Types::ServiceTaskInstanceObjectResponseBody>
readonly
Service Tasks for the work order.
-
#status ⇒ Object
readonly
Parts`.
- #tax ⇒ Samsara::Types::WorkOrderTaxObjectResponseBody readonly
-
#updated_at_time ⇒ DateTime
readonly
The time the work order was last updated in RFC 3339 format.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(archived_at_time: OMIT, asset_id:, assigned_user_id: OMIT, attachments: OMIT, category: OMIT, closing_notes: OMIT, completed_at_time: OMIT, created_at_time:, created_by_user_id: OMIT, description: OMIT, discount: OMIT, due_at_time: OMIT, engine_hours: OMIT, id:, items: OMIT, odometer_meters: OMIT, priority: OMIT, service_task_instances: OMIT, status:, tax: OMIT, updated_at_time:, additional_properties: nil) ⇒ Samsara::Types::WorkOrderObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(archived_at_time: OMIT, asset_id:, assigned_user_id: OMIT, attachments: OMIT, category: OMIT, closing_notes: OMIT, completed_at_time: OMIT, created_at_time:, created_by_user_id: OMIT, description: OMIT, discount: OMIT, due_at_time: OMIT, engine_hours: OMIT, id:, items: OMIT, odometer_meters: OMIT, priority: OMIT, service_task_instances: OMIT, status:, tax: OMIT, updated_at_time:, additional_properties: nil) ⇒ Samsara::Types::WorkOrderObjectResponseBody
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 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 101 def initialize(archived_at_time: OMIT, asset_id:, assigned_user_id: OMIT, attachments: OMIT, category: OMIT, closing_notes: OMIT, completed_at_time: OMIT, created_at_time:, created_by_user_id: OMIT, description: OMIT, discount: OMIT, due_at_time: OMIT, engine_hours: OMIT, id:, items: OMIT, odometer_meters: OMIT, priority: OMIT, service_task_instances: OMIT, status:, tax: OMIT, updated_at_time:, additional_properties: nil) @archived_at_time = archived_at_time if archived_at_time != OMIT @asset_id = asset_id @assigned_user_id = assigned_user_id if assigned_user_id != OMIT @attachments = if != OMIT @category = category if category != OMIT @closing_notes = closing_notes if closing_notes != OMIT @completed_at_time = completed_at_time if completed_at_time != OMIT @created_at_time = created_at_time @created_by_user_id = created_by_user_id if created_by_user_id != OMIT @description = description if description != OMIT @discount = discount if discount != OMIT @due_at_time = due_at_time if due_at_time != OMIT @engine_hours = engine_hours if engine_hours != OMIT @id = id @items = items if items != OMIT @odometer_meters = odometer_meters if odometer_meters != OMIT @priority = priority if priority != OMIT @service_task_instances = service_task_instances if service_task_instances != OMIT @status = status @tax = tax if tax != OMIT @updated_at_time = updated_at_time @additional_properties = additional_properties @_field_set = { "archivedAtTime": archived_at_time, "assetId": asset_id, "assignedUserId": assigned_user_id, "attachments": , "category": category, "closingNotes": closing_notes, "completedAtTime": completed_at_time, "createdAtTime": created_at_time, "createdByUserId": created_by_user_id, "description": description, "discount": discount, "dueAtTime": due_at_time, "engineHours": engine_hours, "id": id, "items": items, "odometerMeters": odometer_meters, "priority": priority, "serviceTaskInstances": service_task_instances, "status": status, "tax": tax, "updatedAtTime": updated_at_time }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
68 69 70 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 68 def additional_properties @additional_properties end |
#archived_at_time ⇒ DateTime (readonly)
23 24 25 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 23 def archived_at_time @archived_at_time end |
#asset_id ⇒ String (readonly)
25 26 27 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 25 def asset_id @asset_id end |
#assigned_user_id ⇒ String (readonly)
27 28 29 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 27 def assigned_user_id @assigned_user_id end |
#attachments ⇒ Array<Samsara::Types::WorkOrderAttachmentObjectResponseBody> (readonly)
29 30 31 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 29 def @attachments end |
#category ⇒ Object (readonly)
Repair, Preventive, Recall, Unspecified`
32 33 34 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 32 def category @category end |
#closing_notes ⇒ String (readonly)
34 35 36 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 34 def closing_notes @closing_notes end |
#completed_at_time ⇒ DateTime (readonly)
36 37 38 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 36 def completed_at_time @completed_at_time end |
#created_at_time ⇒ DateTime (readonly)
38 39 40 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 38 def created_at_time @created_at_time end |
#created_by_user_id ⇒ String (readonly)
40 41 42 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 40 def created_by_user_id @created_by_user_id end |
#description ⇒ String (readonly)
42 43 44 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 42 def description @description end |
#discount ⇒ Samsara::Types::WorkOrderDiscountObjectResponseBody (readonly)
44 45 46 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 44 def discount @discount end |
#due_at_time ⇒ DateTime (readonly)
46 47 48 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 46 def due_at_time @due_at_time end |
#engine_hours ⇒ Long (readonly)
48 49 50 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 48 def engine_hours @engine_hours end |
#id ⇒ String (readonly)
50 51 52 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 50 def id @id end |
#items ⇒ Array<Samsara::Types::WorkOrderItemObjectResponseBody> (readonly)
52 53 54 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 52 def items @items end |
#odometer_meters ⇒ Long (readonly)
54 55 56 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 54 def odometer_meters @odometer_meters end |
#priority ⇒ Samsara::Types::WorkOrderObjectResponseBodyPriority (readonly)
56 57 58 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 56 def priority @priority end |
#service_task_instances ⇒ Array<Samsara::Types::ServiceTaskInstanceObjectResponseBody> (readonly)
58 59 60 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 58 def service_task_instances @service_task_instances end |
#status ⇒ Object (readonly)
Parts`
62 63 64 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 62 def status @status end |
#tax ⇒ Samsara::Types::WorkOrderTaxObjectResponseBody (readonly)
64 65 66 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 64 def tax @tax end |
#updated_at_time ⇒ DateTime (readonly)
66 67 68 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 66 def updated_at_time @updated_at_time end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::WorkOrderObjectResponseBody
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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 132 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) archived_at_time = unless parsed_json["archivedAtTime"].nil? DateTime.parse(parsed_json["archivedAtTime"]) else nil end asset_id = parsed_json["assetId"] assigned_user_id = parsed_json["assignedUserId"] = parsed_json["attachments"]&.map do | item | item = item.to_json Samsara::Types::WorkOrderAttachmentObjectResponseBody.from_json(json_object: item) end category = parsed_json["category"] closing_notes = parsed_json["closingNotes"] completed_at_time = unless parsed_json["completedAtTime"].nil? DateTime.parse(parsed_json["completedAtTime"]) else nil end created_at_time = unless parsed_json["createdAtTime"].nil? DateTime.parse(parsed_json["createdAtTime"]) else nil end created_by_user_id = parsed_json["createdByUserId"] description = parsed_json["description"] unless parsed_json["discount"].nil? discount = parsed_json["discount"].to_json discount = Samsara::Types::WorkOrderDiscountObjectResponseBody.from_json(json_object: discount) else discount = nil end due_at_time = unless parsed_json["dueAtTime"].nil? DateTime.parse(parsed_json["dueAtTime"]) else nil end engine_hours = parsed_json["engineHours"] id = parsed_json["id"] items = parsed_json["items"]&.map do | item | item = item.to_json Samsara::Types::WorkOrderItemObjectResponseBody.from_json(json_object: item) end odometer_meters = parsed_json["odometerMeters"] priority = parsed_json["priority"] service_task_instances = parsed_json["serviceTaskInstances"]&.map do | item | item = item.to_json Samsara::Types::ServiceTaskInstanceObjectResponseBody.from_json(json_object: item) end status = parsed_json["status"] unless parsed_json["tax"].nil? tax = parsed_json["tax"].to_json tax = Samsara::Types::WorkOrderTaxObjectResponseBody.from_json(json_object: tax) else tax = nil end updated_at_time = unless parsed_json["updatedAtTime"].nil? DateTime.parse(parsed_json["updatedAtTime"]) else nil end new( archived_at_time: archived_at_time, asset_id: asset_id, assigned_user_id: assigned_user_id, attachments: , category: category, closing_notes: closing_notes, completed_at_time: completed_at_time, created_at_time: created_at_time, created_by_user_id: created_by_user_id, description: description, discount: discount, due_at_time: due_at_time, engine_hours: engine_hours, id: id, items: items, odometer_meters: odometer_meters, priority: priority, service_task_instances: service_task_instances, status: status, tax: tax, updated_at_time: updated_at_time, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 232 def self.validate_raw(obj:) obj.archived_at_time&.is_a?(DateTime) != false || raise("Passed value for field obj.archived_at_time is not the expected type, validation failed.") obj.asset_id.is_a?(String) != false || raise("Passed value for field obj.asset_id is not the expected type, validation failed.") obj.assigned_user_id&.is_a?(String) != false || raise("Passed value for field obj.assigned_user_id is not the expected type, validation failed.") obj.&.is_a?(Array) != false || raise("Passed value for field obj.attachments is not the expected type, validation failed.") obj.category&.is_a?(Samsara::Types::WorkOrderObjectResponseBodyCategory) != false || raise("Passed value for field obj.category is not the expected type, validation failed.") obj.closing_notes&.is_a?(String) != false || raise("Passed value for field obj.closing_notes is not the expected type, validation failed.") obj.completed_at_time&.is_a?(DateTime) != false || raise("Passed value for field obj.completed_at_time is not the expected type, validation failed.") obj.created_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.created_at_time is not the expected type, validation failed.") obj.created_by_user_id&.is_a?(String) != false || raise("Passed value for field obj.created_by_user_id is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.discount.nil? || Samsara::Types::WorkOrderDiscountObjectResponseBody.validate_raw(obj: obj.discount) obj.due_at_time&.is_a?(DateTime) != false || raise("Passed value for field obj.due_at_time is not the expected type, validation failed.") obj.engine_hours&.is_a?(Long) != false || raise("Passed value for field obj.engine_hours 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.items&.is_a?(Array) != false || raise("Passed value for field obj.items 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.priority&.is_a?(Samsara::Types::WorkOrderObjectResponseBodyPriority) != false || raise("Passed value for field obj.priority is not the expected type, validation failed.") obj.service_task_instances&.is_a?(Array) != false || raise("Passed value for field obj.service_task_instances is not the expected type, validation failed.") obj.status.is_a?(Samsara::Types::WorkOrderObjectResponseBodyStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.tax.nil? || Samsara::Types::WorkOrderTaxObjectResponseBody.validate_raw(obj: obj.tax) obj.updated_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at_time is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
223 224 225 |
# File 'lib/samsara_api/types/work_order_object_response_body.rb', line 223 def to_json @_field_set&.to_json end |