crisphive 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +183 -16
- data/crisphive.gemspec +5 -5
- data/lib/crisphive/api/business_skill_api.rb +502 -8
- data/lib/crisphive/api/customer_api.rb +20 -14
- data/lib/crisphive/api/job_request_business_api.rb +1273 -167
- data/lib/crisphive/api/job_types_api.rb +214 -2
- data/lib/crisphive/api/permission_api.rb +79 -0
- data/lib/crisphive/api/service_area_api.rb +214 -6
- data/lib/crisphive/api/technician_api.rb +510 -6
- data/lib/crisphive/api/technician_time_off_api.rb +240 -0
- data/lib/crisphive/api/vehicle_api.rb +214 -6
- data/lib/crisphive/api/webhooks_api.rb +213 -0
- data/lib/crisphive/api_client.rb +2 -2
- data/lib/crisphive/api_error.rb +2 -2
- data/lib/crisphive/configuration.rb +3 -3
- data/lib/crisphive/models/api_internal_techtimeoff_actions.rb +232 -0
- data/lib/crisphive/models/api_internal_techtimeoff_status.rb +42 -0
- data/lib/crisphive/models/assignable_group.rb +289 -0
- data/lib/crisphive/models/book_and_confirm_job_request200_response.rb +253 -0
- data/lib/crisphive/models/commit_absence_resolve200_response.rb +253 -0
- data/lib/crisphive/models/commit_emergency_reschedule200_response.rb +253 -0
- data/lib/crisphive/models/commit_job_request_move200_response.rb +253 -0
- data/lib/crisphive/models/create_customer200_response.rb +5 -2
- data/lib/crisphive/models/create_job_request200_response.rb +5 -2
- data/lib/crisphive/models/create_job_type200_response.rb +253 -0
- data/lib/crisphive/models/create_service_area200_response.rb +253 -0
- data/lib/crisphive/models/create_skill200_response.rb +253 -0
- data/lib/crisphive/models/create_skill_category200_response.rb +253 -0
- data/lib/crisphive/models/create_technician200_response.rb +253 -0
- data/lib/crisphive/models/create_technician_time_off200_response.rb +253 -0
- data/lib/crisphive/models/create_vehicle200_response.rb +253 -0
- data/lib/crisphive/models/create_webhook_endpoint200_response.rb +253 -0
- data/lib/crisphive/models/customer.rb +13 -3
- data/lib/crisphive/models/customer_address.rb +2 -2
- data/lib/crisphive/models/customer_address_request.rb +11 -2
- data/lib/crisphive/models/customer_contact.rb +27 -7
- data/lib/crisphive/models/customer_create_request.rb +14 -4
- data/lib/crisphive/models/customer_create_response.rb +2 -2
- data/lib/crisphive/models/customer_list.rb +3 -3
- data/lib/crisphive/models/customer_list_item.rb +13 -3
- data/lib/crisphive/models/customer_profile.rb +2 -2
- data/lib/crisphive/models/customer_quick_books_link.rb +235 -0
- data/lib/crisphive/models/customer_service_area_ref.rb +225 -0
- data/lib/crisphive/models/customer_spending.rb +2 -2
- data/lib/crisphive/models/customer_technician_ref.rb +225 -0
- data/lib/crisphive/models/customer_tier_progress.rb +2 -2
- data/lib/crisphive/models/customer_update_request.rb +25 -22
- data/lib/crisphive/models/get_customer200_response.rb +5 -2
- data/lib/crisphive/models/get_job_request200_response.rb +5 -2
- data/lib/crisphive/models/get_job_request_timeline200_response.rb +5 -2
- data/lib/crisphive/models/get_job_type200_response.rb +5 -2
- data/lib/crisphive/models/get_service_area200_response.rb +5 -2
- data/lib/crisphive/models/get_technician200_response.rb +5 -2
- data/lib/crisphive/models/get_technician_schedule200_response.rb +253 -0
- data/lib/crisphive/models/get_vehicle200_response.rb +5 -2
- data/lib/crisphive/models/internal_jobrequest_http_address_req.rb +475 -0
- data/lib/crisphive/models/job_date.rb +5 -3
- data/lib/crisphive/models/job_date_business_range.rb +7 -3
- data/lib/crisphive/models/job_date_period.rb +2 -2
- data/lib/crisphive/models/job_date_period_entry.rb +4 -2
- data/lib/crisphive/models/job_request.rb +56 -6
- data/lib/crisphive/models/job_request_absence_alternative.rb +356 -0
- data/lib/crisphive/models/job_request_absence_alternative_cost.rb +275 -0
- data/lib/crisphive/models/job_request_absence_assignment.rb +319 -0
- data/lib/crisphive/models/job_request_absence_commit_request.rb +296 -0
- data/lib/crisphive/models/job_request_absence_notification.rb +283 -0
- data/lib/crisphive/models/job_request_absence_plan.rb +322 -0
- data/lib/crisphive/models/job_request_absence_preview_request.rb +280 -0
- data/lib/crisphive/models/job_request_absence_resolved_job.rb +499 -0
- data/lib/crisphive/models/job_request_absence_solver.rb +289 -0
- data/lib/crisphive/models/job_request_absence_time_off.rb +281 -0
- data/lib/crisphive/models/job_request_absence_unresolved_job.rb +364 -0
- data/lib/crisphive/models/job_request_action_audit_by.rb +2 -2
- data/lib/crisphive/models/job_request_action_audit_entry.rb +3 -3
- data/lib/crisphive/models/job_request_action_summary.rb +3 -3
- data/lib/crisphive/models/job_request_address_summary.rb +2 -2
- data/lib/crisphive/models/job_request_archive_summary.rb +2 -2
- data/lib/crisphive/models/job_request_arrival_window.rb +4 -4
- data/lib/crisphive/models/job_request_assigned_vehicle.rb +2 -2
- data/lib/crisphive/models/job_request_assignment_summary.rb +2 -2
- data/lib/crisphive/models/job_request_attention_summary.rb +259 -0
- data/lib/crisphive/models/job_request_available_vehicle.rb +235 -0
- data/lib/crisphive/models/job_request_blocker.rb +363 -0
- data/lib/crisphive/models/job_request_blocker_ref.rb +223 -0
- data/lib/crisphive/models/job_request_book_and_confirm_customer.rb +302 -0
- data/lib/crisphive/models/job_request_book_and_confirm_emergency.rb +315 -0
- data/lib/crisphive/models/job_request_book_and_confirm_emergency_result.rb +279 -0
- data/lib/crisphive/models/job_request_book_and_confirm_refusal.rb +280 -0
- data/lib/crisphive/models/job_request_book_and_confirm_request.rb +466 -0
- data/lib/crisphive/models/job_request_book_and_confirm_response.rb +295 -0
- data/lib/crisphive/models/job_request_booking_windows.rb +2 -2
- data/lib/crisphive/models/job_request_buddy_slot_candidates.rb +239 -0
- data/lib/crisphive/models/job_request_business_time_range.rb +3 -3
- data/lib/crisphive/models/job_request_changes.rb +2 -2
- data/lib/crisphive/models/job_request_confirm_request.rb +255 -0
- data/lib/crisphive/models/job_request_create_request.rb +61 -7
- data/lib/crisphive/models/job_request_create_response.rb +2 -2
- data/lib/crisphive/models/job_request_crew_candidates.rb +227 -0
- data/lib/crisphive/models/job_request_crew_change.rb +299 -0
- data/lib/crisphive/models/job_request_crew_member.rb +7 -4
- data/lib/crisphive/models/job_request_crew_member_input.rb +284 -0
- data/lib/crisphive/models/job_request_crew_recommendation.rb +255 -0
- data/lib/crisphive/models/job_request_customer_summary.rb +2 -2
- data/lib/crisphive/models/job_request_day_windows.rb +3 -3
- data/lib/crisphive/models/job_request_emergency_candidate.rb +319 -0
- data/lib/crisphive/models/job_request_emergency_candidates.rb +311 -0
- data/lib/crisphive/models/job_request_emergency_candidates_request.rb +341 -0
- data/lib/crisphive/models/job_request_emergency_commit_request.rb +361 -0
- data/lib/crisphive/models/job_request_emergency_inline_job.rb +353 -0
- data/lib/crisphive/models/job_request_emergency_plan.rb +367 -0
- data/lib/crisphive/models/job_request_emergency_preview_request.rb +342 -0
- data/lib/crisphive/models/job_request_job_date_business_range_request.rb +3 -3
- data/lib/crisphive/models/job_request_job_date_period_request.rb +2 -2
- data/lib/crisphive/models/job_request_job_date_request.rb +3 -3
- data/lib/crisphive/models/job_request_lead_candidate.rb +311 -0
- data/lib/crisphive/models/job_request_list.rb +2 -2
- data/lib/crisphive/models/job_request_move_commit_req.rb +353 -0
- data/lib/crisphive/models/job_request_move_member.rb +299 -0
- data/lib/crisphive/models/job_request_move_plan.rb +387 -0
- data/lib/crisphive/models/job_request_move_preview_req.rb +300 -0
- data/lib/crisphive/models/job_request_move_warning.rb +335 -0
- data/lib/crisphive/models/job_request_period.rb +2 -2
- data/lib/crisphive/models/job_request_priority_update_result.rb +217 -0
- data/lib/crisphive/models/job_request_quote_request.rb +343 -0
- data/lib/crisphive/models/job_request_quote_summary.rb +2 -2
- data/lib/crisphive/models/job_request_rating_summary.rb +2 -2
- data/lib/crisphive/models/job_request_reassign_fallback.rb +287 -0
- data/lib/crisphive/models/job_request_reschedule_day.rb +227 -0
- data/lib/crisphive/models/job_request_reschedule_move.rb +319 -0
- data/lib/crisphive/models/job_request_reschedule_reassignment.rb +339 -0
- data/lib/crisphive/models/job_request_schedule.rb +2 -2
- data/lib/crisphive/models/job_request_session.rb +8 -7
- data/lib/crisphive/models/job_request_skill_summary.rb +3 -3
- data/lib/crisphive/models/job_request_status_summary.rb +3 -3
- data/lib/crisphive/models/job_request_tech_candidate.rb +287 -0
- data/lib/crisphive/models/job_request_technician_info.rb +2 -2
- data/lib/crisphive/models/job_request_time_segments.rb +287 -0
- data/lib/crisphive/models/job_request_time_segments_business_time.rb +321 -0
- data/lib/crisphive/models/job_request_time_segments_day.rb +247 -0
- data/lib/crisphive/models/job_request_time_segments_slot.rb +375 -0
- data/lib/crisphive/models/job_request_time_segments_worker.rb +295 -0
- data/lib/crisphive/models/job_request_timeline.rb +2 -2
- data/lib/crisphive/models/job_request_timeline_action.rb +2 -2
- data/lib/crisphive/models/job_request_timeline_event.rb +2 -2
- data/lib/crisphive/models/job_request_update_priority_request.rb +295 -0
- data/lib/crisphive/models/job_type.rb +44 -4
- data/lib/crisphive/models/job_type_create_request.rb +399 -0
- data/lib/crisphive/models/job_type_create_response.rb +215 -0
- data/lib/crisphive/models/job_type_update_request.rb +400 -0
- data/lib/crisphive/models/list_assignable_groups200_response.rb +255 -0
- data/lib/crisphive/models/list_crew_candidates200_response.rb +253 -0
- data/lib/crisphive/models/list_customers200_response.rb +5 -2
- data/lib/crisphive/models/list_emergency_candidates200_response.rb +253 -0
- data/lib/crisphive/models/list_job_request_booking_windows200_response.rb +5 -2
- data/lib/crisphive/models/list_job_request_changes200_response.rb +5 -2
- data/lib/crisphive/models/list_job_requests200_response.rb +5 -2
- data/lib/crisphive/models/list_job_types200_response.rb +5 -2
- data/lib/crisphive/models/list_matching_slots200_response.rb +253 -0
- data/lib/crisphive/models/list_nearby_technicians200_response.rb +253 -0
- data/lib/crisphive/models/list_service_areas200_response.rb +5 -2
- data/lib/crisphive/models/list_skill_categories200_response.rb +5 -2
- data/lib/crisphive/models/list_skills200_response.rb +5 -2
- data/lib/crisphive/models/list_skills_by_category200_response.rb +5 -2
- data/lib/crisphive/models/list_technician_skills200_response.rb +253 -0
- data/lib/crisphive/models/list_technician_time_off200_response.rb +253 -0
- data/lib/crisphive/models/list_technicians200_response.rb +5 -2
- data/lib/crisphive/models/list_vehicles200_response.rb +5 -2
- data/lib/crisphive/models/list_webhook_event_types200_response.rb +255 -0
- data/lib/crisphive/models/nearby_technician.rb +319 -0
- data/lib/crisphive/models/nearby_technicians.rb +237 -0
- data/lib/crisphive/models/pagination.rb +7 -2
- data/lib/crisphive/models/quote_job_request200_response.rb +253 -0
- data/lib/crisphive/models/replace_technician_service_areas200_response.rb +253 -0
- data/lib/crisphive/models/response_envelope.rb +6 -2
- data/lib/crisphive/models/service_area.rb +23 -3
- data/lib/crisphive/models/service_area_create_request.rb +455 -0
- data/lib/crisphive/models/service_area_create_response.rb +215 -0
- data/lib/crisphive/models/service_area_list.rb +2 -2
- data/lib/crisphive/models/service_area_update_request.rb +451 -0
- data/lib/crisphive/models/skill.rb +9 -2
- data/lib/crisphive/models/skill_by_category_list.rb +4 -2
- data/lib/crisphive/models/skill_category.rb +7 -2
- data/lib/crisphive/models/skill_category_create_request.rb +270 -0
- data/lib/crisphive/models/skill_category_create_response.rb +215 -0
- data/lib/crisphive/models/skill_category_list.rb +4 -2
- data/lib/crisphive/models/skill_create_request.rb +270 -0
- data/lib/crisphive/models/skill_create_response.rb +215 -0
- data/lib/crisphive/models/skill_list.rb +2 -2
- data/lib/crisphive/models/skill_summary.rb +2 -2
- data/lib/crisphive/models/skill_update_request.rb +281 -0
- data/lib/crisphive/models/technician.rb +66 -4
- data/lib/crisphive/models/technician_address.rb +2 -2
- data/lib/crisphive/models/technician_address_input.rb +408 -0
- data/lib/crisphive/models/technician_buddies_request.rb +236 -0
- data/lib/crisphive/models/technician_create_request.rb +603 -0
- data/lib/crisphive/models/technician_create_response.rb +215 -0
- data/lib/crisphive/models/technician_lead_ref.rb +2 -2
- data/lib/crisphive/models/technician_leads_request.rb +236 -0
- data/lib/crisphive/models/technician_list.rb +3 -3
- data/lib/crisphive/models/technician_schedule.rb +279 -0
- data/lib/crisphive/models/technician_schedule_block.rb +225 -0
- data/lib/crisphive/models/technician_schedule_session.rb +311 -0
- data/lib/crisphive/models/technician_service_area_ref.rb +2 -2
- data/lib/crisphive/models/technician_service_areas_request.rb +236 -0
- data/lib/crisphive/models/technician_service_areas_response.rb +217 -0
- data/lib/crisphive/models/technician_skill.rb +265 -0
- data/lib/crisphive/models/technician_skill_list.rb +227 -0
- data/lib/crisphive/models/technician_skills_request.rb +236 -0
- data/lib/crisphive/models/technician_status.rb +2 -2
- data/lib/crisphive/models/technician_time_off.rb +334 -0
- data/lib/crisphive/models/technician_time_off_create_request.rb +285 -0
- data/lib/crisphive/models/technician_time_off_create_response.rb +215 -0
- data/lib/crisphive/models/technician_time_off_list.rb +246 -0
- data/lib/crisphive/models/technician_update_request.rb +507 -0
- data/lib/crisphive/models/technician_vehicles_request.rb +236 -0
- data/lib/crisphive/models/vehicle.rb +26 -4
- data/lib/crisphive/models/vehicle_create_request.rb +420 -0
- data/lib/crisphive/models/vehicle_create_response.rb +215 -0
- data/lib/crisphive/models/vehicle_list.rb +2 -2
- data/lib/crisphive/models/vehicle_owner.rb +2 -2
- data/lib/crisphive/models/vehicle_update_request.rb +440 -0
- data/lib/crisphive/models/webhook_create_request.rb +320 -0
- data/lib/crisphive/models/webhook_create_response.rb +391 -0
- data/lib/crisphive/models/webhook_verification.rb +235 -0
- data/lib/crisphive/version.rb +3 -3
- data/lib/crisphive.rb +126 -2
- data/spec/spec_helper.rb +2 -2
- metadata +129 -5
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Crisphive Developer API
|
|
3
|
+
|
|
4
|
+
#Public REST API for integrating Crisphive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.11.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Crisphive
|
|
16
|
+
class TechnicianTimeOffApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Record a technician's time off (sick day, leave)
|
|
23
|
+
# Records a time-off block for a technician. The record is created PENDING; a business staff member approves it on the dashboard — EXCEPT for the sick-call flow, where `commitAbsenceResolve` approves the pending record that covers the absence itself. `start_datetime`/`end_datetime` are RFC3339 INSTANTS with an offset (e.g. `2030-06-15T04:00:00Z` for midnight Toronto), unlike the business-local naive datetimes used by scheduling calls — a whole day off is that day's local midnight to the next in UTC. Overlapping an existing record for the same technician is refused (`TIME_OFF_OVERLAP`); list `GET /technicians/{id}/time-off` first. Creating a record immediately flags the technician's jobs in that window as needing attention on the dispatch board. Supports Idempotency-Key.
|
|
24
|
+
# @param technician_time_off_create_request [TechnicianTimeOffCreateRequest] Time off details
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [String] :idempotency_key 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.
|
|
27
|
+
# @return [CreateTechnicianTimeOff200Response]
|
|
28
|
+
def create_technician_time_off(technician_time_off_create_request, opts = {})
|
|
29
|
+
data, _status_code, _headers = create_technician_time_off_with_http_info(technician_time_off_create_request, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Record a technician's time off (sick day, leave)
|
|
34
|
+
# Records a time-off block for a technician. The record is created PENDING; a business staff member approves it on the dashboard — EXCEPT for the sick-call flow, where `commitAbsenceResolve` approves the pending record that covers the absence itself. `start_datetime`/`end_datetime` are RFC3339 INSTANTS with an offset (e.g. `2030-06-15T04:00:00Z` for midnight Toronto), unlike the business-local naive datetimes used by scheduling calls — a whole day off is that day's local midnight to the next in UTC. Overlapping an existing record for the same technician is refused (`TIME_OFF_OVERLAP`); list `GET /technicians/{id}/time-off` first. Creating a record immediately flags the technician's jobs in that window as needing attention on the dispatch board. Supports Idempotency-Key.
|
|
35
|
+
# @param technician_time_off_create_request [TechnicianTimeOffCreateRequest] Time off details
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [String] :idempotency_key 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.
|
|
38
|
+
# @return [Array<(CreateTechnicianTimeOff200Response, Integer, Hash)>] CreateTechnicianTimeOff200Response data, response status code and response headers
|
|
39
|
+
def create_technician_time_off_with_http_info(technician_time_off_create_request, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: TechnicianTimeOffApi.create_technician_time_off ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'technician_time_off_create_request' is set
|
|
44
|
+
if @api_client.config.client_side_validation && technician_time_off_create_request.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'technician_time_off_create_request' when calling TechnicianTimeOffApi.create_technician_time_off"
|
|
46
|
+
end
|
|
47
|
+
# resource path
|
|
48
|
+
local_var_path = '/technician-time-off'
|
|
49
|
+
|
|
50
|
+
# query parameters
|
|
51
|
+
query_params = opts[:query_params] || {}
|
|
52
|
+
|
|
53
|
+
# header parameters
|
|
54
|
+
header_params = opts[:header_params] || {}
|
|
55
|
+
# HTTP header 'Accept' (if needed)
|
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
57
|
+
# HTTP header 'Content-Type'
|
|
58
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
59
|
+
if !content_type.nil?
|
|
60
|
+
header_params['Content-Type'] = content_type
|
|
61
|
+
end
|
|
62
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
63
|
+
|
|
64
|
+
# form parameters
|
|
65
|
+
form_params = opts[:form_params] || {}
|
|
66
|
+
|
|
67
|
+
# http body (model)
|
|
68
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(technician_time_off_create_request)
|
|
69
|
+
|
|
70
|
+
# return_type
|
|
71
|
+
return_type = opts[:debug_return_type] || 'CreateTechnicianTimeOff200Response'
|
|
72
|
+
|
|
73
|
+
# auth_names
|
|
74
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
75
|
+
|
|
76
|
+
new_options = opts.merge(
|
|
77
|
+
:operation => :"TechnicianTimeOffApi.create_technician_time_off",
|
|
78
|
+
:header_params => header_params,
|
|
79
|
+
:query_params => query_params,
|
|
80
|
+
:form_params => form_params,
|
|
81
|
+
:body => post_body,
|
|
82
|
+
:auth_names => auth_names,
|
|
83
|
+
:return_type => return_type
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
87
|
+
if @api_client.config.debugging
|
|
88
|
+
@api_client.config.logger.debug "API called: TechnicianTimeOffApi#create_technician_time_off\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
89
|
+
end
|
|
90
|
+
return data, status_code, headers
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Delete a technician's time off (e.g. back from a sick day)
|
|
94
|
+
# Removes a time-off record, in ANY status (pending, approved, rejected or cancelled). This is the \"the technician can come in after all\" call: once an approved record is deleted the technician is bookable again in that window for NEW bookings and schedule moves. It does NOT move any job back — jobs that `commitAbsenceResolve` already re-assigned to other technicians stay where they are (their customers may already have been told), and a job flagged as needing attention when the record was created keeps that flag until it is moved or re-assigned. To give the technician work again, book or move jobs onto them explicitly. The record is soft-deleted (it no longer appears in `GET /technicians/{id}/time-off`); deleting it again answers `TIME_OFF_NOT_FOUND`. A sandbox (`chsk_test_`) key can only delete sandbox records — a live record id answers `TIME_OFF_NOT_FOUND`, and the reverse holds for a live key.
|
|
95
|
+
# @param id [String] Time Off ID
|
|
96
|
+
# @param [Hash] opts the optional parameters
|
|
97
|
+
# @return [ResponseEnvelope]
|
|
98
|
+
def delete_technician_time_off(id, opts = {})
|
|
99
|
+
data, _status_code, _headers = delete_technician_time_off_with_http_info(id, opts)
|
|
100
|
+
data
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Delete a technician's time off (e.g. back from a sick day)
|
|
104
|
+
# Removes a time-off record, in ANY status (pending, approved, rejected or cancelled). This is the \"the technician can come in after all\" call: once an approved record is deleted the technician is bookable again in that window for NEW bookings and schedule moves. It does NOT move any job back — jobs that `commitAbsenceResolve` already re-assigned to other technicians stay where they are (their customers may already have been told), and a job flagged as needing attention when the record was created keeps that flag until it is moved or re-assigned. To give the technician work again, book or move jobs onto them explicitly. The record is soft-deleted (it no longer appears in `GET /technicians/{id}/time-off`); deleting it again answers `TIME_OFF_NOT_FOUND`. A sandbox (`chsk_test_`) key can only delete sandbox records — a live record id answers `TIME_OFF_NOT_FOUND`, and the reverse holds for a live key.
|
|
105
|
+
# @param id [String] Time Off ID
|
|
106
|
+
# @param [Hash] opts the optional parameters
|
|
107
|
+
# @return [Array<(ResponseEnvelope, Integer, Hash)>] ResponseEnvelope data, response status code and response headers
|
|
108
|
+
def delete_technician_time_off_with_http_info(id, opts = {})
|
|
109
|
+
if @api_client.config.debugging
|
|
110
|
+
@api_client.config.logger.debug 'Calling API: TechnicianTimeOffApi.delete_technician_time_off ...'
|
|
111
|
+
end
|
|
112
|
+
# verify the required parameter 'id' is set
|
|
113
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
114
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling TechnicianTimeOffApi.delete_technician_time_off"
|
|
115
|
+
end
|
|
116
|
+
# resource path
|
|
117
|
+
local_var_path = '/technician-time-off/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
118
|
+
|
|
119
|
+
# query parameters
|
|
120
|
+
query_params = opts[:query_params] || {}
|
|
121
|
+
|
|
122
|
+
# header parameters
|
|
123
|
+
header_params = opts[:header_params] || {}
|
|
124
|
+
# HTTP header 'Accept' (if needed)
|
|
125
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
126
|
+
|
|
127
|
+
# form parameters
|
|
128
|
+
form_params = opts[:form_params] || {}
|
|
129
|
+
|
|
130
|
+
# http body (model)
|
|
131
|
+
post_body = opts[:debug_body]
|
|
132
|
+
|
|
133
|
+
# return_type
|
|
134
|
+
return_type = opts[:debug_return_type] || 'ResponseEnvelope'
|
|
135
|
+
|
|
136
|
+
# auth_names
|
|
137
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
138
|
+
|
|
139
|
+
new_options = opts.merge(
|
|
140
|
+
:operation => :"TechnicianTimeOffApi.delete_technician_time_off",
|
|
141
|
+
:header_params => header_params,
|
|
142
|
+
:query_params => query_params,
|
|
143
|
+
:form_params => form_params,
|
|
144
|
+
:body => post_body,
|
|
145
|
+
:auth_names => auth_names,
|
|
146
|
+
:return_type => return_type
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
150
|
+
if @api_client.config.debugging
|
|
151
|
+
@api_client.config.logger.debug "API called: TechnicianTimeOffApi#delete_technician_time_off\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
152
|
+
end
|
|
153
|
+
return data, status_code, headers
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# List time off for a specific technician
|
|
157
|
+
# Returns the technician's time-off records (pending, approved, rejected, cancelled), paginated, optionally bounded by start_date/end_date (YYYY-MM-DD, inclusive overlap) and status. Read this before recording a new block (overlaps are refused) and to see whether an absence is already recorded before `commitAbsenceResolve`.
|
|
158
|
+
# @param id [String] Technician ID
|
|
159
|
+
# @param [Hash] opts the optional parameters
|
|
160
|
+
# @option opts [Integer] :page Page number (default 1)
|
|
161
|
+
# @option opts [Integer] :limit Items per page (default 15)
|
|
162
|
+
# @option opts [String] :start_date Filter by start date (YYYY-MM-DD)
|
|
163
|
+
# @option opts [String] :end_date Filter by end date (YYYY-MM-DD)
|
|
164
|
+
# @option opts [Array<String>] :status_ids Filter by status (multi: pending|approved|rejected|cancelled)
|
|
165
|
+
# @option opts [String] :keyword Search reason (case-insensitive substring)
|
|
166
|
+
# @option opts [String] :since RFC3339 cursor for short-polling; echo back next_since from prior response
|
|
167
|
+
# @return [ListTechnicianTimeOff200Response]
|
|
168
|
+
def list_technician_time_off(id, opts = {})
|
|
169
|
+
data, _status_code, _headers = list_technician_time_off_with_http_info(id, opts)
|
|
170
|
+
data
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# List time off for a specific technician
|
|
174
|
+
# Returns the technician's time-off records (pending, approved, rejected, cancelled), paginated, optionally bounded by start_date/end_date (YYYY-MM-DD, inclusive overlap) and status. Read this before recording a new block (overlaps are refused) and to see whether an absence is already recorded before `commitAbsenceResolve`.
|
|
175
|
+
# @param id [String] Technician ID
|
|
176
|
+
# @param [Hash] opts the optional parameters
|
|
177
|
+
# @option opts [Integer] :page Page number (default 1)
|
|
178
|
+
# @option opts [Integer] :limit Items per page (default 15)
|
|
179
|
+
# @option opts [String] :start_date Filter by start date (YYYY-MM-DD)
|
|
180
|
+
# @option opts [String] :end_date Filter by end date (YYYY-MM-DD)
|
|
181
|
+
# @option opts [Array<String>] :status_ids Filter by status (multi: pending|approved|rejected|cancelled)
|
|
182
|
+
# @option opts [String] :keyword Search reason (case-insensitive substring)
|
|
183
|
+
# @option opts [String] :since RFC3339 cursor for short-polling; echo back next_since from prior response
|
|
184
|
+
# @return [Array<(ListTechnicianTimeOff200Response, Integer, Hash)>] ListTechnicianTimeOff200Response data, response status code and response headers
|
|
185
|
+
def list_technician_time_off_with_http_info(id, opts = {})
|
|
186
|
+
if @api_client.config.debugging
|
|
187
|
+
@api_client.config.logger.debug 'Calling API: TechnicianTimeOffApi.list_technician_time_off ...'
|
|
188
|
+
end
|
|
189
|
+
# verify the required parameter 'id' is set
|
|
190
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
191
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling TechnicianTimeOffApi.list_technician_time_off"
|
|
192
|
+
end
|
|
193
|
+
# resource path
|
|
194
|
+
local_var_path = '/technicians/{id}/time-off'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
195
|
+
|
|
196
|
+
# query parameters
|
|
197
|
+
query_params = opts[:query_params] || {}
|
|
198
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
199
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
200
|
+
query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
|
|
201
|
+
query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
|
|
202
|
+
query_params[:'status_ids'] = @api_client.build_collection_param(opts[:'status_ids'], :multi) if !opts[:'status_ids'].nil?
|
|
203
|
+
query_params[:'keyword'] = opts[:'keyword'] if !opts[:'keyword'].nil?
|
|
204
|
+
query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
|
|
205
|
+
|
|
206
|
+
# header parameters
|
|
207
|
+
header_params = opts[:header_params] || {}
|
|
208
|
+
# HTTP header 'Accept' (if needed)
|
|
209
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
210
|
+
|
|
211
|
+
# form parameters
|
|
212
|
+
form_params = opts[:form_params] || {}
|
|
213
|
+
|
|
214
|
+
# http body (model)
|
|
215
|
+
post_body = opts[:debug_body]
|
|
216
|
+
|
|
217
|
+
# return_type
|
|
218
|
+
return_type = opts[:debug_return_type] || 'ListTechnicianTimeOff200Response'
|
|
219
|
+
|
|
220
|
+
# auth_names
|
|
221
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
222
|
+
|
|
223
|
+
new_options = opts.merge(
|
|
224
|
+
:operation => :"TechnicianTimeOffApi.list_technician_time_off",
|
|
225
|
+
:header_params => header_params,
|
|
226
|
+
:query_params => query_params,
|
|
227
|
+
:form_params => form_params,
|
|
228
|
+
:body => post_body,
|
|
229
|
+
:auth_names => auth_names,
|
|
230
|
+
:return_type => return_type
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
234
|
+
if @api_client.config.debugging
|
|
235
|
+
@api_client.config.logger.debug "API called: TechnicianTimeOffApi#list_technician_time_off\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
236
|
+
end
|
|
237
|
+
return data, status_code, headers
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
=begin
|
|
2
|
-
#
|
|
2
|
+
#Crisphive Developer API
|
|
3
3
|
|
|
4
|
-
#Public REST API for integrating
|
|
4
|
+
#Public REST API for integrating Crisphive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
|
|
5
5
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
|
|
@@ -19,8 +19,142 @@ module Crisphive
|
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
|
+
# Add a vehicle to the fleet
|
|
23
|
+
# Registers a van, truck or car in the business's own fleet. Vehicles are what a confirmed job's crew travels in: at confirm, Crisphive auto-selects one vehicle for the whole crew from the lead technician's vehicles, then from unowned fleet vehicles, and blocks a vehicle already booked for an overlapping job. `name` is the only required field, so a bulk fleet import needs nothing else; brand, model, year, plate_number, current_mileage and vehicle_type (van, truck or car) can be filled in later with updateVehicle. Names and plate numbers must be unique in the business (VEHICLE_DUPLICATE_NAME / VEHICLE_DUPLICATE_PLATE). `owner_id` records who has CLAIMED the vehicle as their primary one. The owner must be a lead technician or a management role; a buddy- or float-tier profile is refused with VEHICLE_OWNER_TIER_NOT_ALLOWED, an unknown profile with VEHICLE_INVALID_OWNER. Deciding which vehicles a technician may USE is a separate relation: use replaceTechnicianVehicles for that, not this tool. Send an Idempotency-Key header (the `idempotency_key` argument over MCP) so a retried call replays the original response instead of creating a duplicate vehicle.
|
|
24
|
+
# @param vehicle_create_request [VehicleCreateRequest] Vehicle details
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [String] :idempotency_key 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.
|
|
27
|
+
# @return [CreateVehicle200Response]
|
|
28
|
+
def create_vehicle(vehicle_create_request, opts = {})
|
|
29
|
+
data, _status_code, _headers = create_vehicle_with_http_info(vehicle_create_request, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Add a vehicle to the fleet
|
|
34
|
+
# Registers a van, truck or car in the business's own fleet. Vehicles are what a confirmed job's crew travels in: at confirm, Crisphive auto-selects one vehicle for the whole crew from the lead technician's vehicles, then from unowned fleet vehicles, and blocks a vehicle already booked for an overlapping job. `name` is the only required field, so a bulk fleet import needs nothing else; brand, model, year, plate_number, current_mileage and vehicle_type (van, truck or car) can be filled in later with updateVehicle. Names and plate numbers must be unique in the business (VEHICLE_DUPLICATE_NAME / VEHICLE_DUPLICATE_PLATE). `owner_id` records who has CLAIMED the vehicle as their primary one. The owner must be a lead technician or a management role; a buddy- or float-tier profile is refused with VEHICLE_OWNER_TIER_NOT_ALLOWED, an unknown profile with VEHICLE_INVALID_OWNER. Deciding which vehicles a technician may USE is a separate relation: use replaceTechnicianVehicles for that, not this tool. Send an Idempotency-Key header (the `idempotency_key` argument over MCP) so a retried call replays the original response instead of creating a duplicate vehicle.
|
|
35
|
+
# @param vehicle_create_request [VehicleCreateRequest] Vehicle details
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [String] :idempotency_key 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.
|
|
38
|
+
# @return [Array<(CreateVehicle200Response, Integer, Hash)>] CreateVehicle200Response data, response status code and response headers
|
|
39
|
+
def create_vehicle_with_http_info(vehicle_create_request, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: VehicleApi.create_vehicle ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'vehicle_create_request' is set
|
|
44
|
+
if @api_client.config.client_side_validation && vehicle_create_request.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'vehicle_create_request' when calling VehicleApi.create_vehicle"
|
|
46
|
+
end
|
|
47
|
+
# resource path
|
|
48
|
+
local_var_path = '/vehicles'
|
|
49
|
+
|
|
50
|
+
# query parameters
|
|
51
|
+
query_params = opts[:query_params] || {}
|
|
52
|
+
|
|
53
|
+
# header parameters
|
|
54
|
+
header_params = opts[:header_params] || {}
|
|
55
|
+
# HTTP header 'Accept' (if needed)
|
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
57
|
+
# HTTP header 'Content-Type'
|
|
58
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
59
|
+
if !content_type.nil?
|
|
60
|
+
header_params['Content-Type'] = content_type
|
|
61
|
+
end
|
|
62
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
63
|
+
|
|
64
|
+
# form parameters
|
|
65
|
+
form_params = opts[:form_params] || {}
|
|
66
|
+
|
|
67
|
+
# http body (model)
|
|
68
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(vehicle_create_request)
|
|
69
|
+
|
|
70
|
+
# return_type
|
|
71
|
+
return_type = opts[:debug_return_type] || 'CreateVehicle200Response'
|
|
72
|
+
|
|
73
|
+
# auth_names
|
|
74
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
75
|
+
|
|
76
|
+
new_options = opts.merge(
|
|
77
|
+
:operation => :"VehicleApi.create_vehicle",
|
|
78
|
+
:header_params => header_params,
|
|
79
|
+
:query_params => query_params,
|
|
80
|
+
:form_params => form_params,
|
|
81
|
+
:body => post_body,
|
|
82
|
+
:auth_names => auth_names,
|
|
83
|
+
:return_type => return_type
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
87
|
+
if @api_client.config.debugging
|
|
88
|
+
@api_client.config.logger.debug "API called: VehicleApi#create_vehicle\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
89
|
+
end
|
|
90
|
+
return data, status_code, headers
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Retire a vehicle from the fleet
|
|
94
|
+
# Soft-deletes the vehicle and, in the same transaction, removes it from every technician's vehicle list. It no longer appears in listVehicles or getVehicle and can no longer be auto-selected for a crew. Jobs that referenced it keep the stored reference but no longer display an assigned vehicle, and upcoming jobs are NOT given a replacement automatically. Reach for this only when a vehicle leaves the fleet for good (sold, written off, off-lease). For a van that is merely in the workshop, set its `status` to maintenance with updateVehicle instead, so the record stays in the fleet and can be brought straight back.
|
|
95
|
+
# @param id [String] Vehicle ID
|
|
96
|
+
# @param [Hash] opts the optional parameters
|
|
97
|
+
# @return [ResponseEnvelope]
|
|
98
|
+
def delete_vehicle(id, opts = {})
|
|
99
|
+
data, _status_code, _headers = delete_vehicle_with_http_info(id, opts)
|
|
100
|
+
data
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Retire a vehicle from the fleet
|
|
104
|
+
# Soft-deletes the vehicle and, in the same transaction, removes it from every technician's vehicle list. It no longer appears in listVehicles or getVehicle and can no longer be auto-selected for a crew. Jobs that referenced it keep the stored reference but no longer display an assigned vehicle, and upcoming jobs are NOT given a replacement automatically. Reach for this only when a vehicle leaves the fleet for good (sold, written off, off-lease). For a van that is merely in the workshop, set its `status` to maintenance with updateVehicle instead, so the record stays in the fleet and can be brought straight back.
|
|
105
|
+
# @param id [String] Vehicle ID
|
|
106
|
+
# @param [Hash] opts the optional parameters
|
|
107
|
+
# @return [Array<(ResponseEnvelope, Integer, Hash)>] ResponseEnvelope data, response status code and response headers
|
|
108
|
+
def delete_vehicle_with_http_info(id, opts = {})
|
|
109
|
+
if @api_client.config.debugging
|
|
110
|
+
@api_client.config.logger.debug 'Calling API: VehicleApi.delete_vehicle ...'
|
|
111
|
+
end
|
|
112
|
+
# verify the required parameter 'id' is set
|
|
113
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
114
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling VehicleApi.delete_vehicle"
|
|
115
|
+
end
|
|
116
|
+
# resource path
|
|
117
|
+
local_var_path = '/vehicles/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
118
|
+
|
|
119
|
+
# query parameters
|
|
120
|
+
query_params = opts[:query_params] || {}
|
|
121
|
+
|
|
122
|
+
# header parameters
|
|
123
|
+
header_params = opts[:header_params] || {}
|
|
124
|
+
# HTTP header 'Accept' (if needed)
|
|
125
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
126
|
+
|
|
127
|
+
# form parameters
|
|
128
|
+
form_params = opts[:form_params] || {}
|
|
129
|
+
|
|
130
|
+
# http body (model)
|
|
131
|
+
post_body = opts[:debug_body]
|
|
132
|
+
|
|
133
|
+
# return_type
|
|
134
|
+
return_type = opts[:debug_return_type] || 'ResponseEnvelope'
|
|
135
|
+
|
|
136
|
+
# auth_names
|
|
137
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
138
|
+
|
|
139
|
+
new_options = opts.merge(
|
|
140
|
+
:operation => :"VehicleApi.delete_vehicle",
|
|
141
|
+
:header_params => header_params,
|
|
142
|
+
:query_params => query_params,
|
|
143
|
+
:form_params => form_params,
|
|
144
|
+
:body => post_body,
|
|
145
|
+
:auth_names => auth_names,
|
|
146
|
+
:return_type => return_type
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
150
|
+
if @api_client.config.debugging
|
|
151
|
+
@api_client.config.logger.debug "API called: VehicleApi#delete_vehicle\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
152
|
+
end
|
|
153
|
+
return data, status_code, headers
|
|
154
|
+
end
|
|
155
|
+
|
|
22
156
|
# Get a vehicle
|
|
23
|
-
# Returns
|
|
157
|
+
# Returns one fleet vehicle (service van/truck): identity, plate, operational status (idle, on job, maintenance) and which technicians use it — the fleet-management view of a single asset.
|
|
24
158
|
# @param id [String] Vehicle ID
|
|
25
159
|
# @param [Hash] opts the optional parameters
|
|
26
160
|
# @return [GetVehicle200Response]
|
|
@@ -30,7 +164,7 @@ module Crisphive
|
|
|
30
164
|
end
|
|
31
165
|
|
|
32
166
|
# Get a vehicle
|
|
33
|
-
# Returns
|
|
167
|
+
# Returns one fleet vehicle (service van/truck): identity, plate, operational status (idle, on job, maintenance) and which technicians use it — the fleet-management view of a single asset.
|
|
34
168
|
# @param id [String] Vehicle ID
|
|
35
169
|
# @param [Hash] opts the optional parameters
|
|
36
170
|
# @return [Array<(GetVehicle200Response, Integer, Hash)>] GetVehicle200Response data, response status code and response headers
|
|
@@ -83,7 +217,7 @@ module Crisphive
|
|
|
83
217
|
end
|
|
84
218
|
|
|
85
219
|
# List vehicles
|
|
86
|
-
# Returns
|
|
220
|
+
# Returns the business's fleet: paginated service vehicles (vans/trucks) with operational status (idle, on job, maintenance) — the fleet inventory behind crew carpooling and job mobilization. Supports the `since` cursor for incremental fleet sync.
|
|
87
221
|
# @param [Hash] opts the optional parameters
|
|
88
222
|
# @option opts [Integer] :page Page number (default 1)
|
|
89
223
|
# @option opts [Integer] :limit Items per page (default 15, max 1000)
|
|
@@ -97,7 +231,7 @@ module Crisphive
|
|
|
97
231
|
end
|
|
98
232
|
|
|
99
233
|
# List vehicles
|
|
100
|
-
# Returns
|
|
234
|
+
# Returns the business's fleet: paginated service vehicles (vans/trucks) with operational status (idle, on job, maintenance) — the fleet inventory behind crew carpooling and job mobilization. Supports the `since` cursor for incremental fleet sync.
|
|
101
235
|
# @param [Hash] opts the optional parameters
|
|
102
236
|
# @option opts [Integer] :page Page number (default 1)
|
|
103
237
|
# @option opts [Integer] :limit Items per page (default 15, max 1000)
|
|
@@ -153,5 +287,79 @@ module Crisphive
|
|
|
153
287
|
end
|
|
154
288
|
return data, status_code, headers
|
|
155
289
|
end
|
|
290
|
+
|
|
291
|
+
# Change a vehicle's details
|
|
292
|
+
# Edits an existing fleet record in place; the vehicle id and the technicians who use it are untouched. Partial update: omit a field to KEEP its current value, send \"\" to CLEAR an optional text field (brand, model, plate_number). Exceptions: `name` rejects \"\" because a vehicle must stay identifiable, and `vehicle_type` (van, truck, car) and `status` (inactive, idle, on_job, maintenance) must be valid enum values when present; an empty string there is a 400. `owner_id`: omit to keep the current owner, \"\" to unclaim, or a UUID to reassign; the new owner must be a lead or management profile (VEHICLE_OWNER_TIER_NOT_ALLOWED otherwise). Use this for corrections and odometer updates, and set `status` to maintenance or inactive when a vehicle is temporarily out of service so it stays in the fleet. To change which technicians may use it, call replaceTechnicianVehicles; to take it out of the fleet for good, call deleteVehicle.
|
|
293
|
+
# @param id [String] Vehicle ID
|
|
294
|
+
# @param vehicle_update_request [VehicleUpdateRequest] Vehicle details
|
|
295
|
+
# @param [Hash] opts the optional parameters
|
|
296
|
+
# @return [ResponseEnvelope]
|
|
297
|
+
def update_vehicle(id, vehicle_update_request, opts = {})
|
|
298
|
+
data, _status_code, _headers = update_vehicle_with_http_info(id, vehicle_update_request, opts)
|
|
299
|
+
data
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Change a vehicle's details
|
|
303
|
+
# Edits an existing fleet record in place; the vehicle id and the technicians who use it are untouched. Partial update: omit a field to KEEP its current value, send \"\" to CLEAR an optional text field (brand, model, plate_number). Exceptions: `name` rejects \"\" because a vehicle must stay identifiable, and `vehicle_type` (van, truck, car) and `status` (inactive, idle, on_job, maintenance) must be valid enum values when present; an empty string there is a 400. `owner_id`: omit to keep the current owner, \"\" to unclaim, or a UUID to reassign; the new owner must be a lead or management profile (VEHICLE_OWNER_TIER_NOT_ALLOWED otherwise). Use this for corrections and odometer updates, and set `status` to maintenance or inactive when a vehicle is temporarily out of service so it stays in the fleet. To change which technicians may use it, call replaceTechnicianVehicles; to take it out of the fleet for good, call deleteVehicle.
|
|
304
|
+
# @param id [String] Vehicle ID
|
|
305
|
+
# @param vehicle_update_request [VehicleUpdateRequest] Vehicle details
|
|
306
|
+
# @param [Hash] opts the optional parameters
|
|
307
|
+
# @return [Array<(ResponseEnvelope, Integer, Hash)>] ResponseEnvelope data, response status code and response headers
|
|
308
|
+
def update_vehicle_with_http_info(id, vehicle_update_request, opts = {})
|
|
309
|
+
if @api_client.config.debugging
|
|
310
|
+
@api_client.config.logger.debug 'Calling API: VehicleApi.update_vehicle ...'
|
|
311
|
+
end
|
|
312
|
+
# verify the required parameter 'id' is set
|
|
313
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
314
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling VehicleApi.update_vehicle"
|
|
315
|
+
end
|
|
316
|
+
# verify the required parameter 'vehicle_update_request' is set
|
|
317
|
+
if @api_client.config.client_side_validation && vehicle_update_request.nil?
|
|
318
|
+
fail ArgumentError, "Missing the required parameter 'vehicle_update_request' when calling VehicleApi.update_vehicle"
|
|
319
|
+
end
|
|
320
|
+
# resource path
|
|
321
|
+
local_var_path = '/vehicles/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
322
|
+
|
|
323
|
+
# query parameters
|
|
324
|
+
query_params = opts[:query_params] || {}
|
|
325
|
+
|
|
326
|
+
# header parameters
|
|
327
|
+
header_params = opts[:header_params] || {}
|
|
328
|
+
# HTTP header 'Accept' (if needed)
|
|
329
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
330
|
+
# HTTP header 'Content-Type'
|
|
331
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
332
|
+
if !content_type.nil?
|
|
333
|
+
header_params['Content-Type'] = content_type
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# form parameters
|
|
337
|
+
form_params = opts[:form_params] || {}
|
|
338
|
+
|
|
339
|
+
# http body (model)
|
|
340
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(vehicle_update_request)
|
|
341
|
+
|
|
342
|
+
# return_type
|
|
343
|
+
return_type = opts[:debug_return_type] || 'ResponseEnvelope'
|
|
344
|
+
|
|
345
|
+
# auth_names
|
|
346
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
347
|
+
|
|
348
|
+
new_options = opts.merge(
|
|
349
|
+
:operation => :"VehicleApi.update_vehicle",
|
|
350
|
+
:header_params => header_params,
|
|
351
|
+
:query_params => query_params,
|
|
352
|
+
:form_params => form_params,
|
|
353
|
+
:body => post_body,
|
|
354
|
+
:auth_names => auth_names,
|
|
355
|
+
:return_type => return_type
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
|
359
|
+
if @api_client.config.debugging
|
|
360
|
+
@api_client.config.logger.debug "API called: VehicleApi#update_vehicle\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
361
|
+
end
|
|
362
|
+
return data, status_code, headers
|
|
363
|
+
end
|
|
156
364
|
end
|
|
157
365
|
end
|