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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +98 -10
  3. data/lib/crisphive/api/business_skill_api.rb +348 -0
  4. data/lib/crisphive/api/customer_api.rb +7 -4
  5. data/lib/crisphive/api/job_request_business_api.rb +243 -27
  6. data/lib/crisphive/api/job_types_api.rb +208 -0
  7. data/lib/crisphive/api/permission_api.rb +79 -0
  8. data/lib/crisphive/api/service_area_api.rb +208 -0
  9. data/lib/crisphive/api/technician_api.rb +8 -8
  10. data/lib/crisphive/api/technician_time_off_api.rb +240 -0
  11. data/lib/crisphive/api/vehicle_api.rb +208 -0
  12. data/lib/crisphive/api/webhooks_api.rb +213 -0
  13. data/lib/crisphive/models/api_internal_techtimeoff_actions.rb +232 -0
  14. data/lib/crisphive/models/api_internal_techtimeoff_status.rb +42 -0
  15. data/lib/crisphive/models/assignable_group.rb +289 -0
  16. data/lib/crisphive/models/book_and_confirm_job_request200_response.rb +253 -0
  17. data/lib/crisphive/models/commit_absence_resolve200_response.rb +253 -0
  18. data/lib/crisphive/models/create_job_type200_response.rb +253 -0
  19. data/lib/crisphive/models/create_service_area200_response.rb +253 -0
  20. data/lib/crisphive/models/create_skill200_response.rb +253 -0
  21. data/lib/crisphive/models/create_skill_category200_response.rb +253 -0
  22. data/lib/crisphive/models/create_technician_time_off200_response.rb +253 -0
  23. data/lib/crisphive/models/create_vehicle200_response.rb +253 -0
  24. data/lib/crisphive/models/create_webhook_endpoint200_response.rb +253 -0
  25. data/lib/crisphive/models/customer.rb +11 -1
  26. data/lib/crisphive/models/customer_contact.rb +25 -5
  27. data/lib/crisphive/models/customer_create_request.rb +12 -2
  28. data/lib/crisphive/models/customer_list_item.rb +11 -1
  29. data/lib/crisphive/models/customer_quick_books_link.rb +235 -0
  30. data/lib/crisphive/models/customer_service_area_ref.rb +225 -0
  31. data/lib/crisphive/models/customer_technician_ref.rb +225 -0
  32. data/lib/crisphive/models/customer_update_request.rb +23 -20
  33. data/lib/crisphive/models/internal_jobrequest_http_address_req.rb +475 -0
  34. data/lib/crisphive/models/job_request.rb +11 -1
  35. data/lib/crisphive/models/job_request_absence_alternative.rb +356 -0
  36. data/lib/crisphive/models/job_request_absence_alternative_cost.rb +275 -0
  37. data/lib/crisphive/models/job_request_absence_assignment.rb +319 -0
  38. data/lib/crisphive/models/job_request_absence_commit_request.rb +296 -0
  39. data/lib/crisphive/models/job_request_absence_notification.rb +283 -0
  40. data/lib/crisphive/models/job_request_absence_plan.rb +322 -0
  41. data/lib/crisphive/models/job_request_absence_preview_request.rb +280 -0
  42. data/lib/crisphive/models/job_request_absence_resolved_job.rb +499 -0
  43. data/lib/crisphive/models/job_request_absence_solver.rb +289 -0
  44. data/lib/crisphive/models/job_request_absence_time_off.rb +281 -0
  45. data/lib/crisphive/models/job_request_absence_unresolved_job.rb +364 -0
  46. data/lib/crisphive/models/job_request_action_summary.rb +1 -1
  47. data/lib/crisphive/models/job_request_attention_summary.rb +2 -2
  48. data/lib/crisphive/models/job_request_blocker.rb +363 -0
  49. data/lib/crisphive/models/job_request_blocker_ref.rb +223 -0
  50. data/lib/crisphive/models/job_request_book_and_confirm_customer.rb +302 -0
  51. data/lib/crisphive/models/job_request_book_and_confirm_emergency.rb +315 -0
  52. data/lib/crisphive/models/job_request_book_and_confirm_emergency_result.rb +279 -0
  53. data/lib/crisphive/models/job_request_book_and_confirm_refusal.rb +280 -0
  54. data/lib/crisphive/models/job_request_book_and_confirm_request.rb +466 -0
  55. data/lib/crisphive/models/job_request_book_and_confirm_response.rb +295 -0
  56. data/lib/crisphive/models/job_request_confirm_request.rb +14 -4
  57. data/lib/crisphive/models/job_request_create_request.rb +1 -1
  58. data/lib/crisphive/models/job_request_emergency_candidate.rb +26 -4
  59. data/lib/crisphive/models/job_request_emergency_candidates.rb +1 -1
  60. data/lib/crisphive/models/job_request_emergency_candidates_request.rb +24 -11
  61. data/lib/crisphive/models/job_request_emergency_commit_request.rb +11 -1
  62. data/lib/crisphive/models/job_request_emergency_inline_job.rb +353 -0
  63. data/lib/crisphive/models/job_request_emergency_plan.rb +25 -3
  64. data/lib/crisphive/models/job_request_emergency_preview_request.rb +24 -11
  65. data/lib/crisphive/models/job_request_move_commit_req.rb +11 -1
  66. data/lib/crisphive/models/job_request_move_plan.rb +11 -1
  67. data/lib/crisphive/models/job_request_move_preview_req.rb +11 -1
  68. data/lib/crisphive/models/job_request_move_warning.rb +32 -8
  69. data/lib/crisphive/models/job_request_priority_update_result.rb +217 -0
  70. data/lib/crisphive/models/job_request_quote_request.rb +14 -11
  71. data/lib/crisphive/models/job_request_reassign_fallback.rb +287 -0
  72. data/lib/crisphive/models/job_request_skill_summary.rb +1 -1
  73. data/lib/crisphive/models/job_request_status_summary.rb +1 -1
  74. data/lib/crisphive/models/job_request_time_segments.rb +2 -2
  75. data/lib/crisphive/models/job_type.rb +42 -2
  76. data/lib/crisphive/models/job_type_create_request.rb +399 -0
  77. data/lib/crisphive/models/job_type_create_response.rb +215 -0
  78. data/lib/crisphive/models/job_type_update_request.rb +400 -0
  79. data/lib/crisphive/models/list_assignable_groups200_response.rb +255 -0
  80. data/lib/crisphive/models/list_technician_time_off200_response.rb +253 -0
  81. data/lib/crisphive/models/list_webhook_event_types200_response.rb +255 -0
  82. data/lib/crisphive/models/quote_job_request200_response.rb +253 -0
  83. data/lib/crisphive/models/service_area.rb +21 -1
  84. data/lib/crisphive/models/service_area_create_request.rb +455 -0
  85. data/lib/crisphive/models/service_area_create_response.rb +215 -0
  86. data/lib/crisphive/models/service_area_update_request.rb +451 -0
  87. data/lib/crisphive/models/skill_category_create_request.rb +270 -0
  88. data/lib/crisphive/models/skill_category_create_response.rb +215 -0
  89. data/lib/crisphive/models/skill_create_request.rb +270 -0
  90. data/lib/crisphive/models/skill_create_response.rb +215 -0
  91. data/lib/crisphive/models/skill_update_request.rb +281 -0
  92. data/lib/crisphive/models/technician.rb +64 -2
  93. data/lib/crisphive/models/technician_create_request.rb +14 -11
  94. data/lib/crisphive/models/technician_time_off.rb +334 -0
  95. data/lib/crisphive/models/technician_time_off_create_request.rb +285 -0
  96. data/lib/crisphive/models/technician_time_off_create_response.rb +215 -0
  97. data/lib/crisphive/models/technician_time_off_list.rb +246 -0
  98. data/lib/crisphive/models/technician_update_request.rb +2 -2
  99. data/lib/crisphive/models/vehicle_create_request.rb +420 -0
  100. data/lib/crisphive/models/vehicle_create_response.rb +215 -0
  101. data/lib/crisphive/models/vehicle_update_request.rb +440 -0
  102. data/lib/crisphive/models/webhook_create_request.rb +320 -0
  103. data/lib/crisphive/models/webhook_create_response.rb +391 -0
  104. data/lib/crisphive/models/webhook_verification.rb +235 -0
  105. data/lib/crisphive/version.rb +1 -1
  106. data/lib/crisphive.rb +66 -0
  107. metadata +68 -2
@@ -0,0 +1,399 @@
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 JobTypeCreateRequest
18
+ # Default demobilization (teardown) minutes, 0–1440; used together with the default duration. Requires a default duration. Omit or 0 = no default.
19
+ attr_accessor :default_demobilization_minutes
20
+
21
+ # Default hands-on work duration in minutes for this kind of work (1–20160). A quote that sends no job_duration_minutes uses it, which is what lets an automation or voice agent schedule a job without knowing how long the work takes. Omit or 0 = no default.
22
+ attr_accessor :default_duration_minutes
23
+
24
+ # Default mobilization (setup/travel-prep) minutes, 0–1440; used together with the default duration. Requires a default duration. Omit or 0 = no default.
25
+ attr_accessor :default_mobilization_minutes
26
+
27
+ # Job-type name (required) — what the booking form shows as the kind of work. Stored as the canonical English value; per-locale names are a dashboard authoring feature.
28
+ attr_accessor :name
29
+
30
+ # Lifecycle status. Defaults to active; inactive types cannot be selected for new job requests.
31
+ attr_accessor :status
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'default_demobilization_minutes' => :'default_demobilization_minutes',
59
+ :'default_duration_minutes' => :'default_duration_minutes',
60
+ :'default_mobilization_minutes' => :'default_mobilization_minutes',
61
+ :'name' => :'name',
62
+ :'status' => :'status'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'default_demobilization_minutes' => :'Integer',
75
+ :'default_duration_minutes' => :'Integer',
76
+ :'default_mobilization_minutes' => :'Integer',
77
+ :'name' => :'String',
78
+ :'status' => :'String'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobTypeCreateRequest` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!self.class.attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobTypeCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'default_demobilization_minutes')
104
+ self.default_demobilization_minutes = attributes[:'default_demobilization_minutes']
105
+ end
106
+
107
+ if attributes.key?(:'default_duration_minutes')
108
+ self.default_duration_minutes = attributes[:'default_duration_minutes']
109
+ end
110
+
111
+ if attributes.key?(:'default_mobilization_minutes')
112
+ self.default_mobilization_minutes = attributes[:'default_mobilization_minutes']
113
+ end
114
+
115
+ if attributes.key?(:'name')
116
+ self.name = attributes[:'name']
117
+ else
118
+ self.name = nil
119
+ end
120
+
121
+ if attributes.key?(:'status')
122
+ self.status = attributes[:'status']
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
130
+ invalid_properties = Array.new
131
+ if !@default_demobilization_minutes.nil? && @default_demobilization_minutes > 1440
132
+ invalid_properties.push('invalid value for "default_demobilization_minutes", must be smaller than or equal to 1440.')
133
+ end
134
+
135
+ if !@default_demobilization_minutes.nil? && @default_demobilization_minutes < 0
136
+ invalid_properties.push('invalid value for "default_demobilization_minutes", must be greater than or equal to 0.')
137
+ end
138
+
139
+ if !@default_duration_minutes.nil? && @default_duration_minutes > 20160
140
+ invalid_properties.push('invalid value for "default_duration_minutes", must be smaller than or equal to 20160.')
141
+ end
142
+
143
+ if !@default_duration_minutes.nil? && @default_duration_minutes < 0
144
+ invalid_properties.push('invalid value for "default_duration_minutes", must be greater than or equal to 0.')
145
+ end
146
+
147
+ if !@default_mobilization_minutes.nil? && @default_mobilization_minutes > 1440
148
+ invalid_properties.push('invalid value for "default_mobilization_minutes", must be smaller than or equal to 1440.')
149
+ end
150
+
151
+ if !@default_mobilization_minutes.nil? && @default_mobilization_minutes < 0
152
+ invalid_properties.push('invalid value for "default_mobilization_minutes", must be greater than or equal to 0.')
153
+ end
154
+
155
+ if @name.nil?
156
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
157
+ end
158
+
159
+ if @name.to_s.length > 255
160
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
161
+ end
162
+
163
+ invalid_properties
164
+ end
165
+
166
+ # Check to see if the all the properties in the model are valid
167
+ # @return true if the model is valid
168
+ def valid?
169
+ warn '[DEPRECATED] the `valid?` method is obsolete'
170
+ return false if !@default_demobilization_minutes.nil? && @default_demobilization_minutes > 1440
171
+ return false if !@default_demobilization_minutes.nil? && @default_demobilization_minutes < 0
172
+ return false if !@default_duration_minutes.nil? && @default_duration_minutes > 20160
173
+ return false if !@default_duration_minutes.nil? && @default_duration_minutes < 0
174
+ return false if !@default_mobilization_minutes.nil? && @default_mobilization_minutes > 1440
175
+ return false if !@default_mobilization_minutes.nil? && @default_mobilization_minutes < 0
176
+ return false if @name.nil?
177
+ return false if @name.to_s.length > 255
178
+ status_validator = EnumAttributeValidator.new('String', ["active", "inactive"])
179
+ return false unless status_validator.valid?(@status)
180
+ true
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] default_demobilization_minutes Value to be assigned
185
+ def default_demobilization_minutes=(default_demobilization_minutes)
186
+ if default_demobilization_minutes.nil?
187
+ fail ArgumentError, 'default_demobilization_minutes cannot be nil'
188
+ end
189
+
190
+ if default_demobilization_minutes > 1440
191
+ fail ArgumentError, 'invalid value for "default_demobilization_minutes", must be smaller than or equal to 1440.'
192
+ end
193
+
194
+ if default_demobilization_minutes < 0
195
+ fail ArgumentError, 'invalid value for "default_demobilization_minutes", must be greater than or equal to 0.'
196
+ end
197
+
198
+ @default_demobilization_minutes = default_demobilization_minutes
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] default_duration_minutes Value to be assigned
203
+ def default_duration_minutes=(default_duration_minutes)
204
+ if default_duration_minutes.nil?
205
+ fail ArgumentError, 'default_duration_minutes cannot be nil'
206
+ end
207
+
208
+ if default_duration_minutes > 20160
209
+ fail ArgumentError, 'invalid value for "default_duration_minutes", must be smaller than or equal to 20160.'
210
+ end
211
+
212
+ if default_duration_minutes < 0
213
+ fail ArgumentError, 'invalid value for "default_duration_minutes", must be greater than or equal to 0.'
214
+ end
215
+
216
+ @default_duration_minutes = default_duration_minutes
217
+ end
218
+
219
+ # Custom attribute writer method with validation
220
+ # @param [Object] default_mobilization_minutes Value to be assigned
221
+ def default_mobilization_minutes=(default_mobilization_minutes)
222
+ if default_mobilization_minutes.nil?
223
+ fail ArgumentError, 'default_mobilization_minutes cannot be nil'
224
+ end
225
+
226
+ if default_mobilization_minutes > 1440
227
+ fail ArgumentError, 'invalid value for "default_mobilization_minutes", must be smaller than or equal to 1440.'
228
+ end
229
+
230
+ if default_mobilization_minutes < 0
231
+ fail ArgumentError, 'invalid value for "default_mobilization_minutes", must be greater than or equal to 0.'
232
+ end
233
+
234
+ @default_mobilization_minutes = default_mobilization_minutes
235
+ end
236
+
237
+ # Custom attribute writer method with validation
238
+ # @param [Object] name Value to be assigned
239
+ def name=(name)
240
+ if name.nil?
241
+ fail ArgumentError, 'name cannot be nil'
242
+ end
243
+
244
+ if name.to_s.length > 255
245
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 255.'
246
+ end
247
+
248
+ @name = name
249
+ end
250
+
251
+ # Custom attribute writer method checking allowed values (enum).
252
+ # @param [Object] status Object to be assigned
253
+ def status=(status)
254
+ validator = EnumAttributeValidator.new('String', ["active", "inactive"])
255
+ unless validator.valid?(status)
256
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
257
+ end
258
+ @status = status
259
+ end
260
+
261
+ # Checks equality by comparing each attribute.
262
+ # @param [Object] Object to be compared
263
+ def ==(o)
264
+ return true if self.equal?(o)
265
+ self.class == o.class &&
266
+ default_demobilization_minutes == o.default_demobilization_minutes &&
267
+ default_duration_minutes == o.default_duration_minutes &&
268
+ default_mobilization_minutes == o.default_mobilization_minutes &&
269
+ name == o.name &&
270
+ status == o.status
271
+ end
272
+
273
+ # @see the `==` method
274
+ # @param [Object] Object to be compared
275
+ def eql?(o)
276
+ self == o
277
+ end
278
+
279
+ # Calculates hash code according to all attributes.
280
+ # @return [Integer] Hash code
281
+ def hash
282
+ [default_demobilization_minutes, default_duration_minutes, default_mobilization_minutes, name, status].hash
283
+ end
284
+
285
+ # Builds the object from hash
286
+ # @param [Hash] attributes Model attributes in the form of hash
287
+ # @return [Object] Returns the model itself
288
+ def self.build_from_hash(attributes)
289
+ return nil unless attributes.is_a?(Hash)
290
+ attributes = attributes.transform_keys(&:to_sym)
291
+ transformed_hash = {}
292
+ openapi_types.each_pair do |key, type|
293
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
294
+ transformed_hash["#{key}"] = nil
295
+ elsif type =~ /\AArray<(.*)>/i
296
+ # check to ensure the input is an array given that the attribute
297
+ # is documented as an array but the input is not
298
+ if attributes[attribute_map[key]].is_a?(Array)
299
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
300
+ end
301
+ elsif !attributes[attribute_map[key]].nil?
302
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
303
+ end
304
+ end
305
+ new(transformed_hash)
306
+ end
307
+
308
+ # Deserializes the data based on type
309
+ # @param string type Data type
310
+ # @param string value Value to be deserialized
311
+ # @return [Object] Deserialized data
312
+ def self._deserialize(type, value)
313
+ case type.to_sym
314
+ when :Time
315
+ Time.parse(value)
316
+ when :Date
317
+ Date.parse(value)
318
+ when :String
319
+ value.to_s
320
+ when :Integer
321
+ value.to_i
322
+ when :Float
323
+ value.to_f
324
+ when :Boolean
325
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
326
+ true
327
+ else
328
+ false
329
+ end
330
+ when :Object
331
+ # generic object (usually a Hash), return directly
332
+ value
333
+ when /\AArray<(?<inner_type>.+)>\z/
334
+ inner_type = Regexp.last_match[:inner_type]
335
+ value.map { |v| _deserialize(inner_type, v) }
336
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
337
+ k_type = Regexp.last_match[:k_type]
338
+ v_type = Regexp.last_match[:v_type]
339
+ {}.tap do |hash|
340
+ value.each do |k, v|
341
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
342
+ end
343
+ end
344
+ else # model
345
+ # models (e.g. Pet) or oneOf
346
+ klass = Crisphive.const_get(type)
347
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
348
+ end
349
+ end
350
+
351
+ # Returns the string representation of the object
352
+ # @return [String] String presentation of the object
353
+ def to_s
354
+ to_hash.to_s
355
+ end
356
+
357
+ # to_body is an alias to to_hash (backward compatibility)
358
+ # @return [Hash] Returns the object in the form of hash
359
+ def to_body
360
+ to_hash
361
+ end
362
+
363
+ # Returns the object in the form of hash
364
+ # @return [Hash] Returns the object in the form of hash
365
+ def to_hash
366
+ hash = {}
367
+ self.class.attribute_map.each_pair do |attr, param|
368
+ value = self.send(attr)
369
+ if value.nil?
370
+ is_nullable = self.class.openapi_nullable.include?(attr)
371
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
372
+ end
373
+
374
+ hash[param] = _to_hash(value)
375
+ end
376
+ hash
377
+ end
378
+
379
+ # Outputs non-array value in the form of hash
380
+ # For object, use to_hash. Otherwise, just return the value
381
+ # @param [Object] value Any valid value
382
+ # @return [Hash] Returns the value in the form of hash
383
+ def _to_hash(value)
384
+ if value.is_a?(Array)
385
+ value.compact.map { |v| _to_hash(v) }
386
+ elsif value.is_a?(Hash)
387
+ {}.tap do |hash|
388
+ value.each { |k, v| hash[k] = _to_hash(v) }
389
+ end
390
+ elsif value.respond_to? :to_hash
391
+ value.to_hash
392
+ else
393
+ value
394
+ end
395
+ end
396
+
397
+ end
398
+
399
+ end
@@ -0,0 +1,215 @@
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 JobTypeCreateResponse
18
+ # UUID of the created job type — usable immediately as job_type_id on POST /job-requests.
19
+ attr_accessor :id
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'id' => :'id'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'id' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobTypeCreateResponse` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobTypeCreateResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'id')
62
+ self.id = attributes[:'id']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ id == o.id
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [id].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def self.build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ attributes = attributes.transform_keys(&:to_sym)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
111
+ elsif type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
116
+ end
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
119
+ end
120
+ end
121
+ new(transformed_hash)
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def self._deserialize(type, value)
129
+ case type.to_sym
130
+ when :Time
131
+ Time.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ # models (e.g. Pet) or oneOf
162
+ klass = Crisphive.const_get(type)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+
213
+ end
214
+
215
+ end