crisphive 0.2.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 +98 -10
- data/lib/crisphive/api/business_skill_api.rb +348 -0
- data/lib/crisphive/api/customer_api.rb +7 -4
- data/lib/crisphive/api/job_request_business_api.rb +243 -27
- data/lib/crisphive/api/job_types_api.rb +208 -0
- data/lib/crisphive/api/permission_api.rb +79 -0
- data/lib/crisphive/api/service_area_api.rb +208 -0
- data/lib/crisphive/api/technician_api.rb +8 -8
- data/lib/crisphive/api/technician_time_off_api.rb +240 -0
- data/lib/crisphive/api/vehicle_api.rb +208 -0
- data/lib/crisphive/api/webhooks_api.rb +213 -0
- 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/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_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 +11 -1
- data/lib/crisphive/models/customer_contact.rb +25 -5
- data/lib/crisphive/models/customer_create_request.rb +12 -2
- data/lib/crisphive/models/customer_list_item.rb +11 -1
- 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_technician_ref.rb +225 -0
- data/lib/crisphive/models/customer_update_request.rb +23 -20
- data/lib/crisphive/models/internal_jobrequest_http_address_req.rb +475 -0
- data/lib/crisphive/models/job_request.rb +11 -1
- 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_summary.rb +1 -1
- data/lib/crisphive/models/job_request_attention_summary.rb +2 -2
- 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_confirm_request.rb +14 -4
- data/lib/crisphive/models/job_request_create_request.rb +1 -1
- data/lib/crisphive/models/job_request_emergency_candidate.rb +26 -4
- data/lib/crisphive/models/job_request_emergency_candidates.rb +1 -1
- data/lib/crisphive/models/job_request_emergency_candidates_request.rb +24 -11
- data/lib/crisphive/models/job_request_emergency_commit_request.rb +11 -1
- data/lib/crisphive/models/job_request_emergency_inline_job.rb +353 -0
- data/lib/crisphive/models/job_request_emergency_plan.rb +25 -3
- data/lib/crisphive/models/job_request_emergency_preview_request.rb +24 -11
- data/lib/crisphive/models/job_request_move_commit_req.rb +11 -1
- data/lib/crisphive/models/job_request_move_plan.rb +11 -1
- data/lib/crisphive/models/job_request_move_preview_req.rb +11 -1
- data/lib/crisphive/models/job_request_move_warning.rb +32 -8
- data/lib/crisphive/models/job_request_priority_update_result.rb +217 -0
- data/lib/crisphive/models/job_request_quote_request.rb +14 -11
- data/lib/crisphive/models/job_request_reassign_fallback.rb +287 -0
- data/lib/crisphive/models/job_request_skill_summary.rb +1 -1
- data/lib/crisphive/models/job_request_status_summary.rb +1 -1
- data/lib/crisphive/models/job_request_time_segments.rb +2 -2
- data/lib/crisphive/models/job_type.rb +42 -2
- 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_technician_time_off200_response.rb +253 -0
- data/lib/crisphive/models/list_webhook_event_types200_response.rb +255 -0
- data/lib/crisphive/models/quote_job_request200_response.rb +253 -0
- data/lib/crisphive/models/service_area.rb +21 -1
- 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_update_request.rb +451 -0
- 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_create_request.rb +270 -0
- data/lib/crisphive/models/skill_create_response.rb +215 -0
- data/lib/crisphive/models/skill_update_request.rb +281 -0
- data/lib/crisphive/models/technician.rb +64 -2
- data/lib/crisphive/models/technician_create_request.rb +14 -11
- 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 +2 -2
- 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_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 +1 -1
- data/lib/crisphive.rb +66 -0
- metadata +68 -2
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Crisphive Developer API
|
|
3
|
+
|
|
4
|
+
#Public REST API for integrating Crisphive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.11.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Crisphive
|
|
17
|
+
class JobRequestBookAndConfirmRequest
|
|
18
|
+
# Service address. REQUIRED with `customer`. OPTIONAL with `customer_id`: when sent it is used for THIS JOB and the stored customer address is only the fallback when it is omitted — it is never written back to the customer record. Missing coordinates are geocoded.
|
|
19
|
+
attr_accessor :address
|
|
20
|
+
|
|
21
|
+
# A caller who may or may not exist yet: matched by phone/email against the business's customers (no duplicate is created for a known caller), created otherwise. Send this OR `customer_id`.
|
|
22
|
+
attr_accessor :customer
|
|
23
|
+
|
|
24
|
+
# UUID of an existing customer. Send this OR `customer`, not both.
|
|
25
|
+
attr_accessor :customer_id
|
|
26
|
+
|
|
27
|
+
# Demobilization (teardown) minutes after the work, min 0 — same rules as mobilization_minutes.
|
|
28
|
+
attr_accessor :demobilization_minutes
|
|
29
|
+
|
|
30
|
+
# Free-text description of the work. Optional; max 2000 chars.
|
|
31
|
+
attr_accessor :description
|
|
32
|
+
|
|
33
|
+
# P0 dispatch. Present only with priority p0 (or a business whose default priority is p0). See the endpoint description.
|
|
34
|
+
attr_accessor :emergency
|
|
35
|
+
|
|
36
|
+
# Hands-on work minutes. Optional when the job type has a default_duration_minutes.
|
|
37
|
+
attr_accessor :job_duration_minutes
|
|
38
|
+
|
|
39
|
+
# UUID of the job type: it classifies the job and supplies default_duration_minutes when job_duration_minutes is omitted. Optional: omitted, the business's DEFAULT job type (is_default, the seeded \"General\", 60 min + 15 + 15 unless the business changed it) is used.
|
|
40
|
+
attr_accessor :job_type_id
|
|
41
|
+
|
|
42
|
+
# Mobilization (setup/travel-prep) minutes before the work, min 0 — same meaning as on quoteJobRequest. Optional: omitted, the job type's default_mobilization_minutes applies when job_duration_minutes is ALSO omitted, and 0 when you sent a duration (an explicit duration is never mixed with the type's buffers). A value you send always wins. Counted when checking whether a pinned technician_id is free.
|
|
43
|
+
attr_accessor :mobilization_minutes
|
|
44
|
+
|
|
45
|
+
# Scheduling priority p0–p3. Optional; omitted = the business default.
|
|
46
|
+
attr_accessor :priority
|
|
47
|
+
|
|
48
|
+
# Start time — a BUSINESS-LOCAL wall clock, same rule as confirmJobRequest: canonical `2026-09-30T10:00:00`, seconds optional, a space may replace the T; an offset is accepted only when it agrees with the business timezone. Must be in the future.
|
|
49
|
+
attr_accessor :scheduled_at
|
|
50
|
+
|
|
51
|
+
# UUIDs of skills the work needs. Optional; up to 20.
|
|
52
|
+
attr_accessor :skill_ids
|
|
53
|
+
|
|
54
|
+
# Force a specific lead technician (feasibility still enforced). Omit to let Crisphive pick.
|
|
55
|
+
attr_accessor :technician_id
|
|
56
|
+
|
|
57
|
+
class EnumAttributeValidator
|
|
58
|
+
attr_reader :datatype
|
|
59
|
+
attr_reader :allowable_values
|
|
60
|
+
|
|
61
|
+
def initialize(datatype, allowable_values)
|
|
62
|
+
@allowable_values = allowable_values.map do |value|
|
|
63
|
+
case datatype.to_s
|
|
64
|
+
when /Integer/i
|
|
65
|
+
value.to_i
|
|
66
|
+
when /Float/i
|
|
67
|
+
value.to_f
|
|
68
|
+
else
|
|
69
|
+
value
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def valid?(value)
|
|
75
|
+
!value || allowable_values.include?(value)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
80
|
+
def self.attribute_map
|
|
81
|
+
{
|
|
82
|
+
:'address' => :'address',
|
|
83
|
+
:'customer' => :'customer',
|
|
84
|
+
:'customer_id' => :'customer_id',
|
|
85
|
+
:'demobilization_minutes' => :'demobilization_minutes',
|
|
86
|
+
:'description' => :'description',
|
|
87
|
+
:'emergency' => :'emergency',
|
|
88
|
+
:'job_duration_minutes' => :'job_duration_minutes',
|
|
89
|
+
:'job_type_id' => :'job_type_id',
|
|
90
|
+
:'mobilization_minutes' => :'mobilization_minutes',
|
|
91
|
+
:'priority' => :'priority',
|
|
92
|
+
:'scheduled_at' => :'scheduled_at',
|
|
93
|
+
:'skill_ids' => :'skill_ids',
|
|
94
|
+
:'technician_id' => :'technician_id'
|
|
95
|
+
}
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Returns all the JSON keys this model knows about
|
|
99
|
+
def self.acceptable_attributes
|
|
100
|
+
attribute_map.values
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Attribute type mapping.
|
|
104
|
+
def self.openapi_types
|
|
105
|
+
{
|
|
106
|
+
:'address' => :'InternalJobrequestHttpAddressReq',
|
|
107
|
+
:'customer' => :'JobRequestBookAndConfirmCustomer',
|
|
108
|
+
:'customer_id' => :'String',
|
|
109
|
+
:'demobilization_minutes' => :'Integer',
|
|
110
|
+
:'description' => :'String',
|
|
111
|
+
:'emergency' => :'JobRequestBookAndConfirmEmergency',
|
|
112
|
+
:'job_duration_minutes' => :'Integer',
|
|
113
|
+
:'job_type_id' => :'String',
|
|
114
|
+
:'mobilization_minutes' => :'Integer',
|
|
115
|
+
:'priority' => :'String',
|
|
116
|
+
:'scheduled_at' => :'Time',
|
|
117
|
+
:'skill_ids' => :'Array<String>',
|
|
118
|
+
:'technician_id' => :'String'
|
|
119
|
+
}
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# List of attributes with nullable: true
|
|
123
|
+
def self.openapi_nullable
|
|
124
|
+
Set.new([
|
|
125
|
+
])
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Initializes the object
|
|
129
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
130
|
+
def initialize(attributes = {})
|
|
131
|
+
if (!attributes.is_a?(Hash))
|
|
132
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestBookAndConfirmRequest` initialize method"
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
136
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
137
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
138
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestBookAndConfirmRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
139
|
+
end
|
|
140
|
+
h[k.to_sym] = v
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'address')
|
|
144
|
+
self.address = attributes[:'address']
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if attributes.key?(:'customer')
|
|
148
|
+
self.customer = attributes[:'customer']
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'customer_id')
|
|
152
|
+
self.customer_id = attributes[:'customer_id']
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if attributes.key?(:'demobilization_minutes')
|
|
156
|
+
self.demobilization_minutes = attributes[:'demobilization_minutes']
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if attributes.key?(:'description')
|
|
160
|
+
self.description = attributes[:'description']
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if attributes.key?(:'emergency')
|
|
164
|
+
self.emergency = attributes[:'emergency']
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if attributes.key?(:'job_duration_minutes')
|
|
168
|
+
self.job_duration_minutes = attributes[:'job_duration_minutes']
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if attributes.key?(:'job_type_id')
|
|
172
|
+
self.job_type_id = attributes[:'job_type_id']
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
if attributes.key?(:'mobilization_minutes')
|
|
176
|
+
self.mobilization_minutes = attributes[:'mobilization_minutes']
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
if attributes.key?(:'priority')
|
|
180
|
+
self.priority = attributes[:'priority']
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if attributes.key?(:'scheduled_at')
|
|
184
|
+
self.scheduled_at = attributes[:'scheduled_at']
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if attributes.key?(:'skill_ids')
|
|
188
|
+
if (value = attributes[:'skill_ids']).is_a?(Array)
|
|
189
|
+
self.skill_ids = value
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
if attributes.key?(:'technician_id')
|
|
194
|
+
self.technician_id = attributes[:'technician_id']
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
199
|
+
# @return Array for valid properties with the reasons
|
|
200
|
+
def list_invalid_properties
|
|
201
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
202
|
+
invalid_properties = Array.new
|
|
203
|
+
if !@demobilization_minutes.nil? && @demobilization_minutes < 0
|
|
204
|
+
invalid_properties.push('invalid value for "demobilization_minutes", must be greater than or equal to 0.')
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
if !@description.nil? && @description.to_s.length > 2000
|
|
208
|
+
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
if !@job_duration_minutes.nil? && @job_duration_minutes < 1
|
|
212
|
+
invalid_properties.push('invalid value for "job_duration_minutes", must be greater than or equal to 1.')
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
if !@mobilization_minutes.nil? && @mobilization_minutes < 0
|
|
216
|
+
invalid_properties.push('invalid value for "mobilization_minutes", must be greater than or equal to 0.')
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
if !@skill_ids.nil? && @skill_ids.length > 20
|
|
220
|
+
invalid_properties.push('invalid value for "skill_ids", number of items must be less than or equal to 20.')
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
invalid_properties
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Check to see if the all the properties in the model are valid
|
|
227
|
+
# @return true if the model is valid
|
|
228
|
+
def valid?
|
|
229
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
230
|
+
return false if !@demobilization_minutes.nil? && @demobilization_minutes < 0
|
|
231
|
+
return false if !@description.nil? && @description.to_s.length > 2000
|
|
232
|
+
return false if !@job_duration_minutes.nil? && @job_duration_minutes < 1
|
|
233
|
+
return false if !@mobilization_minutes.nil? && @mobilization_minutes < 0
|
|
234
|
+
priority_validator = EnumAttributeValidator.new('String', ["p0", "p1", "p2", "p3"])
|
|
235
|
+
return false unless priority_validator.valid?(@priority)
|
|
236
|
+
return false if !@skill_ids.nil? && @skill_ids.length > 20
|
|
237
|
+
true
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Custom attribute writer method with validation
|
|
241
|
+
# @param [Object] demobilization_minutes Value to be assigned
|
|
242
|
+
def demobilization_minutes=(demobilization_minutes)
|
|
243
|
+
if demobilization_minutes.nil?
|
|
244
|
+
fail ArgumentError, 'demobilization_minutes cannot be nil'
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
if demobilization_minutes < 0
|
|
248
|
+
fail ArgumentError, 'invalid value for "demobilization_minutes", must be greater than or equal to 0.'
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
@demobilization_minutes = demobilization_minutes
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# Custom attribute writer method with validation
|
|
255
|
+
# @param [Object] description Value to be assigned
|
|
256
|
+
def description=(description)
|
|
257
|
+
if description.nil?
|
|
258
|
+
fail ArgumentError, 'description cannot be nil'
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
if description.to_s.length > 2000
|
|
262
|
+
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.'
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
@description = description
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# Custom attribute writer method with validation
|
|
269
|
+
# @param [Object] job_duration_minutes Value to be assigned
|
|
270
|
+
def job_duration_minutes=(job_duration_minutes)
|
|
271
|
+
if job_duration_minutes.nil?
|
|
272
|
+
fail ArgumentError, 'job_duration_minutes cannot be nil'
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
if job_duration_minutes < 1
|
|
276
|
+
fail ArgumentError, 'invalid value for "job_duration_minutes", must be greater than or equal to 1.'
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
@job_duration_minutes = job_duration_minutes
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Custom attribute writer method with validation
|
|
283
|
+
# @param [Object] mobilization_minutes Value to be assigned
|
|
284
|
+
def mobilization_minutes=(mobilization_minutes)
|
|
285
|
+
if mobilization_minutes.nil?
|
|
286
|
+
fail ArgumentError, 'mobilization_minutes cannot be nil'
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
if mobilization_minutes < 0
|
|
290
|
+
fail ArgumentError, 'invalid value for "mobilization_minutes", must be greater than or equal to 0.'
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
@mobilization_minutes = mobilization_minutes
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
297
|
+
# @param [Object] priority Object to be assigned
|
|
298
|
+
def priority=(priority)
|
|
299
|
+
validator = EnumAttributeValidator.new('String', ["p0", "p1", "p2", "p3"])
|
|
300
|
+
unless validator.valid?(priority)
|
|
301
|
+
fail ArgumentError, "invalid value for \"priority\", must be one of #{validator.allowable_values}."
|
|
302
|
+
end
|
|
303
|
+
@priority = priority
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Custom attribute writer method with validation
|
|
307
|
+
# @param [Object] skill_ids Value to be assigned
|
|
308
|
+
def skill_ids=(skill_ids)
|
|
309
|
+
if skill_ids.nil?
|
|
310
|
+
fail ArgumentError, 'skill_ids cannot be nil'
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
if skill_ids.length > 20
|
|
314
|
+
fail ArgumentError, 'invalid value for "skill_ids", number of items must be less than or equal to 20.'
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
@skill_ids = skill_ids
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# Checks equality by comparing each attribute.
|
|
321
|
+
# @param [Object] Object to be compared
|
|
322
|
+
def ==(o)
|
|
323
|
+
return true if self.equal?(o)
|
|
324
|
+
self.class == o.class &&
|
|
325
|
+
address == o.address &&
|
|
326
|
+
customer == o.customer &&
|
|
327
|
+
customer_id == o.customer_id &&
|
|
328
|
+
demobilization_minutes == o.demobilization_minutes &&
|
|
329
|
+
description == o.description &&
|
|
330
|
+
emergency == o.emergency &&
|
|
331
|
+
job_duration_minutes == o.job_duration_minutes &&
|
|
332
|
+
job_type_id == o.job_type_id &&
|
|
333
|
+
mobilization_minutes == o.mobilization_minutes &&
|
|
334
|
+
priority == o.priority &&
|
|
335
|
+
scheduled_at == o.scheduled_at &&
|
|
336
|
+
skill_ids == o.skill_ids &&
|
|
337
|
+
technician_id == o.technician_id
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# @see the `==` method
|
|
341
|
+
# @param [Object] Object to be compared
|
|
342
|
+
def eql?(o)
|
|
343
|
+
self == o
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Calculates hash code according to all attributes.
|
|
347
|
+
# @return [Integer] Hash code
|
|
348
|
+
def hash
|
|
349
|
+
[address, customer, customer_id, demobilization_minutes, description, emergency, job_duration_minutes, job_type_id, mobilization_minutes, priority, scheduled_at, skill_ids, technician_id].hash
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
# Builds the object from hash
|
|
353
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
354
|
+
# @return [Object] Returns the model itself
|
|
355
|
+
def self.build_from_hash(attributes)
|
|
356
|
+
return nil unless attributes.is_a?(Hash)
|
|
357
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
358
|
+
transformed_hash = {}
|
|
359
|
+
openapi_types.each_pair do |key, type|
|
|
360
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
361
|
+
transformed_hash["#{key}"] = nil
|
|
362
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
363
|
+
# check to ensure the input is an array given that the attribute
|
|
364
|
+
# is documented as an array but the input is not
|
|
365
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
366
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
367
|
+
end
|
|
368
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
369
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
370
|
+
end
|
|
371
|
+
end
|
|
372
|
+
new(transformed_hash)
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# Deserializes the data based on type
|
|
376
|
+
# @param string type Data type
|
|
377
|
+
# @param string value Value to be deserialized
|
|
378
|
+
# @return [Object] Deserialized data
|
|
379
|
+
def self._deserialize(type, value)
|
|
380
|
+
case type.to_sym
|
|
381
|
+
when :Time
|
|
382
|
+
Time.parse(value)
|
|
383
|
+
when :Date
|
|
384
|
+
Date.parse(value)
|
|
385
|
+
when :String
|
|
386
|
+
value.to_s
|
|
387
|
+
when :Integer
|
|
388
|
+
value.to_i
|
|
389
|
+
when :Float
|
|
390
|
+
value.to_f
|
|
391
|
+
when :Boolean
|
|
392
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
393
|
+
true
|
|
394
|
+
else
|
|
395
|
+
false
|
|
396
|
+
end
|
|
397
|
+
when :Object
|
|
398
|
+
# generic object (usually a Hash), return directly
|
|
399
|
+
value
|
|
400
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
401
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
402
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
403
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
404
|
+
k_type = Regexp.last_match[:k_type]
|
|
405
|
+
v_type = Regexp.last_match[:v_type]
|
|
406
|
+
{}.tap do |hash|
|
|
407
|
+
value.each do |k, v|
|
|
408
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
409
|
+
end
|
|
410
|
+
end
|
|
411
|
+
else # model
|
|
412
|
+
# models (e.g. Pet) or oneOf
|
|
413
|
+
klass = Crisphive.const_get(type)
|
|
414
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
415
|
+
end
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# Returns the string representation of the object
|
|
419
|
+
# @return [String] String presentation of the object
|
|
420
|
+
def to_s
|
|
421
|
+
to_hash.to_s
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
425
|
+
# @return [Hash] Returns the object in the form of hash
|
|
426
|
+
def to_body
|
|
427
|
+
to_hash
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
# Returns the object in the form of hash
|
|
431
|
+
# @return [Hash] Returns the object in the form of hash
|
|
432
|
+
def to_hash
|
|
433
|
+
hash = {}
|
|
434
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
435
|
+
value = self.send(attr)
|
|
436
|
+
if value.nil?
|
|
437
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
438
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
hash[param] = _to_hash(value)
|
|
442
|
+
end
|
|
443
|
+
hash
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
# Outputs non-array value in the form of hash
|
|
447
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
448
|
+
# @param [Object] value Any valid value
|
|
449
|
+
# @return [Hash] Returns the value in the form of hash
|
|
450
|
+
def _to_hash(value)
|
|
451
|
+
if value.is_a?(Array)
|
|
452
|
+
value.compact.map { |v| _to_hash(v) }
|
|
453
|
+
elsif value.is_a?(Hash)
|
|
454
|
+
{}.tap do |hash|
|
|
455
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
456
|
+
end
|
|
457
|
+
elsif value.respond_to? :to_hash
|
|
458
|
+
value.to_hash
|
|
459
|
+
else
|
|
460
|
+
value
|
|
461
|
+
end
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
end
|