Class: Crisphive::TechnicianApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TechnicianApi

Returns a new instance of TechnicianApi.



19
20
21
# File 'lib/crisphive/api/technician_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/technician_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_technician(technician_create_request, opts = {}) ⇒ CreateTechnician200Response

Add a technician Creates a technician membership under the current business. If the phone/email matches an existing user, their account is linked. Otherwise a new user identity is created (no invite email — login is passwordless later). Either way the membership starts active. If the technician was previously removed (deactive) they are reactivated instead. Owner/Administrator groups cannot be assigned via API key, and not at all in sandbox mode. Optional relations (all validated; any missing id → 404 TECHNICIAN_NOT_FOUND with missing_ids): buddy_ids sets this technician's buddy list (use when creating a lead); lead_ids adds this technician as a buddy of each named lead (use when creating a buddy — the buddy-side way to attach the same lead↔buddy relation); service_area_ids assigns the technician to those service areas. start_location_type=office snapshots the business address + coordinates into the technician at create time; address, start_location_lat, start_location_long in the body are ignored. Requires the business to have coordinates set (else 400 BUSINESS_LOCATION_MISSING). start_location_type=home (or empty) uses the address + coordinates from the body.

Parameters:

  • technician_create_request (TechnicianCreateRequest)

    Technician details

  • 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:



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

def create_technician(technician_create_request, opts = {})
  data, _status_code, _headers = create_technician_with_http_info(technician_create_request, opts)
  data
end

#create_technician_with_http_info(technician_create_request, opts = {}) ⇒ Array<(CreateTechnician200Response, Integer, Hash)>

Add a technician Creates a technician membership under the current business. If the phone/email matches an existing user, their account is linked. Otherwise a new user identity is created (no invite email — login is passwordless later). Either way the membership starts active. If the technician was previously removed (deactive) they are reactivated instead. Owner/Administrator groups cannot be assigned via API key, and not at all in sandbox mode. Optional relations (all validated; any missing id → 404 TECHNICIAN_NOT_FOUND with `missing_ids`): `buddy_ids` sets this technician's buddy list (use when creating a lead); `lead_ids` adds this technician as a buddy of each named lead (use when creating a buddy — the buddy-side way to attach the same lead↔buddy relation); `service_area_ids` assigns the technician to those service areas. `start_location_type=office` snapshots the business address + coordinates into the technician at create time; `address`, `start_location_lat`, `start_location_long` in the body are ignored. Requires the business to have coordinates set (else 400 BUSINESS_LOCATION_MISSING). `start_location_type=home` (or empty) uses the address + coordinates from the body.

Parameters:

  • technician_create_request (TechnicianCreateRequest)

    Technician details

  • 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<(CreateTechnician200Response, Integer, Hash)>)

    CreateTechnician200Response data, response status code and response headers



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/technician_api.rb', line 39

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

  # 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(technician_create_request)

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

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

  new_options = opts.merge(
    :operation => :"TechnicianApi.create_technician",
    :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: TechnicianApi#create_technician\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_technician(id, opts = {}) ⇒ ResponseEnvelope

Remove a technician Soft-removes a technician from the business by setting status to deactive

Parameters:

  • id (String)

    Technician ID

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

    the optional parameters

Returns:



98
99
100
101
# File 'lib/crisphive/api/technician_api.rb', line 98

def delete_technician(id, opts = {})
  data, _status_code, _headers = delete_technician_with_http_info(id, opts)
  data
end

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

Remove a technician Soft-removes a technician from the business by setting status to deactive

Parameters:

  • id (String)

    Technician ID

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

    the optional parameters

Returns:

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

    ResponseEnvelope data, response status code and response headers



108
109
110
111
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
# File 'lib/crisphive/api/technician_api.rb', line 108

def delete_technician_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TechnicianApi.delete_technician ...'
  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 TechnicianApi.delete_technician"
  end
  # resource path
  local_var_path = '/technicians/{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] || 'ResponseEnvelope'

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

  new_options = opts.merge(
    :operation => :"TechnicianApi.delete_technician",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TechnicianApi#delete_technician\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_technician(id, opts = {}) ⇒ GetTechnician200Response

Get a technician Returns one technician's full profile: contact info, employment status, assignment tier, skills/qualifications, buddy (crew) relations and assigned vehicles — the dispatch-ready view of a field worker.

Parameters:

  • id (String)

    Technician ID

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

    the optional parameters

Returns:



161
162
163
164
# File 'lib/crisphive/api/technician_api.rb', line 161

def get_technician(id, opts = {})
  data, _status_code, _headers = get_technician_with_http_info(id, opts)
  data
end

#get_technician_with_http_info(id, opts = {}) ⇒ Array<(GetTechnician200Response, Integer, Hash)>

Get a technician Returns one technician's full profile: contact info, employment status, assignment tier, skills/qualifications, buddy (crew) relations and assigned vehicles — the dispatch-ready view of a field worker.

Parameters:

  • id (String)

    Technician ID

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

    the optional parameters

Returns:

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

    GetTechnician200Response data, response status code and response headers



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/crisphive/api/technician_api.rb', line 171

def get_technician_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TechnicianApi.get_technician ...'
  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 TechnicianApi.get_technician"
  end
  # resource path
  local_var_path = '/technicians/{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] || 'GetTechnician200Response'

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

  new_options = opts.merge(
    :operation => :"TechnicianApi.get_technician",
    :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: TechnicianApi#get_technician\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_technicians(opts = {}) ⇒ ListTechnicians200Response

List technicians Returns the field workforce roster: paginated technicians (field workers / engineers) with status, assignment tier (lead, buddy, float), skills and crew relations — the people the dispatch engine schedules onto jobs. Discover the preferred_technician_id accepted on customer records here. Supports the since cursor for incremental workforce sync.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (default 1)

  • :limit (Integer)

    Items per page (default 15, max 1000)

  • :status (String)

    Filter by status (active, onboarding, deactive)

  • :assignment_tier (String)

    Filter by assignment tier (lead, buddy, float)

  • :keyword (String)

    Search by full name, email, phone, or address

  • :sort (String)

    Sort: created_at_desc|created_at_asc|name_asc|name_desc (default: created_at_desc)

  • :since (String)

    RFC3339 cursor for short-polling; echo back next_since from prior response

Returns:



230
231
232
233
# File 'lib/crisphive/api/technician_api.rb', line 230

def list_technicians(opts = {})
  data, _status_code, _headers = list_technicians_with_http_info(opts)
  data
end

#list_technicians_with_http_info(opts = {}) ⇒ Array<(ListTechnicians200Response, Integer, Hash)>

List technicians Returns the field workforce roster: paginated technicians (field workers / engineers) with status, assignment tier (lead, buddy, float), skills and crew relations — the people the dispatch engine schedules onto jobs. Discover the `preferred_technician_id` accepted on customer records here. Supports the `since` cursor for incremental workforce sync.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (default 1)

  • :limit (Integer)

    Items per page (default 15, max 1000)

  • :status (String)

    Filter by status (active, onboarding, deactive)

  • :assignment_tier (String)

    Filter by assignment tier (lead, buddy, float)

  • :keyword (String)

    Search by full name, email, phone, or address

  • :sort (String)

    Sort: created_at_desc|created_at_asc|name_asc|name_desc (default: created_at_desc)

  • :since (String)

    RFC3339 cursor for short-polling; echo back next_since from prior response

Returns:

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

    ListTechnicians200Response data, response status code and response headers



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
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
# File 'lib/crisphive/api/technician_api.rb', line 246

def list_technicians_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TechnicianApi.list_technicians ...'
  end
  # resource path
  local_var_path = '/technicians'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'assignment_tier'] = opts[:'assignment_tier'] if !opts[:'assignment_tier'].nil?
  query_params[:'keyword'] = opts[:'keyword'] if !opts[:'keyword'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].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] || 'ListTechnicians200Response'

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

  new_options = opts.merge(
    :operation => :"TechnicianApi.list_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: TechnicianApi#list_technicians\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#replace_technician_buddies(id, technician_buddies_request, opts = {}) ⇒ ResponseEnvelope

Replace a technician's buddies Overwrites the technician's buddy list with the provided set of technician IDs. Sending an empty list clears all buddies. Each buddy ID must be an active technician of the same business; a technician cannot be their own buddy.

Parameters:

  • id (String)

    Technician ID

  • technician_buddies_request (TechnicianBuddiesRequest)

    Buddy IDs

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

    the optional parameters

Returns:



303
304
305
306
# File 'lib/crisphive/api/technician_api.rb', line 303

def replace_technician_buddies(id, technician_buddies_request, opts = {})
  data, _status_code, _headers = replace_technician_buddies_with_http_info(id, technician_buddies_request, opts)
  data
end

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

Replace a technician's buddies Overwrites the technician's buddy list with the provided set of technician IDs. Sending an empty list clears all buddies. Each buddy ID must be an active technician of the same business; a technician cannot be their own buddy.

Parameters:

  • id (String)

    Technician ID

  • technician_buddies_request (TechnicianBuddiesRequest)

    Buddy IDs

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

    the optional parameters

Returns:

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

    ResponseEnvelope data, response status code and response headers



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
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
# File 'lib/crisphive/api/technician_api.rb', line 314

def replace_technician_buddies_with_http_info(id, technician_buddies_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TechnicianApi.replace_technician_buddies ...'
  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 TechnicianApi.replace_technician_buddies"
  end
  # verify the required parameter 'technician_buddies_request' is set
  if @api_client.config.client_side_validation && technician_buddies_request.nil?
    fail ArgumentError, "Missing the required parameter 'technician_buddies_request' when calling TechnicianApi.replace_technician_buddies"
  end
  # resource path
  local_var_path = '/technicians/{id}/buddies'.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(technician_buddies_request)

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

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

  new_options = opts.merge(
    :operation => :"TechnicianApi.replace_technician_buddies",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TechnicianApi#replace_technician_buddies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#replace_technician_leads(id, technician_leads_request, opts = {}) ⇒ ResponseEnvelope

Replace a buddy's leaders (buddy side) Sets the full set of leads this buddy belongs to (many-to-many favorites). Replace-semantics — lead_ids is the complete new list; [] clears every leader. Managed by business staff.

Parameters:

  • id (String)

    Buddy technician ID

  • technician_leads_request (TechnicianLeadsRequest)

    Lead IDs payload

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

    the optional parameters

Returns:



377
378
379
380
# File 'lib/crisphive/api/technician_api.rb', line 377

def replace_technician_leads(id, technician_leads_request, opts = {})
  data, _status_code, _headers = replace_technician_leads_with_http_info(id, technician_leads_request, opts)
  data
end

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

Replace a buddy's leaders (buddy side) Sets the full set of leads this buddy belongs to (many-to-many favorites). Replace-semantics — lead_ids is the complete new list; [] clears every leader. Managed by business staff.

Parameters:

  • id (String)

    Buddy technician ID

  • technician_leads_request (TechnicianLeadsRequest)

    Lead IDs payload

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

    the optional parameters

Returns:

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

    ResponseEnvelope data, response status code and response headers



388
389
390
391
392
393
394
395
396
397
398
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
# File 'lib/crisphive/api/technician_api.rb', line 388

def replace_technician_leads_with_http_info(id, technician_leads_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TechnicianApi.replace_technician_leads ...'
  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 TechnicianApi.replace_technician_leads"
  end
  # verify the required parameter 'technician_leads_request' is set
  if @api_client.config.client_side_validation && technician_leads_request.nil?
    fail ArgumentError, "Missing the required parameter 'technician_leads_request' when calling TechnicianApi.replace_technician_leads"
  end
  # resource path
  local_var_path = '/technicians/{id}/leads'.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(technician_leads_request)

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

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

  new_options = opts.merge(
    :operation => :"TechnicianApi.replace_technician_leads",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TechnicianApi#replace_technician_leads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#replace_technician_service_areas(id, technician_service_areas_request, opts = {}) ⇒ ReplaceTechnicianServiceAreas200Response

Replace a technician's service areas Overwrites the technician's service-area assignments with the provided set of service area IDs. Sending an empty list clears all. Each service area ID must belong to the same business — any missing id → 404 SERVICE_AREA_NOT_FOUND with missing_ids and no writes. The resolved set is returned and also embedded as service_areas in the technician GET/list response. Managed by business staff (Booking Coordinator), not tech self-service.

Parameters:

  • id (String)

    Technician ID

  • technician_service_areas_request (TechnicianServiceAreasRequest)

    Service area IDs

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

    the optional parameters

Returns:



451
452
453
454
# File 'lib/crisphive/api/technician_api.rb', line 451

def replace_technician_service_areas(id, technician_service_areas_request, opts = {})
  data, _status_code, _headers = replace_technician_service_areas_with_http_info(id, technician_service_areas_request, opts)
  data
end

#replace_technician_service_areas_with_http_info(id, technician_service_areas_request, opts = {}) ⇒ Array<(ReplaceTechnicianServiceAreas200Response, Integer, Hash)>

Replace a technician's service areas Overwrites the technician's service-area assignments with the provided set of service area IDs. Sending an empty list clears all. Each service area ID must belong to the same business — any missing id → 404 SERVICE_AREA_NOT_FOUND with `missing_ids` and no writes. The resolved set is returned and also embedded as `service_areas` in the technician GET/list response. Managed by business staff (Booking Coordinator), not tech self-service.

Parameters:

  • id (String)

    Technician ID

  • technician_service_areas_request (TechnicianServiceAreasRequest)

    Service area IDs

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

    the optional parameters

Returns:



462
463
464
465
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
515
516
517
# File 'lib/crisphive/api/technician_api.rb', line 462

def replace_technician_service_areas_with_http_info(id, technician_service_areas_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TechnicianApi.replace_technician_service_areas ...'
  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 TechnicianApi.replace_technician_service_areas"
  end
  # verify the required parameter 'technician_service_areas_request' is set
  if @api_client.config.client_side_validation && technician_service_areas_request.nil?
    fail ArgumentError, "Missing the required parameter 'technician_service_areas_request' when calling TechnicianApi.replace_technician_service_areas"
  end
  # resource path
  local_var_path = '/technicians/{id}/service-areas'.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(technician_service_areas_request)

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

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

  new_options = opts.merge(
    :operation => :"TechnicianApi.replace_technician_service_areas",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TechnicianApi#replace_technician_service_areas\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#replace_technician_vehicles(id, technician_vehicles_request, opts = {}) ⇒ ResponseEnvelope

Replace a technician's vehicles Overwrites the technician's vehicle list with the provided set of vehicle IDs (the vehicles this technician uses). Sending an empty list clears all. Each vehicle ID must belong to the same business. The list is also embedded as vehicle_ids in the technician GET/list response.

Parameters:

  • id (String)

    Technician ID

  • technician_vehicles_request (TechnicianVehiclesRequest)

    Vehicle IDs

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

    the optional parameters

Returns:



525
526
527
528
# File 'lib/crisphive/api/technician_api.rb', line 525

def replace_technician_vehicles(id, technician_vehicles_request, opts = {})
  data, _status_code, _headers = replace_technician_vehicles_with_http_info(id, technician_vehicles_request, opts)
  data
end

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

Replace a technician's vehicles Overwrites the technician's vehicle list with the provided set of vehicle IDs (the vehicles this technician uses). Sending an empty list clears all. Each vehicle ID must belong to the same business. The list is also embedded as `vehicle_ids` in the technician GET/list response.

Parameters:

  • id (String)

    Technician ID

  • technician_vehicles_request (TechnicianVehiclesRequest)

    Vehicle IDs

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

    the optional parameters

Returns:

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

    ResponseEnvelope data, response status code and response headers



536
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
587
588
589
590
591
# File 'lib/crisphive/api/technician_api.rb', line 536

def replace_technician_vehicles_with_http_info(id, technician_vehicles_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TechnicianApi.replace_technician_vehicles ...'
  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 TechnicianApi.replace_technician_vehicles"
  end
  # verify the required parameter 'technician_vehicles_request' is set
  if @api_client.config.client_side_validation && technician_vehicles_request.nil?
    fail ArgumentError, "Missing the required parameter 'technician_vehicles_request' when calling TechnicianApi.replace_technician_vehicles"
  end
  # resource path
  local_var_path = '/technicians/{id}/vehicles'.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(technician_vehicles_request)

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

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

  new_options = opts.merge(
    :operation => :"TechnicianApi.replace_technician_vehicles",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TechnicianApi#replace_technician_vehicles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_technician(id, technician_update_request, opts = {}) ⇒ ResponseEnvelope

Update a technician Updates mutable technician profile fields. start_location_type=office re-snapshots the current business address + coordinates (body address/start_location_lat/start_location_long ignored; requires business coordinates, else 400 BUSINESS_LOCATION_MISSING). start_location_type=home (or empty) uses the address + coordinates from the body.

Parameters:

  • id (String)

    Technician ID

  • technician_update_request (TechnicianUpdateRequest)

    Technician details

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

    the optional parameters

Returns:



599
600
601
602
# File 'lib/crisphive/api/technician_api.rb', line 599

def update_technician(id, technician_update_request, opts = {})
  data, _status_code, _headers = update_technician_with_http_info(id, technician_update_request, opts)
  data
end

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

Update a technician Updates mutable technician profile fields. `start_location_type=office` re-snapshots the current business address + coordinates (body `address`/`start_location_lat`/`start_location_long` ignored; requires business coordinates, else 400 BUSINESS_LOCATION_MISSING). `start_location_type=home` (or empty) uses the address + coordinates from the body.

Parameters:

  • id (String)

    Technician ID

  • technician_update_request (TechnicianUpdateRequest)

    Technician details

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

    the optional parameters

Returns:

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

    ResponseEnvelope data, response status code and response headers



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
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/crisphive/api/technician_api.rb', line 610

def update_technician_with_http_info(id, technician_update_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TechnicianApi.update_technician ...'
  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 TechnicianApi.update_technician"
  end
  # verify the required parameter 'technician_update_request' is set
  if @api_client.config.client_side_validation && technician_update_request.nil?
    fail ArgumentError, "Missing the required parameter 'technician_update_request' when calling TechnicianApi.update_technician"
  end
  # resource path
  local_var_path = '/technicians/{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']
  # 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(technician_update_request)

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

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

  new_options = opts.merge(
    :operation => :"TechnicianApi.update_technician",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TechnicianApi#update_technician\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end