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,364 @@
|
|
|
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 JobRequestAbsenceUnresolvedJob
|
|
18
|
+
# Preview, NO_QUALIFIED_TECH_FREE only: the relaxation ladder's priced options, cheapest constraint first — the FE's default is the first entry. Always an array; empty when even the ladder found nothing (and on commit rows). Each is a PROPOSAL until copied into commit.
|
|
19
|
+
attr_accessor :alternatives
|
|
20
|
+
|
|
21
|
+
# Engine diagnosis for the refused technicians (best-effort, may be absent).
|
|
22
|
+
attr_accessor :blockers
|
|
23
|
+
|
|
24
|
+
# Customer name on the job.
|
|
25
|
+
attr_accessor :customer_name
|
|
26
|
+
|
|
27
|
+
# Business-local calendar day (YYYY-MM-DD).
|
|
28
|
+
attr_accessor :date
|
|
29
|
+
|
|
30
|
+
attr_accessor :end_at
|
|
31
|
+
|
|
32
|
+
# UUID of the job.
|
|
33
|
+
attr_accessor :job_id
|
|
34
|
+
|
|
35
|
+
# Human-readable explanation (English).
|
|
36
|
+
attr_accessor :message
|
|
37
|
+
|
|
38
|
+
# Priority (p0..p3).
|
|
39
|
+
attr_accessor :priority
|
|
40
|
+
|
|
41
|
+
# Why it stayed unresolved. EXTEND-ONLY — carry a default branch. NOT_COMMITTED appears on commit only (a row the caller left out).
|
|
42
|
+
attr_accessor :reason_code
|
|
43
|
+
|
|
44
|
+
# Human-friendly short code.
|
|
45
|
+
attr_accessor :short_code
|
|
46
|
+
|
|
47
|
+
# The job's window (UTC) — unchanged, still on the absent technician.
|
|
48
|
+
attr_accessor :start_at
|
|
49
|
+
|
|
50
|
+
class EnumAttributeValidator
|
|
51
|
+
attr_reader :datatype
|
|
52
|
+
attr_reader :allowable_values
|
|
53
|
+
|
|
54
|
+
def initialize(datatype, allowable_values)
|
|
55
|
+
@allowable_values = allowable_values.map do |value|
|
|
56
|
+
case datatype.to_s
|
|
57
|
+
when /Integer/i
|
|
58
|
+
value.to_i
|
|
59
|
+
when /Float/i
|
|
60
|
+
value.to_f
|
|
61
|
+
else
|
|
62
|
+
value
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def valid?(value)
|
|
68
|
+
!value || allowable_values.include?(value)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
73
|
+
def self.attribute_map
|
|
74
|
+
{
|
|
75
|
+
:'alternatives' => :'alternatives',
|
|
76
|
+
:'blockers' => :'blockers',
|
|
77
|
+
:'customer_name' => :'customer_name',
|
|
78
|
+
:'date' => :'date',
|
|
79
|
+
:'end_at' => :'end_at',
|
|
80
|
+
:'job_id' => :'job_id',
|
|
81
|
+
:'message' => :'message',
|
|
82
|
+
:'priority' => :'priority',
|
|
83
|
+
:'reason_code' => :'reason_code',
|
|
84
|
+
:'short_code' => :'short_code',
|
|
85
|
+
:'start_at' => :'start_at'
|
|
86
|
+
}
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Returns all the JSON keys this model knows about
|
|
90
|
+
def self.acceptable_attributes
|
|
91
|
+
attribute_map.values
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Attribute type mapping.
|
|
95
|
+
def self.openapi_types
|
|
96
|
+
{
|
|
97
|
+
:'alternatives' => :'Array<JobRequestAbsenceAlternative>',
|
|
98
|
+
:'blockers' => :'Array<JobRequestBlocker>',
|
|
99
|
+
:'customer_name' => :'String',
|
|
100
|
+
:'date' => :'Date',
|
|
101
|
+
:'end_at' => :'Time',
|
|
102
|
+
:'job_id' => :'String',
|
|
103
|
+
:'message' => :'String',
|
|
104
|
+
:'priority' => :'String',
|
|
105
|
+
:'reason_code' => :'String',
|
|
106
|
+
:'short_code' => :'String',
|
|
107
|
+
:'start_at' => :'Time'
|
|
108
|
+
}
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# List of attributes with nullable: true
|
|
112
|
+
def self.openapi_nullable
|
|
113
|
+
Set.new([
|
|
114
|
+
])
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Initializes the object
|
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
119
|
+
def initialize(attributes = {})
|
|
120
|
+
if (!attributes.is_a?(Hash))
|
|
121
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestAbsenceUnresolvedJob` initialize method"
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
125
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
126
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
127
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestAbsenceUnresolvedJob`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
128
|
+
end
|
|
129
|
+
h[k.to_sym] = v
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'alternatives')
|
|
133
|
+
if (value = attributes[:'alternatives']).is_a?(Array)
|
|
134
|
+
self.alternatives = value
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if attributes.key?(:'blockers')
|
|
139
|
+
if (value = attributes[:'blockers']).is_a?(Array)
|
|
140
|
+
self.blockers = value
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if attributes.key?(:'customer_name')
|
|
145
|
+
self.customer_name = attributes[:'customer_name']
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if attributes.key?(:'date')
|
|
149
|
+
self.date = attributes[:'date']
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if attributes.key?(:'end_at')
|
|
153
|
+
self.end_at = attributes[:'end_at']
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if attributes.key?(:'job_id')
|
|
157
|
+
self.job_id = attributes[:'job_id']
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
if attributes.key?(:'message')
|
|
161
|
+
self.message = attributes[:'message']
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
if attributes.key?(:'priority')
|
|
165
|
+
self.priority = attributes[:'priority']
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if attributes.key?(:'reason_code')
|
|
169
|
+
self.reason_code = attributes[:'reason_code']
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
if attributes.key?(:'short_code')
|
|
173
|
+
self.short_code = attributes[:'short_code']
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
if attributes.key?(:'start_at')
|
|
177
|
+
self.start_at = attributes[:'start_at']
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
182
|
+
# @return Array for valid properties with the reasons
|
|
183
|
+
def list_invalid_properties
|
|
184
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
185
|
+
invalid_properties = Array.new
|
|
186
|
+
invalid_properties
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Check to see if the all the properties in the model are valid
|
|
190
|
+
# @return true if the model is valid
|
|
191
|
+
def valid?
|
|
192
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
193
|
+
priority_validator = EnumAttributeValidator.new('String', ["p0", "p1", "p2", "p3"])
|
|
194
|
+
return false unless priority_validator.valid?(@priority)
|
|
195
|
+
reason_code_validator = EnumAttributeValidator.new('String', ["NO_QUALIFIED_TECH_FREE", "CREW_JOB_UNSUPPORTED", "MULTIDAY_UNSUPPORTED", "IN_PROGRESS", "NOT_REASSIGNABLE", "NOT_COMMITTED"])
|
|
196
|
+
return false unless reason_code_validator.valid?(@reason_code)
|
|
197
|
+
true
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
201
|
+
# @param [Object] priority Object to be assigned
|
|
202
|
+
def priority=(priority)
|
|
203
|
+
validator = EnumAttributeValidator.new('String', ["p0", "p1", "p2", "p3"])
|
|
204
|
+
unless validator.valid?(priority)
|
|
205
|
+
fail ArgumentError, "invalid value for \"priority\", must be one of #{validator.allowable_values}."
|
|
206
|
+
end
|
|
207
|
+
@priority = priority
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
211
|
+
# @param [Object] reason_code Object to be assigned
|
|
212
|
+
def reason_code=(reason_code)
|
|
213
|
+
validator = EnumAttributeValidator.new('String', ["NO_QUALIFIED_TECH_FREE", "CREW_JOB_UNSUPPORTED", "MULTIDAY_UNSUPPORTED", "IN_PROGRESS", "NOT_REASSIGNABLE", "NOT_COMMITTED"])
|
|
214
|
+
unless validator.valid?(reason_code)
|
|
215
|
+
fail ArgumentError, "invalid value for \"reason_code\", must be one of #{validator.allowable_values}."
|
|
216
|
+
end
|
|
217
|
+
@reason_code = reason_code
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Checks equality by comparing each attribute.
|
|
221
|
+
# @param [Object] Object to be compared
|
|
222
|
+
def ==(o)
|
|
223
|
+
return true if self.equal?(o)
|
|
224
|
+
self.class == o.class &&
|
|
225
|
+
alternatives == o.alternatives &&
|
|
226
|
+
blockers == o.blockers &&
|
|
227
|
+
customer_name == o.customer_name &&
|
|
228
|
+
date == o.date &&
|
|
229
|
+
end_at == o.end_at &&
|
|
230
|
+
job_id == o.job_id &&
|
|
231
|
+
message == o.message &&
|
|
232
|
+
priority == o.priority &&
|
|
233
|
+
reason_code == o.reason_code &&
|
|
234
|
+
short_code == o.short_code &&
|
|
235
|
+
start_at == o.start_at
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# @see the `==` method
|
|
239
|
+
# @param [Object] Object to be compared
|
|
240
|
+
def eql?(o)
|
|
241
|
+
self == o
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Calculates hash code according to all attributes.
|
|
245
|
+
# @return [Integer] Hash code
|
|
246
|
+
def hash
|
|
247
|
+
[alternatives, blockers, customer_name, date, end_at, job_id, message, priority, reason_code, short_code, start_at].hash
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Builds the object from hash
|
|
251
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
252
|
+
# @return [Object] Returns the model itself
|
|
253
|
+
def self.build_from_hash(attributes)
|
|
254
|
+
return nil unless attributes.is_a?(Hash)
|
|
255
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
256
|
+
transformed_hash = {}
|
|
257
|
+
openapi_types.each_pair do |key, type|
|
|
258
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
259
|
+
transformed_hash["#{key}"] = nil
|
|
260
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
261
|
+
# check to ensure the input is an array given that the attribute
|
|
262
|
+
# is documented as an array but the input is not
|
|
263
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
264
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
265
|
+
end
|
|
266
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
267
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
new(transformed_hash)
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Deserializes the data based on type
|
|
274
|
+
# @param string type Data type
|
|
275
|
+
# @param string value Value to be deserialized
|
|
276
|
+
# @return [Object] Deserialized data
|
|
277
|
+
def self._deserialize(type, value)
|
|
278
|
+
case type.to_sym
|
|
279
|
+
when :Time
|
|
280
|
+
Time.parse(value)
|
|
281
|
+
when :Date
|
|
282
|
+
Date.parse(value)
|
|
283
|
+
when :String
|
|
284
|
+
value.to_s
|
|
285
|
+
when :Integer
|
|
286
|
+
value.to_i
|
|
287
|
+
when :Float
|
|
288
|
+
value.to_f
|
|
289
|
+
when :Boolean
|
|
290
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
291
|
+
true
|
|
292
|
+
else
|
|
293
|
+
false
|
|
294
|
+
end
|
|
295
|
+
when :Object
|
|
296
|
+
# generic object (usually a Hash), return directly
|
|
297
|
+
value
|
|
298
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
299
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
300
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
301
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
302
|
+
k_type = Regexp.last_match[:k_type]
|
|
303
|
+
v_type = Regexp.last_match[:v_type]
|
|
304
|
+
{}.tap do |hash|
|
|
305
|
+
value.each do |k, v|
|
|
306
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
else # model
|
|
310
|
+
# models (e.g. Pet) or oneOf
|
|
311
|
+
klass = Crisphive.const_get(type)
|
|
312
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# Returns the string representation of the object
|
|
317
|
+
# @return [String] String presentation of the object
|
|
318
|
+
def to_s
|
|
319
|
+
to_hash.to_s
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
323
|
+
# @return [Hash] Returns the object in the form of hash
|
|
324
|
+
def to_body
|
|
325
|
+
to_hash
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Returns the object in the form of hash
|
|
329
|
+
# @return [Hash] Returns the object in the form of hash
|
|
330
|
+
def to_hash
|
|
331
|
+
hash = {}
|
|
332
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
333
|
+
value = self.send(attr)
|
|
334
|
+
if value.nil?
|
|
335
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
336
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
hash[param] = _to_hash(value)
|
|
340
|
+
end
|
|
341
|
+
hash
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
# Outputs non-array value in the form of hash
|
|
345
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
346
|
+
# @param [Object] value Any valid value
|
|
347
|
+
# @return [Hash] Returns the value in the form of hash
|
|
348
|
+
def _to_hash(value)
|
|
349
|
+
if value.is_a?(Array)
|
|
350
|
+
value.compact.map { |v| _to_hash(v) }
|
|
351
|
+
elsif value.is_a?(Hash)
|
|
352
|
+
{}.tap do |hash|
|
|
353
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
354
|
+
end
|
|
355
|
+
elsif value.respond_to? :to_hash
|
|
356
|
+
value.to_hash
|
|
357
|
+
else
|
|
358
|
+
value
|
|
359
|
+
end
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
end
|
|
@@ -24,7 +24,7 @@ module Crisphive
|
|
|
24
24
|
# Action key (e.g. quote, confirm_booking, complete, or a custom DYNAMIC action).
|
|
25
25
|
attr_accessor :key
|
|
26
26
|
|
|
27
|
-
# Action label
|
|
27
|
+
# Action label as authored on the workflow (canonical; NOT resolved to the request locale).
|
|
28
28
|
attr_accessor :label
|
|
29
29
|
|
|
30
30
|
class EnumAttributeValidator
|
|
@@ -106,7 +106,7 @@ module Crisphive
|
|
|
106
106
|
# @return true if the model is valid
|
|
107
107
|
def valid?
|
|
108
108
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
109
|
-
reason_validator = EnumAttributeValidator.new('String', ["assignment_broken"])
|
|
109
|
+
reason_validator = EnumAttributeValidator.new('String', ["assignment_broken", "calendar_conflict"])
|
|
110
110
|
return false unless reason_validator.valid?(@reason)
|
|
111
111
|
true
|
|
112
112
|
end
|
|
@@ -114,7 +114,7 @@ module Crisphive
|
|
|
114
114
|
# Custom attribute writer method checking allowed values (enum).
|
|
115
115
|
# @param [Object] reason Object to be assigned
|
|
116
116
|
def reason=(reason)
|
|
117
|
-
validator = EnumAttributeValidator.new('String', ["assignment_broken"])
|
|
117
|
+
validator = EnumAttributeValidator.new('String', ["assignment_broken", "calendar_conflict"])
|
|
118
118
|
unless validator.valid?(reason)
|
|
119
119
|
fail ArgumentError, "invalid value for \"reason\", must be one of #{validator.allowable_values}."
|
|
120
120
|
end
|