Class: Crisphive::JobRequestBusinessApi

Inherits:
Object
  • Object
show all
Defined in:
lib/crisphive/api/job_request_business_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ JobRequestBusinessApi

Returns a new instance of JobRequestBusinessApi.



19
20
21
# File 'lib/crisphive/api/job_request_business_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/crisphive/api/job_request_business_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#commit_emergency_reschedule(job_request_emergency_commit_request, opts = {}) ⇒ CommitEmergencyReschedule200Response

Commit emergency insert + cascade reschedule Applies the cascade previewed by /emergency/preview: assigns the emergency job to the technician and pushes the displaced jobs back (or, with displacement_mode=reassign, re-staffs them onto their previewed alternates first), atomically. Supports Idempotency-Key. The server recomputes the plan under a lock and fences each job on its status_version — if anything changed since the preview it returns 409 EMERGENCY_RESCHEDULE_PLAN_DRIFTED (re-preview). Same body as preview + optional emergency_expected_version. Isolated feature (see EMERGENCY_RESCHEDULE_DESIGN.md). 409 NEXT STEPS: EMERGENCY_RESCHEDULE_PLAN_DRIFTED — the schedule changed between your preview and this commit (another booking/move won a lane): call /preview again, show the fresh plan, then commit. EMERGENCY_RESCHEDULE_SLOT_OCCUPIED — landing window blocked by an immovable anchor (P0/crew/multi-day): another tech or time. Other codes — same remedies as /candidates.

Parameters:

Options Hash (opts):

  • :idempotency_key (String)

    Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.

Returns:



28
29
30
31
# File 'lib/crisphive/api/job_request_business_api.rb', line 28

def commit_emergency_reschedule(job_request_emergency_commit_request, opts = {})
  data, _status_code, _headers = commit_emergency_reschedule_with_http_info(job_request_emergency_commit_request, opts)
  data
end

#commit_emergency_reschedule_with_http_info(job_request_emergency_commit_request, opts = {}) ⇒ Array<(CommitEmergencyReschedule200Response, Integer, Hash)>

Commit emergency insert + cascade reschedule Applies the cascade previewed by /emergency/preview: assigns the emergency job to the technician and pushes the displaced jobs back (or, with `displacement_mode=reassign`, re-staffs them onto their previewed alternates first), atomically. Supports Idempotency-Key. The server recomputes the plan under a lock and fences each job on its status_version — if anything changed since the preview it returns 409 EMERGENCY_RESCHEDULE_PLAN_DRIFTED (re-preview). Same body as preview + optional `emergency_expected_version`. Isolated feature (see EMERGENCY_RESCHEDULE_DESIGN.md). 409 NEXT STEPS: EMERGENCY_RESCHEDULE_PLAN_DRIFTED — the schedule changed between your preview and this commit (another booking/move won a lane): call /preview again, show the fresh plan, then commit. EMERGENCY_RESCHEDULE_SLOT_OCCUPIED — landing window blocked by an immovable anchor (P0/crew/multi-day): another tech or time. Other codes — same remedies as /candidates.

Parameters:

Options Hash (opts):

  • :idempotency_key (String)

    Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/crisphive/api/job_request_business_api.rb', line 39

def commit_emergency_reschedule_with_http_info(job_request_emergency_commit_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.commit_emergency_reschedule ...'
  end
  # verify the required parameter 'job_request_emergency_commit_request' is set
  if @api_client.config.client_side_validation && job_request_emergency_commit_request.nil?
    fail ArgumentError, "Missing the required parameter 'job_request_emergency_commit_request' when calling JobRequestBusinessApi.commit_emergency_reschedule"
  end
  # resource path
  local_var_path = '/job-requests/emergency/commit'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_emergency_commit_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CommitEmergencyReschedule200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.commit_emergency_reschedule",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#commit_emergency_reschedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#commit_job_request_move(id, job_request_move_commit_req, opts = {}) ⇒ CommitJobRequestMove200Response

Commit a schedule-board job move Applies the move previewed by /move/preview: places the job on the technician at the new time and pushes the displaced jobs back, atomically (per-tech advisory lock; the server recomputes the plan and fences each job on its status_version — drift since the preview returns 409 SCHEDULE_MOVE_PLAN_DRIFTED, re-preview). Same body as preview + optional expected_version. See SCHEDULE_BOARD_DESIGN.md. 409 NEXT STEPS: SCHEDULE_MOVE_PLAN_DRIFTED — the schedule changed since your preview (or expected_move_ids no longer match): re-preview, show the fresh plan, commit again. All other codes — same remedies as /move/preview.

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • job_request_move_commit_req (JobRequestMoveCommitReq)

    move spec

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.

Returns:



100
101
102
103
# File 'lib/crisphive/api/job_request_business_api.rb', line 100

def commit_job_request_move(id, job_request_move_commit_req, opts = {})
  data, _status_code, _headers = commit_job_request_move_with_http_info(id, job_request_move_commit_req, opts)
  data
end

#commit_job_request_move_with_http_info(id, job_request_move_commit_req, opts = {}) ⇒ Array<(CommitJobRequestMove200Response, Integer, Hash)>

Commit a schedule-board job move Applies the move previewed by /move/preview: places the job on the technician at the new time and pushes the displaced jobs back, atomically (per-tech advisory lock; the server recomputes the plan and fences each job on its status_version — drift since the preview returns 409 SCHEDULE_MOVE_PLAN_DRIFTED, re-preview). Same body as preview + optional `expected_version`. See SCHEDULE_BOARD_DESIGN.md. 409 NEXT STEPS: SCHEDULE_MOVE_PLAN_DRIFTED — the schedule changed since your preview (or expected_move_ids no longer match): re-preview, show the fresh plan, commit again. All other codes — same remedies as /move/preview.

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • job_request_move_commit_req (JobRequestMoveCommitReq)

    move spec

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.

Returns:



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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
# File 'lib/crisphive/api/job_request_business_api.rb', line 112

def commit_job_request_move_with_http_info(id, job_request_move_commit_req, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.commit_job_request_move ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.commit_job_request_move"
  end
  # verify the required parameter 'job_request_move_commit_req' is set
  if @api_client.config.client_side_validation && job_request_move_commit_req.nil?
    fail ArgumentError, "Missing the required parameter 'job_request_move_commit_req' when calling JobRequestBusinessApi.commit_job_request_move"
  end
  # resource path
  local_var_path = '/job-requests/{id}/move/commit'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_move_commit_req)

  # return_type
  return_type = opts[:debug_return_type] || 'CommitJobRequestMove200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.commit_job_request_move",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#commit_job_request_move\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#confirm_job_request(id, job_request_confirm_request, opts = {}) ⇒ ResponseEnvelope

Confirm a booking on behalf of the customer Fires the customer-actor confirm_booking action from the BUSINESS surface (audited as business_on_behalf). Two uses: (1) LIVE — staff confirm a slot for a customer who booked by phone; (2) SANDBOX — the customer magic-token surface is live-only (a sandbox job's link can never reach a real customer), so this is the ONLY way to drive a sandbox test job past booking (book → quote → confirm → assign → complete). Body carries the customer-chosen scheduled_at (business-local naive datetime). DECISION TABLE — every 409 this endpoint returns, and the correct NEXT STEP (branch on error_code, never on the HTTP status): • JOB_REQUEST_STAGE_CONFLICT — the job changed since you read it (NOTE: every FAILED confirm attempt also bumps status_version by design). Next: re-GET the job, retry with the fresh status_version. • JOB_REQUEST_ACTION_NOT_PENDING — the job is no longer at the confirm step (usually: already confirmed). Next: re-GET and show current status; do not retry. • JOB_REQUEST_NO_TECHNICIAN_AVAILABLE — the TIME is infeasible for everyone (outside working hours / the customer window, or nobody qualifies). Next: pick another time via booking-windows / time-segments. NOT an emergency case — displacement cannot conjure capacity. • JOB_REQUEST_TECH_INFEASIBLE — the FORCED technician can never take the job then; data.reason says why: cannot_arrive_in_time (commute/shift-start — data.earliest_feasible_at (RFC3339 UTC) is the first same-day time they CAN be on site → offer it) | missing_required_skills | not_available_today | not_lead_tier. Next: keep the tech and reschedule to earliest_feasible_at+, OR keep the time and drop technician_id (auto-pick) / choose another tech from time-segments. NOT an emergency case. • JOB_REQUEST_P0_REQUIRES_DISPLACEMENT — the ONLY code that routes to the EMERGENCY flow: the job is P0, the tech qualifies, but the lane is genuinely occupied. Next: POST emergency/candidates → preview → commit (the commit auto-confirms). Caveat: if the occupying jobs are themselves P0 the preview will reject with EMERGENCY_RESCHEDULE_SLOT_OCCUPIED (P0 never displaces P0) — then pick another tech/time.

Parameters:

  • id (String)

    Job request ID

  • job_request_confirm_request (JobRequestConfirmRequest)

    Chosen slot (scheduled_at) + optional technician_id force-assign (P0–P3 flow: pins the ranked candidate, feasibility still enforced)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.

Returns:



177
178
179
180
# File 'lib/crisphive/api/job_request_business_api.rb', line 177

def confirm_job_request(id, job_request_confirm_request, opts = {})
  data, _status_code, _headers = confirm_job_request_with_http_info(id, job_request_confirm_request, opts)
  data
end

#confirm_job_request_with_http_info(id, job_request_confirm_request, opts = {}) ⇒ Array<(ResponseEnvelope, Integer, Hash)>

Confirm a booking on behalf of the customer Fires the customer-actor `confirm_booking` action from the BUSINESS surface (audited as business_on_behalf). Two uses: (1) LIVE — staff confirm a slot for a customer who booked by phone; (2) SANDBOX — the customer magic-token surface is live-only (a sandbox job's link can never reach a real customer), so this is the ONLY way to drive a sandbox test job past booking (book → quote → confirm → assign → complete). Body carries the customer-chosen scheduled_at (business-local naive datetime). DECISION TABLE — every 409 this endpoint returns, and the correct NEXT STEP (branch on error_code, never on the HTTP status): • JOB_REQUEST_STAGE_CONFLICT — the job changed since you read it (NOTE: every FAILED confirm attempt also bumps status_version by design). Next: re-GET the job, retry with the fresh status_version. • JOB_REQUEST_ACTION_NOT_PENDING — the job is no longer at the confirm step (usually: already confirmed). Next: re-GET and show current status; do not retry. • JOB_REQUEST_NO_TECHNICIAN_AVAILABLE — the TIME is infeasible for everyone (outside working hours / the customer window, or nobody qualifies). Next: pick another time via booking-windows / time-segments. NOT an emergency case — displacement cannot conjure capacity. • JOB_REQUEST_TECH_INFEASIBLE — the FORCED technician can never take the job then; `data.reason` says why: cannot_arrive_in_time (commute/shift-start — `data.earliest_feasible_at` (RFC3339 UTC) is the first same-day time they CAN be on site → offer it) | missing_required_skills | not_available_today | not_lead_tier. Next: keep the tech and reschedule to earliest_feasible_at+, OR keep the time and drop technician_id (auto-pick) / choose another tech from time-segments. NOT an emergency case. • JOB_REQUEST_P0_REQUIRES_DISPLACEMENT — the ONLY code that routes to the EMERGENCY flow: the job is P0, the tech qualifies, but the lane is genuinely occupied. Next: POST emergency/candidates → preview → commit (the commit auto-confirms). Caveat: if the occupying jobs are themselves P0 the preview will reject with EMERGENCY_RESCHEDULE_SLOT_OCCUPIED (P0 never displaces P0) — then pick another tech/time.

Parameters:

  • id (String)

    Job request ID

  • job_request_confirm_request (JobRequestConfirmRequest)

    Chosen slot (scheduled_at) + optional technician_id force-assign (P0–P3 flow: pins the ranked candidate, feasibility still enforced)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    Unique key making retries safe: a repeat send with the same key replays the original response (header Idempotent-Replayed: true) instead of re-running the operation. Reusing a key with a different body returns 422 IDEMPOTENCY_KEY_REUSE.

Returns:

  • (Array<(ResponseEnvelope, Integer, Hash)>)

    ResponseEnvelope data, response status code and response headers



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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/crisphive/api/job_request_business_api.rb', line 189

def confirm_job_request_with_http_info(id, job_request_confirm_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.confirm_job_request ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.confirm_job_request"
  end
  # verify the required parameter 'job_request_confirm_request' is set
  if @api_client.config.client_side_validation && job_request_confirm_request.nil?
    fail ArgumentError, "Missing the required parameter 'job_request_confirm_request' when calling JobRequestBusinessApi.confirm_job_request"
  end
  # resource path
  local_var_path = '/job-requests/{id}/confirm'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_confirm_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ResponseEnvelope'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.confirm_job_request",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#confirm_job_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_job_request(job_request_create_request, opts = {}) ⇒ CreateJobRequest200Response

Create a job request Books a field-service job — the work order that enters the dispatch & scheduling pipeline. Send the customer's UUID plus requested job_dates (date + morning/afternoon/evening periods, ideally offered from GET /job-requests/booking-windows), optional job_type_id (service catalog), skill_ids (required technician qualifications) and a free-text description. Quoting, technician/crew assignment and completion then advance the work order through the business's workflow.

Parameters:

  • job_request_create_request (JobRequestCreateRequest)

    Booking payload

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_timezone (String)

    Customer IANA timezone

  • :idempotency_key (String)

    Unique key making retries safe: a repeat send with the same key returns the original booking instead of creating a duplicate

Returns:



254
255
256
257
# File 'lib/crisphive/api/job_request_business_api.rb', line 254

def create_job_request(job_request_create_request, opts = {})
  data, _status_code, _headers = create_job_request_with_http_info(job_request_create_request, opts)
  data
end

#create_job_request_with_http_info(job_request_create_request, opts = {}) ⇒ Array<(CreateJobRequest200Response, Integer, Hash)>

Create a job request Books a field-service job — the work order that enters the dispatch & scheduling pipeline. Send the customer's UUID plus requested `job_dates` (date + morning/afternoon/evening periods, ideally offered from GET /job-requests/booking-windows), optional `job_type_id` (service catalog), `skill_ids` (required technician qualifications) and a free-text description. Quoting, technician/crew assignment and completion then advance the work order through the business's workflow.

Parameters:

  • job_request_create_request (JobRequestCreateRequest)

    Booking payload

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_timezone (String)

    Customer IANA timezone

  • :idempotency_key (String)

    Unique key making retries safe: a repeat send with the same key returns the original booking instead of creating a duplicate

Returns:

  • (Array<(CreateJobRequest200Response, Integer, Hash)>)

    CreateJobRequest200Response data, response status code and response headers



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/crisphive/api/job_request_business_api.rb', line 266

def create_job_request_with_http_info(job_request_create_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.create_job_request ...'
  end
  # verify the required parameter 'job_request_create_request' is set
  if @api_client.config.client_side_validation && job_request_create_request.nil?
    fail ArgumentError, "Missing the required parameter 'job_request_create_request' when calling JobRequestBusinessApi.create_job_request"
  end
  # resource path
  local_var_path = '/job-requests'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'X-Timezone'] = opts[:'x_timezone'] if !opts[:'x_timezone'].nil?
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_create_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateJobRequest200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.create_job_request",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#create_job_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_job_request(id, opts = {}) ⇒ GetJobRequest200Response

Get a job request Returns the full work order: current workflow status, quoted duration, confirmed schedule, customer contact snapshot and the assigned technician / crew — everything a dispatcher or an external field-service system needs to track one job.

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



326
327
328
329
# File 'lib/crisphive/api/job_request_business_api.rb', line 326

def get_job_request(id, opts = {})
  data, _status_code, _headers = get_job_request_with_http_info(id, opts)
  data
end

#get_job_request_timeline(id, opts = {}) ⇒ GetJobRequestTimeline200Response

Job timeline Per-status progress of a job's lifecycle (e.g. booked → confirmed → on the way → arrived → completed, following the business's configured workflow) — render it as a job-tracking timeline. Each status carries its state (completed | current | upcoming), when the job entered it, and the actions fired within it. entered_at may be null for upcoming steps and for older jobs predating the backfill.

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



389
390
391
392
# File 'lib/crisphive/api/job_request_business_api.rb', line 389

def get_job_request_timeline(id, opts = {})
  data, _status_code, _headers = get_job_request_timeline_with_http_info(id, opts)
  data
end

#get_job_request_timeline_with_http_info(id, opts = {}) ⇒ Array<(GetJobRequestTimeline200Response, Integer, Hash)>

Job timeline Per-status progress of a job's lifecycle (e.g. booked → confirmed → on the way → arrived → completed, following the business's configured workflow) — render it as a job-tracking timeline. Each status carries its state (completed | current | upcoming), when the job entered it, and the actions fired within it. entered_at may be null for upcoming steps and for older jobs predating the backfill.

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
# File 'lib/crisphive/api/job_request_business_api.rb', line 399

def get_job_request_timeline_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.get_job_request_timeline ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.get_job_request_timeline"
  end
  # resource path
  local_var_path = '/job-requests/{id}/timeline'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetJobRequestTimeline200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.get_job_request_timeline",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#get_job_request_timeline\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_job_request_with_http_info(id, opts = {}) ⇒ Array<(GetJobRequest200Response, Integer, Hash)>

Get a job request Returns the full work order: current workflow status, quoted duration, confirmed schedule, customer contact snapshot and the assigned technician / crew — everything a dispatcher or an external field-service system needs to track one job.

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetJobRequest200Response, Integer, Hash)>)

    GetJobRequest200Response data, response status code and response headers



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/crisphive/api/job_request_business_api.rb', line 336

def get_job_request_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.get_job_request ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.get_job_request"
  end
  # resource path
  local_var_path = '/job-requests/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetJobRequest200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.get_job_request",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#get_job_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_technician_schedule(id, opts = {}) ⇒ GetTechnicianSchedule200Response

One technician's real schedule (sessions + time off) The technician's ACTUAL occupancy over a date range: every job session on their lane (solo/lead and crew) plus approved time-off blocks. Weekly recurring working hours come from the technician-availability endpoints — combine both for the full availability picture ("get crew availability"). from/to are business-local dates (YYYY-MM-DD, inclusive); omitted = today .. +7 days; range max 31 days.

Parameters:

  • id (String)

    Technician ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from (String)

    Start date (YYYY-MM-DD, business-local; default today)

  • :to (String)

    End date (YYYY-MM-DD, inclusive; default from+7d; max range 31 days)

Returns:



454
455
456
457
# File 'lib/crisphive/api/job_request_business_api.rb', line 454

def get_technician_schedule(id, opts = {})
  data, _status_code, _headers = get_technician_schedule_with_http_info(id, opts)
  data
end

#get_technician_schedule_with_http_info(id, opts = {}) ⇒ Array<(GetTechnicianSchedule200Response, Integer, Hash)>

One technician's real schedule (sessions + time off) The technician's ACTUAL occupancy over a date range: every job session on their lane (solo/lead and crew) plus approved time-off blocks. Weekly recurring working hours come from the technician-availability endpoints — combine both for the full availability picture (&quot;get crew availability&quot;). from/to are business-local dates (YYYY-MM-DD, inclusive); omitted = today .. +7 days; range max 31 days.

Parameters:

  • id (String)

    Technician ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from (String)

    Start date (YYYY-MM-DD, business-local; default today)

  • :to (String)

    End date (YYYY-MM-DD, inclusive; default from+7d; max range 31 days)

Returns:



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/crisphive/api/job_request_business_api.rb', line 466

def get_technician_schedule_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.get_technician_schedule ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.get_technician_schedule"
  end
  # resource path
  local_var_path = '/technicians/{id}/schedule'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetTechnicianSchedule200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.get_technician_schedule",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#get_technician_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_crew_candidates(id, opts = {}) ⇒ ListCrewCandidates200Response

Matching crew candidates for a job Technicians who can actually take this job, matched and ranked by the smart-assignment engine — skills per crew slot, weekly availability, existing schedule, time off and travel are all checked; each candidate carries a score breakdown (distance, travel, matched skills) plus the exact on-site session plan they would work. NOT a raw roster list (use GET /technicians for that). Returns the ranked feasible LEAD pool by default; pass include_buddies=true to also return per-slot buddy pools, include_vehicle=true to include the available-vehicle list. force_lead_id checks one specific technician: returns only that lead (with their crew combo) if feasible, else 409 JOB_REQUEST_NO_TECHNICIAN_AVAILABLE.

Parameters:

  • id (String)

    Job request ID or short_code

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :include_buddies (Boolean)

    Also return buddy candidate pools

  • :include_vehicle (Boolean)

    Also return the available-vehicle list

  • :force_lead_id (String)

    Check a specific technician as lead — returns only that lead if feasible, else 409

Returns:



524
525
526
527
# File 'lib/crisphive/api/job_request_business_api.rb', line 524

def list_crew_candidates(id, opts = {})
  data, _status_code, _headers = list_crew_candidates_with_http_info(id, opts)
  data
end

#list_crew_candidates_with_http_info(id, opts = {}) ⇒ Array<(ListCrewCandidates200Response, Integer, Hash)>

Matching crew candidates for a job Technicians who can actually take this job, matched and ranked by the smart-assignment engine — skills per crew slot, weekly availability, existing schedule, time off and travel are all checked; each candidate carries a score breakdown (distance, travel, matched skills) plus the exact on-site session plan they would work. NOT a raw roster list (use GET /technicians for that). Returns the ranked feasible LEAD pool by default; pass include_buddies=true to also return per-slot buddy pools, include_vehicle=true to include the available-vehicle list. force_lead_id checks one specific technician: returns only that lead (with their crew combo) if feasible, else 409 JOB_REQUEST_NO_TECHNICIAN_AVAILABLE.

Parameters:

  • id (String)

    Job request ID or short_code

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :include_buddies (Boolean)

    Also return buddy candidate pools

  • :include_vehicle (Boolean)

    Also return the available-vehicle list

  • :force_lead_id (String)

    Check a specific technician as lead — returns only that lead if feasible, else 409

Returns:



537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/crisphive/api/job_request_business_api.rb', line 537

def list_crew_candidates_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_crew_candidates ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.list_crew_candidates"
  end
  # resource path
  local_var_path = '/job-requests/{id}/crew-candidates'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_buddies'] = opts[:'include_buddies'] if !opts[:'include_buddies'].nil?
  query_params[:'include_vehicle'] = opts[:'include_vehicle'] if !opts[:'include_vehicle'].nil?
  query_params[:'force_lead_id'] = opts[:'force_lead_id'] if !opts[:'force_lead_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListCrewCandidates200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.list_crew_candidates",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_crew_candidates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_emergency_candidates(job_request_emergency_candidates_request, opts = {}) ⇒ ListEmergencyCandidates200Response

Rank technicians for a P0 emergency insert Returns the technicians who could take the emergency job at the requested start, ranked FASTEST-ARRIVAL first (arrival beats route efficiency for a P0). The response also carries a historical crew_recommendation (median crew size on comparable completed jobs + mandatory disclaimer — AC-2). Booked technicians are still candidates — each entry carries the displacement preview (which lower-priority jobs would be pushed, per day) that committing to them would cause; total_moves=0 means a free slot. P0 jobs are never displaced; P1 only by a P0. ETA is estimated from the technician's start location (no live GPS). Feed the chosen technician_id into emergency/preview + emergency/commit. 409 NEXT STEPS: EMERGENCY_RESCHEDULE_NOT_ELIGIBLE — the job cannot be emergency-inserted (not P0, already started/completed/archived, or not quoted): fix the job state or use a normal confirm. EMERGENCY_RESCHEDULE_CREW_UNSUPPORTED — crew jobs cannot use the emergency flow (v1): staff via confirm/reassign instead. EMERGENCY_RESCHEDULE_MULTIDAY_UNSUPPORTED — a confirmed multi-day job cannot be re-inserted (v1): use the normal reassign flow. EMERGENCY_RESCHEDULE_NO_WORKING_DAY — the chosen date has no working hours: pick a working day. EMERGENCY_RESCHEDULE_IN_PAST — start time already passed: pick a future time.

Parameters:

Returns:



593
594
595
596
# File 'lib/crisphive/api/job_request_business_api.rb', line 593

def list_emergency_candidates(job_request_emergency_candidates_request, opts = {})
  data, _status_code, _headers = list_emergency_candidates_with_http_info(job_request_emergency_candidates_request, opts)
  data
end

#list_emergency_candidates_with_http_info(job_request_emergency_candidates_request, opts = {}) ⇒ Array<(ListEmergencyCandidates200Response, Integer, Hash)>

Rank technicians for a P0 emergency insert Returns the technicians who could take the emergency job at the requested start, ranked FASTEST-ARRIVAL first (arrival beats route efficiency for a P0). The response also carries a historical `crew_recommendation` (median crew size on comparable completed jobs + mandatory disclaimer — AC-2). Booked technicians are still candidates — each entry carries the displacement preview (which lower-priority jobs would be pushed, per day) that committing to them would cause; total_moves=0 means a free slot. P0 jobs are never displaced; P1 only by a P0. ETA is estimated from the technician's start location (no live GPS). Feed the chosen technician_id into emergency/preview + emergency/commit. 409 NEXT STEPS: EMERGENCY_RESCHEDULE_NOT_ELIGIBLE — the job cannot be emergency-inserted (not P0, already started/completed/archived, or not quoted): fix the job state or use a normal confirm. EMERGENCY_RESCHEDULE_CREW_UNSUPPORTED — crew jobs cannot use the emergency flow (v1): staff via confirm/reassign instead. EMERGENCY_RESCHEDULE_MULTIDAY_UNSUPPORTED — a confirmed multi-day job cannot be re-inserted (v1): use the normal reassign flow. EMERGENCY_RESCHEDULE_NO_WORKING_DAY — the chosen date has no working hours: pick a working day. EMERGENCY_RESCHEDULE_IN_PAST — start time already passed: pick a future time.

Parameters:

Returns:



603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
# File 'lib/crisphive/api/job_request_business_api.rb', line 603

def list_emergency_candidates_with_http_info(job_request_emergency_candidates_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_emergency_candidates ...'
  end
  # verify the required parameter 'job_request_emergency_candidates_request' is set
  if @api_client.config.client_side_validation && job_request_emergency_candidates_request.nil?
    fail ArgumentError, "Missing the required parameter 'job_request_emergency_candidates_request' when calling JobRequestBusinessApi.list_emergency_candidates"
  end
  # resource path
  local_var_path = '/job-requests/emergency/candidates'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_emergency_candidates_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ListEmergencyCandidates200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.list_emergency_candidates",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_emergency_candidates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_job_request_booking_windows(x_timezone, opts = {}) ⇒ ListJobRequestBookingWindows200Response

Booking availability Real-time appointment availability from the scheduling engine: returns the bookable date + time-period windows given technician capacity, working hours and service-territory coverage. Call this before creating a job request and offer the customer ONLY the returned windows — it prevents unschedulable bookings.

Parameters:

  • x_timezone (String)

    Customer IANA timezone

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from (String)

    Start YYYY-MM-DD

  • :to (String)

    End YYYY-MM-DD

Returns:



663
664
665
666
# File 'lib/crisphive/api/job_request_business_api.rb', line 663

def list_job_request_booking_windows(x_timezone, opts = {})
  data, _status_code, _headers = list_job_request_booking_windows_with_http_info(x_timezone, opts)
  data
end

#list_job_request_booking_windows_with_http_info(x_timezone, opts = {}) ⇒ Array<(ListJobRequestBookingWindows200Response, Integer, Hash)>

Booking availability Real-time appointment availability from the scheduling engine: returns the bookable date + time-period windows given technician capacity, working hours and service-territory coverage. Call this before creating a job request and offer the customer ONLY the returned windows — it prevents unschedulable bookings.

Parameters:

  • x_timezone (String)

    Customer IANA timezone

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from (String)

    Start YYYY-MM-DD

  • :to (String)

    End YYYY-MM-DD

Returns:



675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
# File 'lib/crisphive/api/job_request_business_api.rb', line 675

def list_job_request_booking_windows_with_http_info(x_timezone, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_job_request_booking_windows ...'
  end
  # verify the required parameter 'x_timezone' is set
  if @api_client.config.client_side_validation && x_timezone.nil?
    fail ArgumentError, "Missing the required parameter 'x_timezone' when calling JobRequestBusinessApi.list_job_request_booking_windows"
  end
  # resource path
  local_var_path = '/job-requests/booking-windows'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Timezone'] = x_timezone

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListJobRequestBookingWindows200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.list_job_request_booking_windows",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_job_request_booking_windows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_job_request_changes(opts = {}) ⇒ ListJobRequestChanges200Response

Poll for new & changed job requests (sync feed) Keep an external system (your CRM, ERP or field-service tool) in sync with bookings WITHOUT re-listing everything: returns the job requests (work orders) whose state changed (created, status transition, reschedule, soft-delete/archive) at or after the since cursor, ordered oldest-change-first (updated_at ASC). How to use it: (1) On your first poll OMIT since — the server primes the cursor at "now", returns no items and a next_since. (2) Store next_since and pass it as since on the next poll. (3) Apply each returned item to your store by UPSERTING on id (the server re-scans a ~5s safety window, so the same job may appear again — never blindly append). (4) If has_more is true the page filled to limit and more changes are already waiting — poll again immediately; otherwise wait your normal interval (e.g. 5–15s). This is NOT pagination — it is a time-keyed change feed. Use the paginated GET /job-requests for the initial bulk load, then this endpoint to stay live. Filters (status_keys, customer_id, …) narrow the feed to the slice you care about.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status_keys (String)

    Comma-separated status slugs — only surface changes to jobs in these statuses

  • :priority (String)

    Priority filter (p0|p1|p2|p3)

  • :customer_id (String)

    Only changes to this customer's jobs (UUID)

  • :technician_id (String)

    Only changes to jobs assigned to this technician (UUID)

  • :scheduled_from (String)

    Filter from (YYYY-MM-DD = start of that day in the business timezone, or RFC3339); range is [from, to)

  • :scheduled_to (String)

    Filter to (YYYY-MM-DD = end of that day in the business timezone, or RFC3339), exclusive

  • :since (String)

    RFC3339 cursor from the prior response's next_since. OMIT on the first poll to prime the cursor at server-now.

  • :limit (Integer)

    Max changes per poll (default 15, max 1000). If the page fills, has_more=true.

Returns:



738
739
740
741
# File 'lib/crisphive/api/job_request_business_api.rb', line 738

def list_job_request_changes(opts = {})
  data, _status_code, _headers = list_job_request_changes_with_http_info(opts)
  data
end

#list_job_request_changes_with_http_info(opts = {}) ⇒ Array<(ListJobRequestChanges200Response, Integer, Hash)>

Poll for new & changed job requests (sync feed) Keep an external system (your CRM, ERP or field-service tool) in sync with bookings WITHOUT re-listing everything: returns the job requests (work orders) whose state changed (created, status transition, reschedule, soft-delete/archive) at or after the `since` cursor, ordered oldest-change-first (updated_at ASC). How to use it: (1) On your first poll OMIT `since` — the server primes the cursor at &quot;now&quot;, returns no items and a `next_since`. (2) Store `next_since` and pass it as `since` on the next poll. (3) Apply each returned item to your store by UPSERTING on `id` (the server re-scans a ~5s safety window, so the same job may appear again — never blindly append). (4) If `has_more` is true the page filled to `limit` and more changes are already waiting — poll again immediately; otherwise wait your normal interval (e.g. 5–15s). This is NOT pagination — it is a time-keyed change feed. Use the paginated GET /job-requests for the initial bulk load, then this endpoint to stay live. Filters (status_keys, customer_id, …) narrow the feed to the slice you care about.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status_keys (String)

    Comma-separated status slugs — only surface changes to jobs in these statuses

  • :priority (String)

    Priority filter (p0|p1|p2|p3)

  • :customer_id (String)

    Only changes to this customer's jobs (UUID)

  • :technician_id (String)

    Only changes to jobs assigned to this technician (UUID)

  • :scheduled_from (String)

    Filter from (YYYY-MM-DD = start of that day in the business timezone, or RFC3339); range is [from, to)

  • :scheduled_to (String)

    Filter to (YYYY-MM-DD = end of that day in the business timezone, or RFC3339), exclusive

  • :since (String)

    RFC3339 cursor from the prior response's next_since. OMIT on the first poll to prime the cursor at server-now.

  • :limit (Integer)

    Max changes per poll (default 15, max 1000). If the page fills, has_more=true.

Returns:



755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
# File 'lib/crisphive/api/job_request_business_api.rb', line 755

def list_job_request_changes_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_job_request_changes ...'
  end
  # resource path
  local_var_path = '/job-requests/changes'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status_keys'] = opts[:'status_keys'] if !opts[:'status_keys'].nil?
  query_params[:'priority'] = opts[:'priority'] if !opts[:'priority'].nil?
  query_params[:'customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?
  query_params[:'technician_id'] = opts[:'technician_id'] if !opts[:'technician_id'].nil?
  query_params[:'scheduled_from'] = opts[:'scheduled_from'] if !opts[:'scheduled_from'].nil?
  query_params[:'scheduled_to'] = opts[:'scheduled_to'] if !opts[:'scheduled_to'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListJobRequestChanges200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.list_job_request_changes",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_job_request_changes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_job_requests(opts = {}) ⇒ ListJobRequests200Response

List job requests Paginated list of the business's bookings (work orders) with dispatch-oriented filters: workflow status, customer, assigned technician, scheduled date range and free-text search over code/description. This is also the SCHEDULE query: combine technician_id + scheduled_from/scheduled_to to read one technician's agenda for a day or week (e.g. "what is Alex doing tomorrow"), or just the date range for the whole team's calendar.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status_keys (String)

    Comma-separated status slugs

  • :status (String)

    active (default) | archived | all

  • :priority (String)

    Priority filter (p0|p1|p2|p3)

  • :customer_id (String)

    Customer UUID

  • :technician_id (String)

    Technician UUID

  • :service_area_id (String)

    Service-area UUID (board zone filter)

  • :scheduled_from (String)

    Filter from (YYYY-MM-DD = start of that day in the business timezone, or RFC3339); range is [from, to)

  • :scheduled_to (String)

    Filter to (YYYY-MM-DD = end of that day in the business timezone, or RFC3339), exclusive

  • :q (String)

    Search short_code or description (case-insensitive, partial match)

  • :sort (String)

    Sort key: created_at:desc (default) | created_at:asc | scheduled_at:asc | scheduled_at:desc | priority:asc (P0 first) | priority:desc

  • :page (Integer)

    Page number

  • :limit (Integer)

    Page size

Returns:



823
824
825
826
# File 'lib/crisphive/api/job_request_business_api.rb', line 823

def list_job_requests(opts = {})
  data, _status_code, _headers = list_job_requests_with_http_info(opts)
  data
end

#list_job_requests_with_http_info(opts = {}) ⇒ Array<(ListJobRequests200Response, Integer, Hash)>

List job requests Paginated list of the business's bookings (work orders) with dispatch-oriented filters: workflow status, customer, assigned technician, scheduled date range and free-text search over code/description. This is also the SCHEDULE query: combine technician_id + scheduled_from/scheduled_to to read one technician's agenda for a day or week (e.g. &quot;what is Alex doing tomorrow&quot;), or just the date range for the whole team's calendar.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status_keys (String)

    Comma-separated status slugs

  • :status (String)

    active (default) | archived | all

  • :priority (String)

    Priority filter (p0|p1|p2|p3)

  • :customer_id (String)

    Customer UUID

  • :technician_id (String)

    Technician UUID

  • :service_area_id (String)

    Service-area UUID (board zone filter)

  • :scheduled_from (String)

    Filter from (YYYY-MM-DD = start of that day in the business timezone, or RFC3339); range is [from, to)

  • :scheduled_to (String)

    Filter to (YYYY-MM-DD = end of that day in the business timezone, or RFC3339), exclusive

  • :q (String)

    Search short_code or description (case-insensitive, partial match)

  • :sort (String)

    Sort key: created_at:desc (default) | created_at:asc | scheduled_at:asc | scheduled_at:desc | priority:asc (P0 first) | priority:desc

  • :page (Integer)

    Page number

  • :limit (Integer)

    Page size

Returns:

  • (Array<(ListJobRequests200Response, Integer, Hash)>)

    ListJobRequests200Response data, response status code and response headers



844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
# File 'lib/crisphive/api/job_request_business_api.rb', line 844

def list_job_requests_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_job_requests ...'
  end
  # resource path
  local_var_path = '/job-requests'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status_keys'] = opts[:'status_keys'] if !opts[:'status_keys'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'priority'] = opts[:'priority'] if !opts[:'priority'].nil?
  query_params[:'customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?
  query_params[:'technician_id'] = opts[:'technician_id'] if !opts[:'technician_id'].nil?
  query_params[:'service_area_id'] = opts[:'service_area_id'] if !opts[:'service_area_id'].nil?
  query_params[:'scheduled_from'] = opts[:'scheduled_from'] if !opts[:'scheduled_from'].nil?
  query_params[:'scheduled_to'] = opts[:'scheduled_to'] if !opts[:'scheduled_to'].nil?
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListJobRequests200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.list_job_requests",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_job_requests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_matching_slots(id, opts = {}) ⇒ ListMatchingSlots200Response

Matching time slots for a quoted job Bookable arrival-window slots for a quoted job, computed by the smart-assignment matching engine: each slot lists the technicians actually available to start then (skills, weekly availability, existing schedule, time off and travel all checked), with a per-technician match score. Use it to find and offer appointment times an agent or integration can then confirm (POST /job-requests/id/confirm with the slot's business_time.datetime). Same grid the end-customer's slot picker shows; slot width defaults to the business's arrival window — override via ?step_minutes (5–240). The job must be quoted first (the quote sets the visit duration the matcher schedules).

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :step_minutes (Integer)

    Slot step in minutes (default: business arrival window, 5–240)

Returns:



906
907
908
909
# File 'lib/crisphive/api/job_request_business_api.rb', line 906

def list_matching_slots(id, opts = {})
  data, _status_code, _headers = list_matching_slots_with_http_info(id, opts)
  data
end

#list_matching_slots_with_http_info(id, opts = {}) ⇒ Array<(ListMatchingSlots200Response, Integer, Hash)>

Matching time slots for a quoted job Bookable arrival-window slots for a quoted job, computed by the smart-assignment matching engine: each slot lists the technicians actually available to start then (skills, weekly availability, existing schedule, time off and travel all checked), with a per-technician match score. Use it to find and offer appointment times an agent or integration can then confirm (POST /job-requests/id/confirm with the slot's business_time.datetime). Same grid the end-customer's slot picker shows; slot width defaults to the business's arrival window — override via ?step_minutes (5–240). The job must be quoted first (the quote sets the visit duration the matcher schedules).

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :step_minutes (Integer)

    Slot step in minutes (default: business arrival window, 5–240)

Returns:



917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
# File 'lib/crisphive/api/job_request_business_api.rb', line 917

def list_matching_slots_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_matching_slots ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.list_matching_slots"
  end
  # resource path
  local_var_path = '/job-requests/{id}/time-segments'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'step_minutes'] = opts[:'step_minutes'] if !opts[:'step_minutes'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListMatchingSlots200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.list_matching_slots",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_matching_slots\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_nearby_technicians(lat, lng, opts = {}) ⇒ ListNearbyTechnicians200Response

Find nearby feasible technicians (job-less location query) Ranks who could serve a hypothetical visit at (lat,lng) starting at for duration_minutes — the engine applies the REAL hard filters (weekly hours, existing schedule, approved time-off, geographic service areas, optional skill floor) and returns candidates nearest-arrival first. ETA origin is each technician's start location (no live GPS). Use before creating a booking to propose realistic arrivals.

Parameters:

  • lat (Float)

    Latitude of the service location

  • lng (Float)

    Longitude of the service location

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :at (String)

    Visit start (RFC3339, e.g. 2026-07-20T14:00:00Z; default now)

  • :duration_minutes (Integer)

    Visit length in minutes (default 60; 15–480)

  • :skill_ids (String)

    Comma-separated skill UUIDs to require/match

  • :limit (Integer)

    Max candidates (default 10, max 20)

Returns:



976
977
978
979
# File 'lib/crisphive/api/job_request_business_api.rb', line 976

def list_nearby_technicians(lat, lng, opts = {})
  data, _status_code, _headers = list_nearby_technicians_with_http_info(lat, lng, opts)
  data
end

#list_nearby_technicians_with_http_info(lat, lng, opts = {}) ⇒ Array<(ListNearbyTechnicians200Response, Integer, Hash)>

Find nearby feasible technicians (job-less location query) Ranks who could serve a hypothetical visit at (lat,lng) starting `at` for `duration_minutes` — the engine applies the REAL hard filters (weekly hours, existing schedule, approved time-off, geographic service areas, optional skill floor) and returns candidates nearest-arrival first. ETA origin is each technician's start location (no live GPS). Use before creating a booking to propose realistic arrivals.

Parameters:

  • lat (Float)

    Latitude of the service location

  • lng (Float)

    Longitude of the service location

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :at (String)

    Visit start (RFC3339, e.g. 2026-07-20T14:00:00Z; default now)

  • :duration_minutes (Integer)

    Visit length in minutes (default 60; 15–480)

  • :skill_ids (String)

    Comma-separated skill UUIDs to require/match

  • :limit (Integer)

    Max candidates (default 10, max 20)

Returns:



991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
# File 'lib/crisphive/api/job_request_business_api.rb', line 991

def list_nearby_technicians_with_http_info(lat, lng, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.list_nearby_technicians ...'
  end
  # verify the required parameter 'lat' is set
  if @api_client.config.client_side_validation && lat.nil?
    fail ArgumentError, "Missing the required parameter 'lat' when calling JobRequestBusinessApi.list_nearby_technicians"
  end
  # verify the required parameter 'lng' is set
  if @api_client.config.client_side_validation && lng.nil?
    fail ArgumentError, "Missing the required parameter 'lng' when calling JobRequestBusinessApi.list_nearby_technicians"
  end
  # resource path
  local_var_path = '/technicians/nearby'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'lat'] = lat
  query_params[:'lng'] = lng
  query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?
  query_params[:'duration_minutes'] = opts[:'duration_minutes'] if !opts[:'duration_minutes'].nil?
  query_params[:'skill_ids'] = opts[:'skill_ids'] if !opts[:'skill_ids'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListNearbyTechnicians200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.list_nearby_technicians",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#list_nearby_technicians\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#preview_emergency_reschedule(job_request_emergency_preview_request, opts = {}) ⇒ CommitEmergencyReschedule200Response

Preview emergency insert + cascade reschedule Computes (WITHOUT writing) the cascade of inserting an emergency job onto a technician at a chosen time: where the emergency lands + every job pushed back, grouped per business-local day. displacement_mode=reassign instead hands each displaced job to another feasible technician at its ORIGINAL window (same-day promise) — jobs with no alternate capacity fall back to reschedule and stay in days. mode=overtime keeps everyone same-day (tech works late); mode=next_day rolls overflow to the next working day(s). Read-only — safe to call repeatedly; commit is a separate endpoint. Isolated feature (see EMERGENCY_RESCHEDULE_DESIGN.md). 409 NEXT STEPS: EMERGENCY_RESCHEDULE_SLOT_OCCUPIED — the landing window is blocked by a job the cascade may NOT move (another P0, a crew or multi-day job): choose another technician (walk the /candidates ranking) or another time; displacement never touches P0/crew/multi-day anchors. EMERGENCY_RESCHEDULE_NOT_ELIGIBLE / CREW_UNSUPPORTED / MULTIDAY_UNSUPPORTED / NO_WORKING_DAY / IN_PAST — same remedies as /candidates.

Parameters:

Returns:



1054
1055
1056
1057
# File 'lib/crisphive/api/job_request_business_api.rb', line 1054

def preview_emergency_reschedule(job_request_emergency_preview_request, opts = {})
  data, _status_code, _headers = preview_emergency_reschedule_with_http_info(job_request_emergency_preview_request, opts)
  data
end

#preview_emergency_reschedule_with_http_info(job_request_emergency_preview_request, opts = {}) ⇒ Array<(CommitEmergencyReschedule200Response, Integer, Hash)>

Preview emergency insert + cascade reschedule Computes (WITHOUT writing) the cascade of inserting an emergency job onto a technician at a chosen time: where the emergency lands + every job pushed back, grouped per business-local day. `displacement_mode=reassign` instead hands each displaced job to another feasible technician at its ORIGINAL window (same-day promise) — jobs with no alternate capacity fall back to reschedule and stay in `days`. `mode=overtime` keeps everyone same-day (tech works late); `mode=next_day` rolls overflow to the next working day(s). Read-only — safe to call repeatedly; commit is a separate endpoint. Isolated feature (see EMERGENCY_RESCHEDULE_DESIGN.md). 409 NEXT STEPS: EMERGENCY_RESCHEDULE_SLOT_OCCUPIED — the landing window is blocked by a job the cascade may NOT move (another P0, a crew or multi-day job): choose another technician (walk the /candidates ranking) or another time; displacement never touches P0/crew/multi-day anchors. EMERGENCY_RESCHEDULE_NOT_ELIGIBLE / CREW_UNSUPPORTED / MULTIDAY_UNSUPPORTED / NO_WORKING_DAY / IN_PAST — same remedies as /candidates.

Parameters:

Returns:



1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
# File 'lib/crisphive/api/job_request_business_api.rb', line 1064

def preview_emergency_reschedule_with_http_info(job_request_emergency_preview_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.preview_emergency_reschedule ...'
  end
  # verify the required parameter 'job_request_emergency_preview_request' is set
  if @api_client.config.client_side_validation && job_request_emergency_preview_request.nil?
    fail ArgumentError, "Missing the required parameter 'job_request_emergency_preview_request' when calling JobRequestBusinessApi.preview_emergency_reschedule"
  end
  # resource path
  local_var_path = '/job-requests/emergency/preview'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_emergency_preview_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CommitEmergencyReschedule200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.preview_emergency_reschedule",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#preview_emergency_reschedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#preview_job_request_move(id, job_request_move_preview_req, opts = {}) ⇒ CommitJobRequestMove200Response

Preview a schedule-board job move Computes (WITHOUT writing) the outcome of moving a confirmed job to a new time and/or technician: where it lands, every later job pushed back per mode, and the warnings the coordinator would accept (displaced jobs leaving their confirmed windows, overtime). Same technician = pure time move; different technician = manual reassign. Read-only — safe to call repeatedly while dragging; commit is a separate endpoint. See SCHEDULE_BOARD_DESIGN.md. Warning detail: a TECH_NOT_FEASIBLE warning carries reason = cannot_arrive_in_time (commute from the tech day-start location / shift start; earliest_feasible_at (RFC3339 UTC) is the first same-day time they CAN be on site — suggest it as the drop slot) | missing_required_skills | not_available_today (no working hours, approved time off, or outside the service area) | not_lead_tier. For a P0 move this warning is advisory (coordinator may commit anyway); for p1/p2/p3 the same condition is the hard 409 SCHEDULE_MOVE_TECH_INFEASIBLE. 409 NEXT STEPS: SCHEDULE_MOVE_NOT_ELIGIBLE (job unconfirmed/unquoted/archived/completed — not movable) · SCHEDULE_MOVE_IN_PROGRESS (tech already executing — do not move) · SCHEDULE_MOVE_IN_PAST (pick a future time) · SCHEDULE_MOVE_OUTSIDE_WINDOW (landing time outside the customer-confirmed window — hard block; pick a time inside it) · SCHEDULE_MOVE_SLOT_OCCUPIED (landing window blocked by an immovable anchor — another tech/time) · SCHEDULE_MOVE_TECH_INFEASIBLE (non-P0 hard block: target tech not qualified/available — see the TECH_NOT_FEASIBLE warning reasons; change tech or time) · SCHEDULE_MOVE_MULTIDAY_UNSUPPORTED (multi-day jobs not movable v1) · SCHEDULE_MOVE_NO_WORKING_DAY (pick a working day) · SCHEDULE_MOVE_REQUIRES_FREE_SLOT (non-P0 moves may not displace — free capacity only, unless the owner enables allow_non_p0_displacement) · SCHEDULE_MOVE_CREW_UNSTAFFABLE (a crew slot has no feasible replacement at the new time — another time).

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • job_request_move_preview_req (JobRequestMovePreviewReq)

    move spec

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1123
1124
1125
1126
# File 'lib/crisphive/api/job_request_business_api.rb', line 1123

def preview_job_request_move(id, job_request_move_preview_req, opts = {})
  data, _status_code, _headers = preview_job_request_move_with_http_info(id, job_request_move_preview_req, opts)
  data
end

#preview_job_request_move_with_http_info(id, job_request_move_preview_req, opts = {}) ⇒ Array<(CommitJobRequestMove200Response, Integer, Hash)>

Preview a schedule-board job move Computes (WITHOUT writing) the outcome of moving a confirmed job to a new time and/or technician: where it lands, every later job pushed back per `mode`, and the warnings the coordinator would accept (displaced jobs leaving their confirmed windows, overtime). Same technician = pure time move; different technician = manual reassign. Read-only — safe to call repeatedly while dragging; commit is a separate endpoint. See SCHEDULE_BOARD_DESIGN.md. Warning detail: a TECH_NOT_FEASIBLE warning carries `reason` = `cannot_arrive_in_time` (commute from the tech day-start location / shift start; `earliest_feasible_at` (RFC3339 UTC) is the first same-day time they CAN be on site — suggest it as the drop slot) | `missing_required_skills` | `not_available_today` (no working hours, approved time off, or outside the service area) | `not_lead_tier`. For a P0 move this warning is advisory (coordinator may commit anyway); for p1/p2/p3 the same condition is the hard 409 SCHEDULE_MOVE_TECH_INFEASIBLE. 409 NEXT STEPS: SCHEDULE_MOVE_NOT_ELIGIBLE (job unconfirmed/unquoted/archived/completed — not movable) · SCHEDULE_MOVE_IN_PROGRESS (tech already executing — do not move) · SCHEDULE_MOVE_IN_PAST (pick a future time) · SCHEDULE_MOVE_OUTSIDE_WINDOW (landing time outside the customer-confirmed window — hard block; pick a time inside it) · SCHEDULE_MOVE_SLOT_OCCUPIED (landing window blocked by an immovable anchor — another tech/time) · SCHEDULE_MOVE_TECH_INFEASIBLE (non-P0 hard block: target tech not qualified/available — see the TECH_NOT_FEASIBLE warning reasons; change tech or time) · SCHEDULE_MOVE_MULTIDAY_UNSUPPORTED (multi-day jobs not movable v1) · SCHEDULE_MOVE_NO_WORKING_DAY (pick a working day) · SCHEDULE_MOVE_REQUIRES_FREE_SLOT (non-P0 moves may not displace — free capacity only, unless the owner enables allow_non_p0_displacement) · SCHEDULE_MOVE_CREW_UNSTAFFABLE (a crew slot has no feasible replacement at the new time — another time).

Parameters:

  • id (String)

    Job request ID (UUID or short_code)

  • job_request_move_preview_req (JobRequestMovePreviewReq)

    move spec

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
# File 'lib/crisphive/api/job_request_business_api.rb', line 1134

def preview_job_request_move_with_http_info(id, job_request_move_preview_req, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.preview_job_request_move ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.preview_job_request_move"
  end
  # verify the required parameter 'job_request_move_preview_req' is set
  if @api_client.config.client_side_validation && job_request_move_preview_req.nil?
    fail ArgumentError, "Missing the required parameter 'job_request_move_preview_req' when calling JobRequestBusinessApi.preview_job_request_move"
  end
  # resource path
  local_var_path = '/job-requests/{id}/move/preview'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_move_preview_req)

  # return_type
  return_type = opts[:debug_return_type] || 'CommitJobRequestMove200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.preview_job_request_move",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#preview_job_request_move\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#quote_job_request(id, job_request_quote_request, opts = {}) ⇒ ResponseEnvelope

Fire quote (FIXED action — business) Sends the quote: sets quoted_at + duration cols, advances pending_action to confirm_booking. Status stays booking.

Parameters:

  • id (String)

    Job request ID

  • job_request_quote_request (JobRequestQuoteRequest)

    Quote payload

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1197
1198
1199
1200
# File 'lib/crisphive/api/job_request_business_api.rb', line 1197

def quote_job_request(id, job_request_quote_request, opts = {})
  data, _status_code, _headers = quote_job_request_with_http_info(id, job_request_quote_request, opts)
  data
end

#quote_job_request_with_http_info(id, job_request_quote_request, opts = {}) ⇒ Array<(ResponseEnvelope, Integer, Hash)>

Fire quote (FIXED action — business) Sends the quote: sets quoted_at + duration cols, advances pending_action to confirm_booking. Status stays `booking`.

Parameters:

  • id (String)

    Job request ID

  • job_request_quote_request (JobRequestQuoteRequest)

    Quote payload

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ResponseEnvelope, Integer, Hash)>)

    ResponseEnvelope data, response status code and response headers



1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
# File 'lib/crisphive/api/job_request_business_api.rb', line 1208

def quote_job_request_with_http_info(id, job_request_quote_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.quote_job_request ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.quote_job_request"
  end
  # verify the required parameter 'job_request_quote_request' is set
  if @api_client.config.client_side_validation && job_request_quote_request.nil?
    fail ArgumentError, "Missing the required parameter 'job_request_quote_request' when calling JobRequestBusinessApi.quote_job_request"
  end
  # resource path
  local_var_path = '/job-requests/{id}/quote'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_quote_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ResponseEnvelope'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.quote_job_request",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#quote_job_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_job_priority(id, job_request_update_priority_request, opts = {}) ⇒ ResponseEnvelope

Set job priority (scheduling staff) Sets the P0–P3 priority on a non-archived, non-completed job (Owner / Administrator / Booking Coordinator). Allowed values: "p0" (emergency, interrupt-driven) | "p1" (top — displaced only by p0; may carry an sla_deadline arming auto-escalation) | "p2" (standard) | "p3" (deferrable, first displacement victim). sla_deadline is only valid with p1 and must be in the future (business-local naive datetime); moving away from p1 disarms the SLA clock. Accepts UUID or short_code in :id.

Parameters:

  • id (String)

    Job request ID or short_code

  • job_request_update_priority_request (JobRequestUpdatePriorityRequest)

    Priority payload

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1271
1272
1273
1274
# File 'lib/crisphive/api/job_request_business_api.rb', line 1271

def update_job_priority(id, job_request_update_priority_request, opts = {})
  data, _status_code, _headers = update_job_priority_with_http_info(id, job_request_update_priority_request, opts)
  data
end

#update_job_priority_with_http_info(id, job_request_update_priority_request, opts = {}) ⇒ Array<(ResponseEnvelope, Integer, Hash)>

Set job priority (scheduling staff) Sets the P0–P3 priority on a non-archived, non-completed job (Owner / Administrator / Booking Coordinator). Allowed values: &quot;p0&quot; (emergency, interrupt-driven) | &quot;p1&quot; (top — displaced only by p0; may carry an sla_deadline arming auto-escalation) | &quot;p2&quot; (standard) | &quot;p3&quot; (deferrable, first displacement victim). sla_deadline is only valid with p1 and must be in the future (business-local naive datetime); moving away from p1 disarms the SLA clock. Accepts UUID or short_code in :id.

Parameters:

  • id (String)

    Job request ID or short_code

  • job_request_update_priority_request (JobRequestUpdatePriorityRequest)

    Priority payload

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ResponseEnvelope, Integer, Hash)>)

    ResponseEnvelope data, response status code and response headers



1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
# File 'lib/crisphive/api/job_request_business_api.rb', line 1282

def update_job_priority_with_http_info(id, job_request_update_priority_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: JobRequestBusinessApi.update_job_priority ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling JobRequestBusinessApi.update_job_priority"
  end
  # verify the required parameter 'job_request_update_priority_request' is set
  if @api_client.config.client_side_validation && job_request_update_priority_request.nil?
    fail ArgumentError, "Missing the required parameter 'job_request_update_priority_request' when calling JobRequestBusinessApi.update_job_priority"
  end
  # resource path
  local_var_path = '/job-requests/{id}/priority'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(job_request_update_priority_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ResponseEnvelope'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"JobRequestBusinessApi.update_job_priority",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: JobRequestBusinessApi#update_job_priority\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end