crisphive 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +183 -16
  3. data/crisphive.gemspec +5 -5
  4. data/lib/crisphive/api/business_skill_api.rb +502 -8
  5. data/lib/crisphive/api/customer_api.rb +20 -14
  6. data/lib/crisphive/api/job_request_business_api.rb +1273 -167
  7. data/lib/crisphive/api/job_types_api.rb +214 -2
  8. data/lib/crisphive/api/permission_api.rb +79 -0
  9. data/lib/crisphive/api/service_area_api.rb +214 -6
  10. data/lib/crisphive/api/technician_api.rb +510 -6
  11. data/lib/crisphive/api/technician_time_off_api.rb +240 -0
  12. data/lib/crisphive/api/vehicle_api.rb +214 -6
  13. data/lib/crisphive/api/webhooks_api.rb +213 -0
  14. data/lib/crisphive/api_client.rb +2 -2
  15. data/lib/crisphive/api_error.rb +2 -2
  16. data/lib/crisphive/configuration.rb +3 -3
  17. data/lib/crisphive/models/api_internal_techtimeoff_actions.rb +232 -0
  18. data/lib/crisphive/models/api_internal_techtimeoff_status.rb +42 -0
  19. data/lib/crisphive/models/assignable_group.rb +289 -0
  20. data/lib/crisphive/models/book_and_confirm_job_request200_response.rb +253 -0
  21. data/lib/crisphive/models/commit_absence_resolve200_response.rb +253 -0
  22. data/lib/crisphive/models/commit_emergency_reschedule200_response.rb +253 -0
  23. data/lib/crisphive/models/commit_job_request_move200_response.rb +253 -0
  24. data/lib/crisphive/models/create_customer200_response.rb +5 -2
  25. data/lib/crisphive/models/create_job_request200_response.rb +5 -2
  26. data/lib/crisphive/models/create_job_type200_response.rb +253 -0
  27. data/lib/crisphive/models/create_service_area200_response.rb +253 -0
  28. data/lib/crisphive/models/create_skill200_response.rb +253 -0
  29. data/lib/crisphive/models/create_skill_category200_response.rb +253 -0
  30. data/lib/crisphive/models/create_technician200_response.rb +253 -0
  31. data/lib/crisphive/models/create_technician_time_off200_response.rb +253 -0
  32. data/lib/crisphive/models/create_vehicle200_response.rb +253 -0
  33. data/lib/crisphive/models/create_webhook_endpoint200_response.rb +253 -0
  34. data/lib/crisphive/models/customer.rb +13 -3
  35. data/lib/crisphive/models/customer_address.rb +2 -2
  36. data/lib/crisphive/models/customer_address_request.rb +11 -2
  37. data/lib/crisphive/models/customer_contact.rb +27 -7
  38. data/lib/crisphive/models/customer_create_request.rb +14 -4
  39. data/lib/crisphive/models/customer_create_response.rb +2 -2
  40. data/lib/crisphive/models/customer_list.rb +3 -3
  41. data/lib/crisphive/models/customer_list_item.rb +13 -3
  42. data/lib/crisphive/models/customer_profile.rb +2 -2
  43. data/lib/crisphive/models/customer_quick_books_link.rb +235 -0
  44. data/lib/crisphive/models/customer_service_area_ref.rb +225 -0
  45. data/lib/crisphive/models/customer_spending.rb +2 -2
  46. data/lib/crisphive/models/customer_technician_ref.rb +225 -0
  47. data/lib/crisphive/models/customer_tier_progress.rb +2 -2
  48. data/lib/crisphive/models/customer_update_request.rb +25 -22
  49. data/lib/crisphive/models/get_customer200_response.rb +5 -2
  50. data/lib/crisphive/models/get_job_request200_response.rb +5 -2
  51. data/lib/crisphive/models/get_job_request_timeline200_response.rb +5 -2
  52. data/lib/crisphive/models/get_job_type200_response.rb +5 -2
  53. data/lib/crisphive/models/get_service_area200_response.rb +5 -2
  54. data/lib/crisphive/models/get_technician200_response.rb +5 -2
  55. data/lib/crisphive/models/get_technician_schedule200_response.rb +253 -0
  56. data/lib/crisphive/models/get_vehicle200_response.rb +5 -2
  57. data/lib/crisphive/models/internal_jobrequest_http_address_req.rb +475 -0
  58. data/lib/crisphive/models/job_date.rb +5 -3
  59. data/lib/crisphive/models/job_date_business_range.rb +7 -3
  60. data/lib/crisphive/models/job_date_period.rb +2 -2
  61. data/lib/crisphive/models/job_date_period_entry.rb +4 -2
  62. data/lib/crisphive/models/job_request.rb +56 -6
  63. data/lib/crisphive/models/job_request_absence_alternative.rb +356 -0
  64. data/lib/crisphive/models/job_request_absence_alternative_cost.rb +275 -0
  65. data/lib/crisphive/models/job_request_absence_assignment.rb +319 -0
  66. data/lib/crisphive/models/job_request_absence_commit_request.rb +296 -0
  67. data/lib/crisphive/models/job_request_absence_notification.rb +283 -0
  68. data/lib/crisphive/models/job_request_absence_plan.rb +322 -0
  69. data/lib/crisphive/models/job_request_absence_preview_request.rb +280 -0
  70. data/lib/crisphive/models/job_request_absence_resolved_job.rb +499 -0
  71. data/lib/crisphive/models/job_request_absence_solver.rb +289 -0
  72. data/lib/crisphive/models/job_request_absence_time_off.rb +281 -0
  73. data/lib/crisphive/models/job_request_absence_unresolved_job.rb +364 -0
  74. data/lib/crisphive/models/job_request_action_audit_by.rb +2 -2
  75. data/lib/crisphive/models/job_request_action_audit_entry.rb +3 -3
  76. data/lib/crisphive/models/job_request_action_summary.rb +3 -3
  77. data/lib/crisphive/models/job_request_address_summary.rb +2 -2
  78. data/lib/crisphive/models/job_request_archive_summary.rb +2 -2
  79. data/lib/crisphive/models/job_request_arrival_window.rb +4 -4
  80. data/lib/crisphive/models/job_request_assigned_vehicle.rb +2 -2
  81. data/lib/crisphive/models/job_request_assignment_summary.rb +2 -2
  82. data/lib/crisphive/models/job_request_attention_summary.rb +259 -0
  83. data/lib/crisphive/models/job_request_available_vehicle.rb +235 -0
  84. data/lib/crisphive/models/job_request_blocker.rb +363 -0
  85. data/lib/crisphive/models/job_request_blocker_ref.rb +223 -0
  86. data/lib/crisphive/models/job_request_book_and_confirm_customer.rb +302 -0
  87. data/lib/crisphive/models/job_request_book_and_confirm_emergency.rb +315 -0
  88. data/lib/crisphive/models/job_request_book_and_confirm_emergency_result.rb +279 -0
  89. data/lib/crisphive/models/job_request_book_and_confirm_refusal.rb +280 -0
  90. data/lib/crisphive/models/job_request_book_and_confirm_request.rb +466 -0
  91. data/lib/crisphive/models/job_request_book_and_confirm_response.rb +295 -0
  92. data/lib/crisphive/models/job_request_booking_windows.rb +2 -2
  93. data/lib/crisphive/models/job_request_buddy_slot_candidates.rb +239 -0
  94. data/lib/crisphive/models/job_request_business_time_range.rb +3 -3
  95. data/lib/crisphive/models/job_request_changes.rb +2 -2
  96. data/lib/crisphive/models/job_request_confirm_request.rb +255 -0
  97. data/lib/crisphive/models/job_request_create_request.rb +61 -7
  98. data/lib/crisphive/models/job_request_create_response.rb +2 -2
  99. data/lib/crisphive/models/job_request_crew_candidates.rb +227 -0
  100. data/lib/crisphive/models/job_request_crew_change.rb +299 -0
  101. data/lib/crisphive/models/job_request_crew_member.rb +7 -4
  102. data/lib/crisphive/models/job_request_crew_member_input.rb +284 -0
  103. data/lib/crisphive/models/job_request_crew_recommendation.rb +255 -0
  104. data/lib/crisphive/models/job_request_customer_summary.rb +2 -2
  105. data/lib/crisphive/models/job_request_day_windows.rb +3 -3
  106. data/lib/crisphive/models/job_request_emergency_candidate.rb +319 -0
  107. data/lib/crisphive/models/job_request_emergency_candidates.rb +311 -0
  108. data/lib/crisphive/models/job_request_emergency_candidates_request.rb +341 -0
  109. data/lib/crisphive/models/job_request_emergency_commit_request.rb +361 -0
  110. data/lib/crisphive/models/job_request_emergency_inline_job.rb +353 -0
  111. data/lib/crisphive/models/job_request_emergency_plan.rb +367 -0
  112. data/lib/crisphive/models/job_request_emergency_preview_request.rb +342 -0
  113. data/lib/crisphive/models/job_request_job_date_business_range_request.rb +3 -3
  114. data/lib/crisphive/models/job_request_job_date_period_request.rb +2 -2
  115. data/lib/crisphive/models/job_request_job_date_request.rb +3 -3
  116. data/lib/crisphive/models/job_request_lead_candidate.rb +311 -0
  117. data/lib/crisphive/models/job_request_list.rb +2 -2
  118. data/lib/crisphive/models/job_request_move_commit_req.rb +353 -0
  119. data/lib/crisphive/models/job_request_move_member.rb +299 -0
  120. data/lib/crisphive/models/job_request_move_plan.rb +387 -0
  121. data/lib/crisphive/models/job_request_move_preview_req.rb +300 -0
  122. data/lib/crisphive/models/job_request_move_warning.rb +335 -0
  123. data/lib/crisphive/models/job_request_period.rb +2 -2
  124. data/lib/crisphive/models/job_request_priority_update_result.rb +217 -0
  125. data/lib/crisphive/models/job_request_quote_request.rb +343 -0
  126. data/lib/crisphive/models/job_request_quote_summary.rb +2 -2
  127. data/lib/crisphive/models/job_request_rating_summary.rb +2 -2
  128. data/lib/crisphive/models/job_request_reassign_fallback.rb +287 -0
  129. data/lib/crisphive/models/job_request_reschedule_day.rb +227 -0
  130. data/lib/crisphive/models/job_request_reschedule_move.rb +319 -0
  131. data/lib/crisphive/models/job_request_reschedule_reassignment.rb +339 -0
  132. data/lib/crisphive/models/job_request_schedule.rb +2 -2
  133. data/lib/crisphive/models/job_request_session.rb +8 -7
  134. data/lib/crisphive/models/job_request_skill_summary.rb +3 -3
  135. data/lib/crisphive/models/job_request_status_summary.rb +3 -3
  136. data/lib/crisphive/models/job_request_tech_candidate.rb +287 -0
  137. data/lib/crisphive/models/job_request_technician_info.rb +2 -2
  138. data/lib/crisphive/models/job_request_time_segments.rb +287 -0
  139. data/lib/crisphive/models/job_request_time_segments_business_time.rb +321 -0
  140. data/lib/crisphive/models/job_request_time_segments_day.rb +247 -0
  141. data/lib/crisphive/models/job_request_time_segments_slot.rb +375 -0
  142. data/lib/crisphive/models/job_request_time_segments_worker.rb +295 -0
  143. data/lib/crisphive/models/job_request_timeline.rb +2 -2
  144. data/lib/crisphive/models/job_request_timeline_action.rb +2 -2
  145. data/lib/crisphive/models/job_request_timeline_event.rb +2 -2
  146. data/lib/crisphive/models/job_request_update_priority_request.rb +295 -0
  147. data/lib/crisphive/models/job_type.rb +44 -4
  148. data/lib/crisphive/models/job_type_create_request.rb +399 -0
  149. data/lib/crisphive/models/job_type_create_response.rb +215 -0
  150. data/lib/crisphive/models/job_type_update_request.rb +400 -0
  151. data/lib/crisphive/models/list_assignable_groups200_response.rb +255 -0
  152. data/lib/crisphive/models/list_crew_candidates200_response.rb +253 -0
  153. data/lib/crisphive/models/list_customers200_response.rb +5 -2
  154. data/lib/crisphive/models/list_emergency_candidates200_response.rb +253 -0
  155. data/lib/crisphive/models/list_job_request_booking_windows200_response.rb +5 -2
  156. data/lib/crisphive/models/list_job_request_changes200_response.rb +5 -2
  157. data/lib/crisphive/models/list_job_requests200_response.rb +5 -2
  158. data/lib/crisphive/models/list_job_types200_response.rb +5 -2
  159. data/lib/crisphive/models/list_matching_slots200_response.rb +253 -0
  160. data/lib/crisphive/models/list_nearby_technicians200_response.rb +253 -0
  161. data/lib/crisphive/models/list_service_areas200_response.rb +5 -2
  162. data/lib/crisphive/models/list_skill_categories200_response.rb +5 -2
  163. data/lib/crisphive/models/list_skills200_response.rb +5 -2
  164. data/lib/crisphive/models/list_skills_by_category200_response.rb +5 -2
  165. data/lib/crisphive/models/list_technician_skills200_response.rb +253 -0
  166. data/lib/crisphive/models/list_technician_time_off200_response.rb +253 -0
  167. data/lib/crisphive/models/list_technicians200_response.rb +5 -2
  168. data/lib/crisphive/models/list_vehicles200_response.rb +5 -2
  169. data/lib/crisphive/models/list_webhook_event_types200_response.rb +255 -0
  170. data/lib/crisphive/models/nearby_technician.rb +319 -0
  171. data/lib/crisphive/models/nearby_technicians.rb +237 -0
  172. data/lib/crisphive/models/pagination.rb +7 -2
  173. data/lib/crisphive/models/quote_job_request200_response.rb +253 -0
  174. data/lib/crisphive/models/replace_technician_service_areas200_response.rb +253 -0
  175. data/lib/crisphive/models/response_envelope.rb +6 -2
  176. data/lib/crisphive/models/service_area.rb +23 -3
  177. data/lib/crisphive/models/service_area_create_request.rb +455 -0
  178. data/lib/crisphive/models/service_area_create_response.rb +215 -0
  179. data/lib/crisphive/models/service_area_list.rb +2 -2
  180. data/lib/crisphive/models/service_area_update_request.rb +451 -0
  181. data/lib/crisphive/models/skill.rb +9 -2
  182. data/lib/crisphive/models/skill_by_category_list.rb +4 -2
  183. data/lib/crisphive/models/skill_category.rb +7 -2
  184. data/lib/crisphive/models/skill_category_create_request.rb +270 -0
  185. data/lib/crisphive/models/skill_category_create_response.rb +215 -0
  186. data/lib/crisphive/models/skill_category_list.rb +4 -2
  187. data/lib/crisphive/models/skill_create_request.rb +270 -0
  188. data/lib/crisphive/models/skill_create_response.rb +215 -0
  189. data/lib/crisphive/models/skill_list.rb +2 -2
  190. data/lib/crisphive/models/skill_summary.rb +2 -2
  191. data/lib/crisphive/models/skill_update_request.rb +281 -0
  192. data/lib/crisphive/models/technician.rb +66 -4
  193. data/lib/crisphive/models/technician_address.rb +2 -2
  194. data/lib/crisphive/models/technician_address_input.rb +408 -0
  195. data/lib/crisphive/models/technician_buddies_request.rb +236 -0
  196. data/lib/crisphive/models/technician_create_request.rb +603 -0
  197. data/lib/crisphive/models/technician_create_response.rb +215 -0
  198. data/lib/crisphive/models/technician_lead_ref.rb +2 -2
  199. data/lib/crisphive/models/technician_leads_request.rb +236 -0
  200. data/lib/crisphive/models/technician_list.rb +3 -3
  201. data/lib/crisphive/models/technician_schedule.rb +279 -0
  202. data/lib/crisphive/models/technician_schedule_block.rb +225 -0
  203. data/lib/crisphive/models/technician_schedule_session.rb +311 -0
  204. data/lib/crisphive/models/technician_service_area_ref.rb +2 -2
  205. data/lib/crisphive/models/technician_service_areas_request.rb +236 -0
  206. data/lib/crisphive/models/technician_service_areas_response.rb +217 -0
  207. data/lib/crisphive/models/technician_skill.rb +265 -0
  208. data/lib/crisphive/models/technician_skill_list.rb +227 -0
  209. data/lib/crisphive/models/technician_skills_request.rb +236 -0
  210. data/lib/crisphive/models/technician_status.rb +2 -2
  211. data/lib/crisphive/models/technician_time_off.rb +334 -0
  212. data/lib/crisphive/models/technician_time_off_create_request.rb +285 -0
  213. data/lib/crisphive/models/technician_time_off_create_response.rb +215 -0
  214. data/lib/crisphive/models/technician_time_off_list.rb +246 -0
  215. data/lib/crisphive/models/technician_update_request.rb +507 -0
  216. data/lib/crisphive/models/technician_vehicles_request.rb +236 -0
  217. data/lib/crisphive/models/vehicle.rb +26 -4
  218. data/lib/crisphive/models/vehicle_create_request.rb +420 -0
  219. data/lib/crisphive/models/vehicle_create_response.rb +215 -0
  220. data/lib/crisphive/models/vehicle_list.rb +2 -2
  221. data/lib/crisphive/models/vehicle_owner.rb +2 -2
  222. data/lib/crisphive/models/vehicle_update_request.rb +440 -0
  223. data/lib/crisphive/models/webhook_create_request.rb +320 -0
  224. data/lib/crisphive/models/webhook_create_response.rb +391 -0
  225. data/lib/crisphive/models/webhook_verification.rb +235 -0
  226. data/lib/crisphive/version.rb +3 -3
  227. data/lib/crisphive.rb +126 -2
  228. data/spec/spec_helper.rb +2 -2
  229. metadata +129 -5
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #CrispHive Developer API
2
+ #Crisphive Developer API
3
3
 
4
- #Public REST API for integrating CrispHive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
4
+ #Public REST API for integrating Crisphive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
5
5
 
6
6
  The version of the OpenAPI document: 1.0
7
7
 
@@ -30,6 +30,9 @@ module Crisphive
30
30
  # Who/what is assigned to the job.
31
31
  attr_accessor :assignment
32
32
 
33
+ # Attention is the dispatch-board \"needs attention\" marker (exception tray); null when the job needs no attention.
34
+ attr_accessor :attention
35
+
33
36
  # UUID of the owning business.
34
37
  attr_accessor :business_id
35
38
 
@@ -60,6 +63,9 @@ module Crisphive
60
63
  # Free-text job description; null if none.
61
64
  attr_accessor :description
62
65
 
66
+ # Driving distance from the technician's start location to the job site, in kilometres. Detail reads only — omitted when unknown. Named _km to match distance_km on the nearby-technician and emergency-candidate DTOs.
67
+ attr_accessor :distance_km
68
+
63
69
  # Job request UUID.
64
70
  attr_accessor :id
65
71
 
@@ -72,7 +78,7 @@ module Crisphive
72
78
  # The action(s) the job is currently waiting on. Omitted in a terminal status.
73
79
  attr_accessor :next_actions
74
80
 
75
- # Job priority.
81
+ # Scheduling priority. p0=emergency (interrupt-driven), p1=top (displaced only by p0), p2=standard, p3=deferrable (first candidate for displacement).
76
82
  attr_accessor :priority
77
83
 
78
84
  # The time-bundle quoted for the job.
@@ -90,6 +96,15 @@ module Crisphive
90
96
  # Desired skills for the job (resolved id+name).
91
97
  attr_accessor :skills
92
98
 
99
+ # SLA deadline (UTC) armed on a p1 job; omitted when no SLA.
100
+ attr_accessor :sla_deadline
101
+
102
+ # When the SLA sweep auto-escalated this job to p0 (UTC); omitted if never.
103
+ attr_accessor :sla_escalated_at
104
+
105
+ # When the sweep fired the one-shot pre-escalation warning (UTC); omitted if never.
106
+ attr_accessor :sla_warned_at
107
+
93
108
  # Optimistic-lock version; pass back as status_version on transitions to avoid races.
94
109
  attr_accessor :status_version
95
110
 
@@ -132,6 +147,7 @@ module Crisphive
132
147
  :'archive' => :'archive',
133
148
  :'assigned_vehicle' => :'assigned_vehicle',
134
149
  :'assignment' => :'assignment',
150
+ :'attention' => :'attention',
135
151
  :'business_id' => :'business_id',
136
152
  :'completed_at' => :'completed_at',
137
153
  :'completed_by_user_id' => :'completed_by_user_id',
@@ -142,6 +158,7 @@ module Crisphive
142
158
  :'customer_url' => :'customer_url',
143
159
  :'deleted_at' => :'deleted_at',
144
160
  :'description' => :'description',
161
+ :'distance_km' => :'distance_km',
145
162
  :'id' => :'id',
146
163
  :'job_type_id' => :'job_type_id',
147
164
  :'job_type_name' => :'job_type_name',
@@ -152,6 +169,9 @@ module Crisphive
152
169
  :'schedule' => :'schedule',
153
170
  :'short_code' => :'short_code',
154
171
  :'skills' => :'skills',
172
+ :'sla_deadline' => :'sla_deadline',
173
+ :'sla_escalated_at' => :'sla_escalated_at',
174
+ :'sla_warned_at' => :'sla_warned_at',
155
175
  :'status_version' => :'status_version',
156
176
  :'updated_at' => :'updated_at',
157
177
  :'workflow_id' => :'workflow_id',
@@ -172,6 +192,7 @@ module Crisphive
172
192
  :'archive' => :'JobRequestArchiveSummary',
173
193
  :'assigned_vehicle' => :'JobRequestAssignedVehicle',
174
194
  :'assignment' => :'JobRequestAssignmentSummary',
195
+ :'attention' => :'JobRequestAttentionSummary',
175
196
  :'business_id' => :'String',
176
197
  :'completed_at' => :'Time',
177
198
  :'completed_by_user_id' => :'String',
@@ -182,6 +203,7 @@ module Crisphive
182
203
  :'customer_url' => :'String',
183
204
  :'deleted_at' => :'Time',
184
205
  :'description' => :'String',
206
+ :'distance_km' => :'Float',
185
207
  :'id' => :'String',
186
208
  :'job_type_id' => :'String',
187
209
  :'job_type_name' => :'String',
@@ -192,6 +214,9 @@ module Crisphive
192
214
  :'schedule' => :'JobRequestSchedule',
193
215
  :'short_code' => :'String',
194
216
  :'skills' => :'Array<JobRequestSkillSummary>',
217
+ :'sla_deadline' => :'Time',
218
+ :'sla_escalated_at' => :'Time',
219
+ :'sla_warned_at' => :'Time',
195
220
  :'status_version' => :'Integer',
196
221
  :'updated_at' => :'Time',
197
222
  :'workflow_id' => :'String',
@@ -242,6 +267,10 @@ module Crisphive
242
267
  self.assignment = attributes[:'assignment']
243
268
  end
244
269
 
270
+ if attributes.key?(:'attention')
271
+ self.attention = attributes[:'attention']
272
+ end
273
+
245
274
  if attributes.key?(:'business_id')
246
275
  self.business_id = attributes[:'business_id']
247
276
  end
@@ -284,6 +313,10 @@ module Crisphive
284
313
  self.description = attributes[:'description']
285
314
  end
286
315
 
316
+ if attributes.key?(:'distance_km')
317
+ self.distance_km = attributes[:'distance_km']
318
+ end
319
+
287
320
  if attributes.key?(:'id')
288
321
  self.id = attributes[:'id']
289
322
  end
@@ -328,6 +361,18 @@ module Crisphive
328
361
  end
329
362
  end
330
363
 
364
+ if attributes.key?(:'sla_deadline')
365
+ self.sla_deadline = attributes[:'sla_deadline']
366
+ end
367
+
368
+ if attributes.key?(:'sla_escalated_at')
369
+ self.sla_escalated_at = attributes[:'sla_escalated_at']
370
+ end
371
+
372
+ if attributes.key?(:'sla_warned_at')
373
+ self.sla_warned_at = attributes[:'sla_warned_at']
374
+ end
375
+
331
376
  if attributes.key?(:'status_version')
332
377
  self.status_version = attributes[:'status_version']
333
378
  end
@@ -357,7 +402,7 @@ module Crisphive
357
402
  # @return true if the model is valid
358
403
  def valid?
359
404
  warn '[DEPRECATED] the `valid?` method is obsolete'
360
- priority_validator = EnumAttributeValidator.new('String', ["normal", "emergency"])
405
+ priority_validator = EnumAttributeValidator.new('String', ["p0", "p1", "p2", "p3"])
361
406
  return false unless priority_validator.valid?(@priority)
362
407
  true
363
408
  end
@@ -365,7 +410,7 @@ module Crisphive
365
410
  # Custom attribute writer method checking allowed values (enum).
366
411
  # @param [Object] priority Object to be assigned
367
412
  def priority=(priority)
368
- validator = EnumAttributeValidator.new('String', ["normal", "emergency"])
413
+ validator = EnumAttributeValidator.new('String', ["p0", "p1", "p2", "p3"])
369
414
  unless validator.valid?(priority)
370
415
  fail ArgumentError, "invalid value for \"priority\", must be one of #{validator.allowable_values}."
371
416
  end
@@ -382,6 +427,7 @@ module Crisphive
382
427
  archive == o.archive &&
383
428
  assigned_vehicle == o.assigned_vehicle &&
384
429
  assignment == o.assignment &&
430
+ attention == o.attention &&
385
431
  business_id == o.business_id &&
386
432
  completed_at == o.completed_at &&
387
433
  completed_by_user_id == o.completed_by_user_id &&
@@ -392,6 +438,7 @@ module Crisphive
392
438
  customer_url == o.customer_url &&
393
439
  deleted_at == o.deleted_at &&
394
440
  description == o.description &&
441
+ distance_km == o.distance_km &&
395
442
  id == o.id &&
396
443
  job_type_id == o.job_type_id &&
397
444
  job_type_name == o.job_type_name &&
@@ -402,6 +449,9 @@ module Crisphive
402
449
  schedule == o.schedule &&
403
450
  short_code == o.short_code &&
404
451
  skills == o.skills &&
452
+ sla_deadline == o.sla_deadline &&
453
+ sla_escalated_at == o.sla_escalated_at &&
454
+ sla_warned_at == o.sla_warned_at &&
405
455
  status_version == o.status_version &&
406
456
  updated_at == o.updated_at &&
407
457
  workflow_id == o.workflow_id &&
@@ -417,7 +467,7 @@ module Crisphive
417
467
  # Calculates hash code according to all attributes.
418
468
  # @return [Integer] Hash code
419
469
  def hash
420
- [action_audit, address, archive, assigned_vehicle, assignment, business_id, completed_at, completed_by_user_id, created_at, crew, current_status, customer, customer_url, deleted_at, description, id, job_type_id, job_type_name, next_actions, priority, quote, rating, schedule, short_code, skills, status_version, updated_at, workflow_id, workflow_name].hash
470
+ [action_audit, address, archive, assigned_vehicle, assignment, attention, business_id, completed_at, completed_by_user_id, created_at, crew, current_status, customer, customer_url, deleted_at, description, distance_km, id, job_type_id, job_type_name, next_actions, priority, quote, rating, schedule, short_code, skills, sla_deadline, sla_escalated_at, sla_warned_at, status_version, updated_at, workflow_id, workflow_name].hash
421
471
  end
422
472
 
423
473
  # Builds the object from hash
@@ -0,0 +1,356 @@
1
+ =begin
2
+ #Crisphive Developer API
3
+
4
+ #Public REST API for integrating Crisphive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Crisphive
17
+ class JobRequestAbsenceAlternative
18
+ # What accepting it costs.
19
+ attr_accessor :cost
20
+
21
+ attr_accessor :desired_skills
22
+
23
+ attr_accessor :end_at
24
+
25
+ # How many technicians the engine offered at that window under this option's relaxation.
26
+ attr_accessor :feasible_count
27
+
28
+ # What the option does to the customer's appointment. EXTEND-ONLY — carry a default branch. reassign_out_of_area keeps the window; reschedule_same_day / reschedule_later_day move it.
29
+ attr_accessor :kind
30
+
31
+ # Desired skills the technician holds / the job asks for.
32
+ attr_accessor :matched_skills
33
+
34
+ # The window the job would run in (UTC) — unchanged for a reassign kind, new for a reschedule kind.
35
+ attr_accessor :start_at
36
+
37
+ # The job's current status_version — copy it onto the commit assignment (the drift fence).
38
+ attr_accessor :status_version
39
+
40
+ attr_accessor :to_name
41
+
42
+ # UUID + full name of the technician who would take the job.
43
+ attr_accessor :to_technician_id
44
+
45
+ # Engine ranking score (0..1) — comparable within one option's candidate list only.
46
+ attr_accessor :total_score
47
+
48
+ # Convenience mirror of cost.window_moved.
49
+ attr_accessor :window_moved
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'cost' => :'cost',
77
+ :'desired_skills' => :'desired_skills',
78
+ :'end_at' => :'end_at',
79
+ :'feasible_count' => :'feasible_count',
80
+ :'kind' => :'kind',
81
+ :'matched_skills' => :'matched_skills',
82
+ :'start_at' => :'start_at',
83
+ :'status_version' => :'status_version',
84
+ :'to_name' => :'to_name',
85
+ :'to_technician_id' => :'to_technician_id',
86
+ :'total_score' => :'total_score',
87
+ :'window_moved' => :'window_moved'
88
+ }
89
+ end
90
+
91
+ # Returns all the JSON keys this model knows about
92
+ def self.acceptable_attributes
93
+ attribute_map.values
94
+ end
95
+
96
+ # Attribute type mapping.
97
+ def self.openapi_types
98
+ {
99
+ :'cost' => :'JobRequestAbsenceAlternativeCost',
100
+ :'desired_skills' => :'Integer',
101
+ :'end_at' => :'Time',
102
+ :'feasible_count' => :'Integer',
103
+ :'kind' => :'String',
104
+ :'matched_skills' => :'Integer',
105
+ :'start_at' => :'Time',
106
+ :'status_version' => :'Integer',
107
+ :'to_name' => :'String',
108
+ :'to_technician_id' => :'String',
109
+ :'total_score' => :'Float',
110
+ :'window_moved' => :'Boolean'
111
+ }
112
+ end
113
+
114
+ # List of attributes with nullable: true
115
+ def self.openapi_nullable
116
+ Set.new([
117
+ ])
118
+ end
119
+
120
+ # Initializes the object
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ def initialize(attributes = {})
123
+ if (!attributes.is_a?(Hash))
124
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestAbsenceAlternative` initialize method"
125
+ end
126
+
127
+ # check to see if the attribute exists and convert string to symbol for hash key
128
+ attributes = attributes.each_with_object({}) { |(k, v), h|
129
+ if (!self.class.attribute_map.key?(k.to_sym))
130
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestAbsenceAlternative`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
131
+ end
132
+ h[k.to_sym] = v
133
+ }
134
+
135
+ if attributes.key?(:'cost')
136
+ self.cost = attributes[:'cost']
137
+ end
138
+
139
+ if attributes.key?(:'desired_skills')
140
+ self.desired_skills = attributes[:'desired_skills']
141
+ end
142
+
143
+ if attributes.key?(:'end_at')
144
+ self.end_at = attributes[:'end_at']
145
+ end
146
+
147
+ if attributes.key?(:'feasible_count')
148
+ self.feasible_count = attributes[:'feasible_count']
149
+ end
150
+
151
+ if attributes.key?(:'kind')
152
+ self.kind = attributes[:'kind']
153
+ end
154
+
155
+ if attributes.key?(:'matched_skills')
156
+ self.matched_skills = attributes[:'matched_skills']
157
+ end
158
+
159
+ if attributes.key?(:'start_at')
160
+ self.start_at = attributes[:'start_at']
161
+ end
162
+
163
+ if attributes.key?(:'status_version')
164
+ self.status_version = attributes[:'status_version']
165
+ end
166
+
167
+ if attributes.key?(:'to_name')
168
+ self.to_name = attributes[:'to_name']
169
+ end
170
+
171
+ if attributes.key?(:'to_technician_id')
172
+ self.to_technician_id = attributes[:'to_technician_id']
173
+ end
174
+
175
+ if attributes.key?(:'total_score')
176
+ self.total_score = attributes[:'total_score']
177
+ end
178
+
179
+ if attributes.key?(:'window_moved')
180
+ self.window_moved = attributes[:'window_moved']
181
+ end
182
+ end
183
+
184
+ # Show invalid properties with the reasons. Usually used together with valid?
185
+ # @return Array for valid properties with the reasons
186
+ def list_invalid_properties
187
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
188
+ invalid_properties = Array.new
189
+ invalid_properties
190
+ end
191
+
192
+ # Check to see if the all the properties in the model are valid
193
+ # @return true if the model is valid
194
+ def valid?
195
+ warn '[DEPRECATED] the `valid?` method is obsolete'
196
+ kind_validator = EnumAttributeValidator.new('String', ["reassign_out_of_area", "reschedule_same_day", "reschedule_later_day"])
197
+ return false unless kind_validator.valid?(@kind)
198
+ true
199
+ end
200
+
201
+ # Custom attribute writer method checking allowed values (enum).
202
+ # @param [Object] kind Object to be assigned
203
+ def kind=(kind)
204
+ validator = EnumAttributeValidator.new('String', ["reassign_out_of_area", "reschedule_same_day", "reschedule_later_day"])
205
+ unless validator.valid?(kind)
206
+ fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}."
207
+ end
208
+ @kind = kind
209
+ end
210
+
211
+ # Checks equality by comparing each attribute.
212
+ # @param [Object] Object to be compared
213
+ def ==(o)
214
+ return true if self.equal?(o)
215
+ self.class == o.class &&
216
+ cost == o.cost &&
217
+ desired_skills == o.desired_skills &&
218
+ end_at == o.end_at &&
219
+ feasible_count == o.feasible_count &&
220
+ kind == o.kind &&
221
+ matched_skills == o.matched_skills &&
222
+ start_at == o.start_at &&
223
+ status_version == o.status_version &&
224
+ to_name == o.to_name &&
225
+ to_technician_id == o.to_technician_id &&
226
+ total_score == o.total_score &&
227
+ window_moved == o.window_moved
228
+ end
229
+
230
+ # @see the `==` method
231
+ # @param [Object] Object to be compared
232
+ def eql?(o)
233
+ self == o
234
+ end
235
+
236
+ # Calculates hash code according to all attributes.
237
+ # @return [Integer] Hash code
238
+ def hash
239
+ [cost, desired_skills, end_at, feasible_count, kind, matched_skills, start_at, status_version, to_name, to_technician_id, total_score, window_moved].hash
240
+ end
241
+
242
+ # Builds the object from hash
243
+ # @param [Hash] attributes Model attributes in the form of hash
244
+ # @return [Object] Returns the model itself
245
+ def self.build_from_hash(attributes)
246
+ return nil unless attributes.is_a?(Hash)
247
+ attributes = attributes.transform_keys(&:to_sym)
248
+ transformed_hash = {}
249
+ openapi_types.each_pair do |key, type|
250
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
251
+ transformed_hash["#{key}"] = nil
252
+ elsif type =~ /\AArray<(.*)>/i
253
+ # check to ensure the input is an array given that the attribute
254
+ # is documented as an array but the input is not
255
+ if attributes[attribute_map[key]].is_a?(Array)
256
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
257
+ end
258
+ elsif !attributes[attribute_map[key]].nil?
259
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
260
+ end
261
+ end
262
+ new(transformed_hash)
263
+ end
264
+
265
+ # Deserializes the data based on type
266
+ # @param string type Data type
267
+ # @param string value Value to be deserialized
268
+ # @return [Object] Deserialized data
269
+ def self._deserialize(type, value)
270
+ case type.to_sym
271
+ when :Time
272
+ Time.parse(value)
273
+ when :Date
274
+ Date.parse(value)
275
+ when :String
276
+ value.to_s
277
+ when :Integer
278
+ value.to_i
279
+ when :Float
280
+ value.to_f
281
+ when :Boolean
282
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
283
+ true
284
+ else
285
+ false
286
+ end
287
+ when :Object
288
+ # generic object (usually a Hash), return directly
289
+ value
290
+ when /\AArray<(?<inner_type>.+)>\z/
291
+ inner_type = Regexp.last_match[:inner_type]
292
+ value.map { |v| _deserialize(inner_type, v) }
293
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
294
+ k_type = Regexp.last_match[:k_type]
295
+ v_type = Regexp.last_match[:v_type]
296
+ {}.tap do |hash|
297
+ value.each do |k, v|
298
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
299
+ end
300
+ end
301
+ else # model
302
+ # models (e.g. Pet) or oneOf
303
+ klass = Crisphive.const_get(type)
304
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
305
+ end
306
+ end
307
+
308
+ # Returns the string representation of the object
309
+ # @return [String] String presentation of the object
310
+ def to_s
311
+ to_hash.to_s
312
+ end
313
+
314
+ # to_body is an alias to to_hash (backward compatibility)
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_body
317
+ to_hash
318
+ end
319
+
320
+ # Returns the object in the form of hash
321
+ # @return [Hash] Returns the object in the form of hash
322
+ def to_hash
323
+ hash = {}
324
+ self.class.attribute_map.each_pair do |attr, param|
325
+ value = self.send(attr)
326
+ if value.nil?
327
+ is_nullable = self.class.openapi_nullable.include?(attr)
328
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
329
+ end
330
+
331
+ hash[param] = _to_hash(value)
332
+ end
333
+ hash
334
+ end
335
+
336
+ # Outputs non-array value in the form of hash
337
+ # For object, use to_hash. Otherwise, just return the value
338
+ # @param [Object] value Any valid value
339
+ # @return [Hash] Returns the value in the form of hash
340
+ def _to_hash(value)
341
+ if value.is_a?(Array)
342
+ value.compact.map { |v| _to_hash(v) }
343
+ elsif value.is_a?(Hash)
344
+ {}.tap do |hash|
345
+ value.each { |k, v| hash[k] = _to_hash(v) }
346
+ end
347
+ elsif value.respond_to? :to_hash
348
+ value.to_hash
349
+ else
350
+ value
351
+ end
352
+ end
353
+
354
+ end
355
+
356
+ end