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
@@ -0,0 +1,255 @@
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 JobRequestConfirmRequest
18
+ # AfterHoursOverride (BUSINESS confirm only): schedule this P0 outside the technician's working hours or approved time-off — you have phoned them and they agreed. Requires priority p0, a single-person job, and technician_id. Double-booking, service area, required skills and the lead-tier rule still reject. Deliberately NOT a binding-tag rule: gin evaluates tags before the handler, which would make the three AFTER_HOURS codes unreachable.
19
+ attr_accessor :after_hours_override
20
+
21
+ # ArrivalWindowMinutes = width (phút) của arrival-window ô khách bấm ở slot-picker (chính là time_slot_step_minutes, mặc định 30). Persist để post-confirm detail render lại đúng window. Optional; bounds ([5, 240], khớp slot-picker step) validate ở usecase — single authority, một error code (JOB_REQUEST_INVALID_INPUT).
22
+ attr_accessor :arrival_window_minutes
23
+
24
+ # Chosen start time — business-local wall clock (the business_time.datetime value from the time-segments picker), converted to UTC against the job's business timezone. Seconds may be omitted and a space may replace the T. An offset is accepted only when it agrees with the business timezone; a disagreeing one is refused with JOB_REQUEST_INVALID_INPUT naming what it means locally.
25
+ attr_accessor :scheduled_at
26
+
27
+ # Optimistic-lock fence: the status_version from your last read. Omitted/0 = fence on the row's current version (no race protection).
28
+ attr_accessor :status_version
29
+
30
+ # TechnicianID (BUSINESS confirm only — ignored on the customer surface): force-assign the job to this technician instead of the ranked auto-pick. Ranking is bypassed; feasibility (hours/time-off/geo/skills), the TierLead rule and the double-booking guard still apply — an infeasible forced tech rejects the confirm (P0 gets the displacement hint). ⚠️ One exception: for a SINGLE-PERSON p0 job, a PERSONAL-CALENDAR overlap on this exact technician no longer rejects — naming them here is treated as having already phoned them, so the confirm succeeds and the override is recorded on the business's activity feed (this response has no warnings array to carry it). A multi-member crew still rejects on it.
31
+ attr_accessor :technician_id
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'after_hours_override' => :'after_hours_override',
37
+ :'arrival_window_minutes' => :'arrival_window_minutes',
38
+ :'scheduled_at' => :'scheduled_at',
39
+ :'status_version' => :'status_version',
40
+ :'technician_id' => :'technician_id'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'after_hours_override' => :'Boolean',
53
+ :'arrival_window_minutes' => :'Integer',
54
+ :'scheduled_at' => :'Time',
55
+ :'status_version' => :'Integer',
56
+ :'technician_id' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestConfirmRequest` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestConfirmRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'after_hours_override')
82
+ self.after_hours_override = attributes[:'after_hours_override']
83
+ end
84
+
85
+ if attributes.key?(:'arrival_window_minutes')
86
+ self.arrival_window_minutes = attributes[:'arrival_window_minutes']
87
+ end
88
+
89
+ if attributes.key?(:'scheduled_at')
90
+ self.scheduled_at = attributes[:'scheduled_at']
91
+ end
92
+
93
+ if attributes.key?(:'status_version')
94
+ self.status_version = attributes[:'status_version']
95
+ end
96
+
97
+ if attributes.key?(:'technician_id')
98
+ self.technician_id = attributes[:'technician_id']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
106
+ invalid_properties = Array.new
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ warn '[DEPRECATED] the `valid?` method is obsolete'
114
+ true
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ after_hours_override == o.after_hours_override &&
123
+ arrival_window_minutes == o.arrival_window_minutes &&
124
+ scheduled_at == o.scheduled_at &&
125
+ status_version == o.status_version &&
126
+ technician_id == o.technician_id
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Integer] Hash code
137
+ def hash
138
+ [after_hours_override, arrival_window_minutes, scheduled_at, status_version, technician_id].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def self.build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ attributes = attributes.transform_keys(&:to_sym)
147
+ transformed_hash = {}
148
+ openapi_types.each_pair do |key, type|
149
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
150
+ transformed_hash["#{key}"] = nil
151
+ elsif type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[attribute_map[key]].is_a?(Array)
155
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
156
+ end
157
+ elsif !attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
159
+ end
160
+ end
161
+ new(transformed_hash)
162
+ end
163
+
164
+ # Deserializes the data based on type
165
+ # @param string type Data type
166
+ # @param string value Value to be deserialized
167
+ # @return [Object] Deserialized data
168
+ def self._deserialize(type, value)
169
+ case type.to_sym
170
+ when :Time
171
+ Time.parse(value)
172
+ when :Date
173
+ Date.parse(value)
174
+ when :String
175
+ value.to_s
176
+ when :Integer
177
+ value.to_i
178
+ when :Float
179
+ value.to_f
180
+ when :Boolean
181
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
+ true
183
+ else
184
+ false
185
+ end
186
+ when :Object
187
+ # generic object (usually a Hash), return directly
188
+ value
189
+ when /\AArray<(?<inner_type>.+)>\z/
190
+ inner_type = Regexp.last_match[:inner_type]
191
+ value.map { |v| _deserialize(inner_type, v) }
192
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
+ k_type = Regexp.last_match[:k_type]
194
+ v_type = Regexp.last_match[:v_type]
195
+ {}.tap do |hash|
196
+ value.each do |k, v|
197
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
+ end
199
+ end
200
+ else # model
201
+ # models (e.g. Pet) or oneOf
202
+ klass = Crisphive.const_get(type)
203
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ if value.nil?
226
+ is_nullable = self.class.openapi_nullable.include?(attr)
227
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
+ end
229
+
230
+ hash[param] = _to_hash(value)
231
+ end
232
+ hash
233
+ end
234
+
235
+ # Outputs non-array value in the form of hash
236
+ # For object, use to_hash. Otherwise, just return the value
237
+ # @param [Object] value Any valid value
238
+ # @return [Hash] Returns the value in the form of hash
239
+ def _to_hash(value)
240
+ if value.is_a?(Array)
241
+ value.compact.map { |v| _to_hash(v) }
242
+ elsif value.is_a?(Hash)
243
+ {}.tap do |hash|
244
+ value.each { |k, v| hash[k] = _to_hash(v) }
245
+ end
246
+ elsif value.respond_to? :to_hash
247
+ value.to_hash
248
+ else
249
+ value
250
+ end
251
+ end
252
+
253
+ end
254
+
255
+ end
@@ -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
 
@@ -24,12 +24,40 @@ module Crisphive
24
24
  # Requested date(s) + period(s) the customer wants the job. At least one, up to 12.
25
25
  attr_accessor :job_dates
26
26
 
27
- # UUID of the job type to classify this job. Optional; null leaves the job unclassified.
27
+ # UUID of the job type to classify this job. Optional: omitted, the business's DEFAULT job type (`is_default`, the seeded \"General\") is used, so every new job has a type and can be quoted from its default duration.
28
28
  attr_accessor :job_type_id
29
29
 
30
+ # Scheduling priority. Optional; omitted bookings receive the business's default_priority setting (assignment settings, default p2). p0=emergency (interrupt-driven insert), p1=top (displaced only by p0), p2=standard, p3=deferrable (first candidate for displacement).
31
+ attr_accessor :priority
32
+
30
33
  # UUIDs of the skills the customer desires for this job. Optional; up to 20.
31
34
  attr_accessor :skill_ids
32
35
 
36
+ # SLA deadline (business-local naive datetime, e.g. \"2030-06-14T17:00:00\"). Optional; ONLY valid together with priority=p1 — arms the auto-escalation clock (the job escalates to p0 as breach risk crosses the business's safety buffer). Must be in the future.
37
+ attr_accessor :sla_deadline
38
+
39
+ class EnumAttributeValidator
40
+ attr_reader :datatype
41
+ attr_reader :allowable_values
42
+
43
+ def initialize(datatype, allowable_values)
44
+ @allowable_values = allowable_values.map do |value|
45
+ case datatype.to_s
46
+ when /Integer/i
47
+ value.to_i
48
+ when /Float/i
49
+ value.to_f
50
+ else
51
+ value
52
+ end
53
+ end
54
+ end
55
+
56
+ def valid?(value)
57
+ !value || allowable_values.include?(value)
58
+ end
59
+ end
60
+
33
61
  # Attribute mapping from ruby-style variable name to JSON key.
34
62
  def self.attribute_map
35
63
  {
@@ -37,7 +65,9 @@ module Crisphive
37
65
  :'description' => :'description',
38
66
  :'job_dates' => :'job_dates',
39
67
  :'job_type_id' => :'job_type_id',
40
- :'skill_ids' => :'skill_ids'
68
+ :'priority' => :'priority',
69
+ :'skill_ids' => :'skill_ids',
70
+ :'sla_deadline' => :'sla_deadline'
41
71
  }
42
72
  end
43
73
 
@@ -53,7 +83,9 @@ module Crisphive
53
83
  :'description' => :'String',
54
84
  :'job_dates' => :'Array<JobRequestJobDateRequest>',
55
85
  :'job_type_id' => :'String',
56
- :'skill_ids' => :'Array<String>'
86
+ :'priority' => :'String',
87
+ :'skill_ids' => :'Array<String>',
88
+ :'sla_deadline' => :'String'
57
89
  }
58
90
  end
59
91
 
@@ -100,11 +132,19 @@ module Crisphive
100
132
  self.job_type_id = attributes[:'job_type_id']
101
133
  end
102
134
 
135
+ if attributes.key?(:'priority')
136
+ self.priority = attributes[:'priority']
137
+ end
138
+
103
139
  if attributes.key?(:'skill_ids')
104
140
  if (value = attributes[:'skill_ids']).is_a?(Array)
105
141
  self.skill_ids = value
106
142
  end
107
143
  end
144
+
145
+ if attributes.key?(:'sla_deadline')
146
+ self.sla_deadline = attributes[:'sla_deadline']
147
+ end
108
148
  end
109
149
 
110
150
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -148,6 +188,8 @@ module Crisphive
148
188
  return false if @job_dates.nil?
149
189
  return false if @job_dates.length > 12
150
190
  return false if @job_dates.length < 1
191
+ priority_validator = EnumAttributeValidator.new('String', ["p0", "p1", "p2", "p3"])
192
+ return false unless priority_validator.valid?(@priority)
151
193
  return false if !@skill_ids.nil? && @skill_ids.length > 20
152
194
  true
153
195
  end
@@ -184,6 +226,16 @@ module Crisphive
184
226
  @job_dates = job_dates
185
227
  end
186
228
 
229
+ # Custom attribute writer method checking allowed values (enum).
230
+ # @param [Object] priority Object to be assigned
231
+ def priority=(priority)
232
+ validator = EnumAttributeValidator.new('String', ["p0", "p1", "p2", "p3"])
233
+ unless validator.valid?(priority)
234
+ fail ArgumentError, "invalid value for \"priority\", must be one of #{validator.allowable_values}."
235
+ end
236
+ @priority = priority
237
+ end
238
+
187
239
  # Custom attribute writer method with validation
188
240
  # @param [Object] skill_ids Value to be assigned
189
241
  def skill_ids=(skill_ids)
@@ -207,7 +259,9 @@ module Crisphive
207
259
  description == o.description &&
208
260
  job_dates == o.job_dates &&
209
261
  job_type_id == o.job_type_id &&
210
- skill_ids == o.skill_ids
262
+ priority == o.priority &&
263
+ skill_ids == o.skill_ids &&
264
+ sla_deadline == o.sla_deadline
211
265
  end
212
266
 
213
267
  # @see the `==` method
@@ -219,7 +273,7 @@ module Crisphive
219
273
  # Calculates hash code according to all attributes.
220
274
  # @return [Integer] Hash code
221
275
  def hash
222
- [customer_id, description, job_dates, job_type_id, skill_ids].hash
276
+ [customer_id, description, job_dates, job_type_id, priority, skill_ids, sla_deadline].hash
223
277
  end
224
278
 
225
279
  # Builds the object from hash
@@ -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
 
@@ -0,0 +1,227 @@
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 JobRequestCrewCandidates
18
+ # Job identifier — the human-readable short code when present, else the job UUID.
19
+ attr_accessor :job_request_id
20
+
21
+ # Ranked feasible lead technicians, best total_score first; each carries its own buddy/vehicle sections when requested.
22
+ attr_accessor :leads
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'job_request_id' => :'job_request_id',
28
+ :'leads' => :'leads'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'job_request_id' => :'String',
41
+ :'leads' => :'Array<JobRequestLeadCandidate>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestCrewCandidates` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestCrewCandidates`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'job_request_id')
67
+ self.job_request_id = attributes[:'job_request_id']
68
+ end
69
+
70
+ if attributes.key?(:'leads')
71
+ if (value = attributes[:'leads']).is_a?(Array)
72
+ self.leads = value
73
+ end
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
+ invalid_properties = Array.new
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ warn '[DEPRECATED] the `valid?` method is obsolete'
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ job_request_id == o.job_request_id &&
98
+ leads == o.leads
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [job_request_id, leads].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ attributes = attributes.transform_keys(&:to_sym)
119
+ transformed_hash = {}
120
+ openapi_types.each_pair do |key, type|
121
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
122
+ transformed_hash["#{key}"] = nil
123
+ elsif type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[attribute_map[key]].is_a?(Array)
127
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
128
+ end
129
+ elsif !attributes[attribute_map[key]].nil?
130
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
131
+ end
132
+ end
133
+ new(transformed_hash)
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def self._deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = Crisphive.const_get(type)
175
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ end