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
@@ -15,6 +15,9 @@ require 'time'
15
15
 
16
16
  module Crisphive
17
17
  class JobRequestMovePreviewReq
18
+ # AfterHoursOverride — drop the non-working-day rejection for a P0 whose technician the coordinator has already phoned. P0 only (JOB_REQUEST_AFTER_HOURS_REQUIRES_P0 otherwise), and the preview then carries an AFTER_HOURS warning. Commit must repeat what the preview was run with.
19
+ attr_accessor :after_hours_override
20
+
18
21
  # Cascade mode for displaced jobs: overtime = stay same-day (tech works late); next_day = overflow rolls to the next working day.
19
22
  attr_accessor :mode
20
23
 
@@ -49,6 +52,7 @@ module Crisphive
49
52
  # Attribute mapping from ruby-style variable name to JSON key.
50
53
  def self.attribute_map
51
54
  {
55
+ :'after_hours_override' => :'after_hours_override',
52
56
  :'mode' => :'mode',
53
57
  :'start_at' => :'start_at',
54
58
  :'technician_id' => :'technician_id'
@@ -63,6 +67,7 @@ module Crisphive
63
67
  # Attribute type mapping.
64
68
  def self.openapi_types
65
69
  {
70
+ :'after_hours_override' => :'Boolean',
66
71
  :'mode' => :'String',
67
72
  :'start_at' => :'String',
68
73
  :'technician_id' => :'String'
@@ -90,6 +95,10 @@ module Crisphive
90
95
  h[k.to_sym] = v
91
96
  }
92
97
 
98
+ if attributes.key?(:'after_hours_override')
99
+ self.after_hours_override = attributes[:'after_hours_override']
100
+ end
101
+
93
102
  if attributes.key?(:'mode')
94
103
  self.mode = attributes[:'mode']
95
104
  else
@@ -156,6 +165,7 @@ module Crisphive
156
165
  def ==(o)
157
166
  return true if self.equal?(o)
158
167
  self.class == o.class &&
168
+ after_hours_override == o.after_hours_override &&
159
169
  mode == o.mode &&
160
170
  start_at == o.start_at &&
161
171
  technician_id == o.technician_id
@@ -170,7 +180,7 @@ module Crisphive
170
180
  # Calculates hash code according to all attributes.
171
181
  # @return [Integer] Hash code
172
182
  def hash
173
- [mode, start_at, technician_id].hash
183
+ [after_hours_override, mode, start_at, technician_id].hash
174
184
  end
175
185
 
176
186
  # Builds the object from hash
@@ -15,13 +15,19 @@ require 'time'
15
15
 
16
16
  module Crisphive
17
17
  class JobRequestMoveWarning
18
- # Warning kind: TECH_NOT_FEASIBLE | PUSHED_OUTSIDE_WINDOW | OVERTIME | TIME_OFF_OVERLAP | VEHICLE_CONFLICT.
18
+ # Every hard filter that refused the technician, most-structural first (TECH_NOT_FEASIBLE only). blockers[0] is the row Reason is derived from.
19
+ attr_accessor :blockers
20
+
21
+ # Warning kind: MOVED_OUTSIDE_WINDOW | TECH_NOT_FEASIBLE | PUSHED_OUTSIDE_WINDOW | OVERTIME | TIME_OFF_OVERLAP | CALENDAR_OVERLAP | VEHICLE_CONFLICT | AFTER_HOURS. CALENDAR_OVERLAP is a SEPARATE value from TIME_OFF_OVERLAP on purpose: approved time off is a record the coordinator can open, a personal calendar event is one we cannot see at all.
19
22
  attr_accessor :code
20
23
 
24
+ # MOVED_OUTSIDE_WINDOW only: the customer-confirmed business-local ranges the job was booked into, so the board can show what the customer requested next to the override warning.
25
+ attr_accessor :customer_window
26
+
21
27
  # First same-day time the target technician CAN be on site (UTC) — only with reason=cannot_arrive_in_time; suggest it as the drop slot.
22
28
  attr_accessor :earliest_feasible_at
23
29
 
24
- # The displaced job this warning is about (per-job warnings only).
30
+ # The job this warning is about (per-job warnings only).
25
31
  attr_accessor :job_id
26
32
 
27
33
  # Human-readable explanation.
@@ -30,7 +36,7 @@ module Crisphive
30
36
  # OVERTIME only: the largest overrun in minutes past the working-day end. Omitted otherwise.
31
37
  attr_accessor :minutes
32
38
 
33
- # Machine cause, TECH_NOT_FEASIBLE only: cannot_arrive_in_time (see earliest_feasible_at) | missing_required_skills | not_available_today | not_lead_tier.
39
+ # Machine cause, TECH_NOT_FEASIBLE only. Blockers[0].kind, or not_available_today when the diagnosis was unavailable. EXTEND-ONLY: a client switching on this MUST carry a default branch. calendar_conflict is the one value NOT in smartassign.BlockerKind: it is raised by the crew-assign path, never by ExplainInfeasibility, so it never appears in Blockers. A busy window on the technician's own PERSONAL calendar covers the visit. It is kept separate from on_time_off because approved leave is a record the coordinator can open and weigh, while this one is the obstacle we deliberately cannot see, so the action is a phone call. It may arrive alongside earliest_feasible_at.
34
40
  attr_accessor :reason
35
41
 
36
42
  class EnumAttributeValidator
@@ -58,7 +64,9 @@ module Crisphive
58
64
  # Attribute mapping from ruby-style variable name to JSON key.
59
65
  def self.attribute_map
60
66
  {
67
+ :'blockers' => :'blockers',
61
68
  :'code' => :'code',
69
+ :'customer_window' => :'customer_window',
62
70
  :'earliest_feasible_at' => :'earliest_feasible_at',
63
71
  :'job_id' => :'job_id',
64
72
  :'message' => :'message',
@@ -75,7 +83,9 @@ module Crisphive
75
83
  # Attribute type mapping.
76
84
  def self.openapi_types
77
85
  {
86
+ :'blockers' => :'Array<JobRequestBlocker>',
78
87
  :'code' => :'String',
88
+ :'customer_window' => :'Array<JobDateBusinessRange>',
79
89
  :'earliest_feasible_at' => :'Time',
80
90
  :'job_id' => :'String',
81
91
  :'message' => :'String',
@@ -105,10 +115,22 @@ module Crisphive
105
115
  h[k.to_sym] = v
106
116
  }
107
117
 
118
+ if attributes.key?(:'blockers')
119
+ if (value = attributes[:'blockers']).is_a?(Array)
120
+ self.blockers = value
121
+ end
122
+ end
123
+
108
124
  if attributes.key?(:'code')
109
125
  self.code = attributes[:'code']
110
126
  end
111
127
 
128
+ if attributes.key?(:'customer_window')
129
+ if (value = attributes[:'customer_window']).is_a?(Array)
130
+ self.customer_window = value
131
+ end
132
+ end
133
+
112
134
  if attributes.key?(:'earliest_feasible_at')
113
135
  self.earliest_feasible_at = attributes[:'earliest_feasible_at']
114
136
  end
@@ -142,9 +164,9 @@ module Crisphive
142
164
  # @return true if the model is valid
143
165
  def valid?
144
166
  warn '[DEPRECATED] the `valid?` method is obsolete'
145
- code_validator = EnumAttributeValidator.new('String', ["TECH_NOT_FEASIBLE", "PUSHED_OUTSIDE_WINDOW", "OVERTIME", "TIME_OFF_OVERLAP", "VEHICLE_CONFLICT"])
167
+ code_validator = EnumAttributeValidator.new('String', ["MOVED_OUTSIDE_WINDOW", "TECH_NOT_FEASIBLE", "PUSHED_OUTSIDE_WINDOW", "OVERTIME", "TIME_OFF_OVERLAP", "CALENDAR_OVERLAP", "VEHICLE_CONFLICT", "AFTER_HOURS"])
146
168
  return false unless code_validator.valid?(@code)
147
- reason_validator = EnumAttributeValidator.new('String', ["cannot_arrive_in_time", "missing_required_skills", "not_available_today", "not_lead_tier"])
169
+ reason_validator = EnumAttributeValidator.new('String', ["outside_service_area", "missing_required_skills", "not_lead_tier", "no_working_day", "on_time_off", "off_shift", "occupied", "visit_too_long", "cannot_arrive_in_time", "calendar_conflict", "not_available_today"])
148
170
  return false unless reason_validator.valid?(@reason)
149
171
  true
150
172
  end
@@ -152,7 +174,7 @@ module Crisphive
152
174
  # Custom attribute writer method checking allowed values (enum).
153
175
  # @param [Object] code Object to be assigned
154
176
  def code=(code)
155
- validator = EnumAttributeValidator.new('String', ["TECH_NOT_FEASIBLE", "PUSHED_OUTSIDE_WINDOW", "OVERTIME", "TIME_OFF_OVERLAP", "VEHICLE_CONFLICT"])
177
+ validator = EnumAttributeValidator.new('String', ["MOVED_OUTSIDE_WINDOW", "TECH_NOT_FEASIBLE", "PUSHED_OUTSIDE_WINDOW", "OVERTIME", "TIME_OFF_OVERLAP", "CALENDAR_OVERLAP", "VEHICLE_CONFLICT", "AFTER_HOURS"])
156
178
  unless validator.valid?(code)
157
179
  fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
158
180
  end
@@ -162,7 +184,7 @@ module Crisphive
162
184
  # Custom attribute writer method checking allowed values (enum).
163
185
  # @param [Object] reason Object to be assigned
164
186
  def reason=(reason)
165
- validator = EnumAttributeValidator.new('String', ["cannot_arrive_in_time", "missing_required_skills", "not_available_today", "not_lead_tier"])
187
+ validator = EnumAttributeValidator.new('String', ["outside_service_area", "missing_required_skills", "not_lead_tier", "no_working_day", "on_time_off", "off_shift", "occupied", "visit_too_long", "cannot_arrive_in_time", "calendar_conflict", "not_available_today"])
166
188
  unless validator.valid?(reason)
167
189
  fail ArgumentError, "invalid value for \"reason\", must be one of #{validator.allowable_values}."
168
190
  end
@@ -174,7 +196,9 @@ module Crisphive
174
196
  def ==(o)
175
197
  return true if self.equal?(o)
176
198
  self.class == o.class &&
199
+ blockers == o.blockers &&
177
200
  code == o.code &&
201
+ customer_window == o.customer_window &&
178
202
  earliest_feasible_at == o.earliest_feasible_at &&
179
203
  job_id == o.job_id &&
180
204
  message == o.message &&
@@ -191,7 +215,7 @@ module Crisphive
191
215
  # Calculates hash code according to all attributes.
192
216
  # @return [Integer] Hash code
193
217
  def hash
194
- [code, earliest_feasible_at, job_id, message, minutes, reason].hash
218
+ [blockers, code, customer_window, earliest_feasible_at, job_id, message, minutes, reason].hash
195
219
  end
196
220
 
197
221
  # Builds the object from hash
@@ -0,0 +1,217 @@
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 JobRequestPriorityUpdateResult
18
+ # AFTER_HOURS entries, one per session that sits outside the business's working hours after a change to p1/p2/p3. The priority change itself has already succeeded; the job was NOT moved. Typically a job placed on a closed day while it was p0, through the after-hours override: offer to move it back to a working day. Never present for p0.
19
+ attr_accessor :warnings
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'warnings' => :'warnings'
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
+ :'warnings' => :'Array<JobRequestMoveWarning>'
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::JobRequestPriorityUpdateResult` 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::JobRequestPriorityUpdateResult`. 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?(:'warnings')
62
+ if (value = attributes[:'warnings']).is_a?(Array)
63
+ self.warnings = value
64
+ end
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
72
+ invalid_properties = Array.new
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ warn '[DEPRECATED] the `valid?` method is obsolete'
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ warnings == o.warnings
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [warnings].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ attributes = attributes.transform_keys(&:to_sym)
109
+ transformed_hash = {}
110
+ openapi_types.each_pair do |key, type|
111
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
112
+ transformed_hash["#{key}"] = nil
113
+ elsif type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[attribute_map[key]].is_a?(Array)
117
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
118
+ end
119
+ elsif !attributes[attribute_map[key]].nil?
120
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
121
+ end
122
+ end
123
+ new(transformed_hash)
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def self._deserialize(type, value)
131
+ case type.to_sym
132
+ when :Time
133
+ Time.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ # models (e.g. Pet) or oneOf
164
+ klass = Crisphive.const_get(type)
165
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end
@@ -21,7 +21,10 @@ module Crisphive
21
21
  # Demobilization (teardown) minutes added after the work. Optional, min 0.
22
22
  attr_accessor :demobilization_minutes
23
23
 
24
- # Hands-on work duration in minutes (man-minutes for a crew job). Required, min 1.
24
+ # Schedule the job even when no technician can take it in ANY window the customer asked for (outside working hours, outside every service area, nobody free). Without it that case answers 409 JOB_REQUEST_QUOTE_NOT_SCHEDULABLE with the reason, so the coordinator can agree a different time with the customer first. Send true only after that conversation; the override is recorded in the activity feed. A p0 (emergency) job is EXEMPT: the check never runs for one, because a p0 is placed by the dispatcher (force-assign, displacement, after_hours_override) and never offered through the customer's slot picker — so `force` is neither needed nor recorded there.
25
+ attr_accessor :force
26
+
27
+ # Hands-on work duration in minutes (man-minutes for a crew job), min 1. On POST /quote it may be OMITTED when the job's job type carries a default_duration_minutes: the quote then uses the type's default duration and its default buffers (a buffer you send still wins). No duration and no default answers 400 JOB_REQUEST_QUOTE_INVALID. PATCH /quote always requires it.
25
28
  attr_accessor :job_duration_minutes
26
29
 
27
30
  # Mobilization (setup/travel-prep) minutes added before the work. Optional, min 0.
@@ -35,6 +38,7 @@ module Crisphive
35
38
  {
36
39
  :'crew' => :'crew',
37
40
  :'demobilization_minutes' => :'demobilization_minutes',
41
+ :'force' => :'force',
38
42
  :'job_duration_minutes' => :'job_duration_minutes',
39
43
  :'mobilization_minutes' => :'mobilization_minutes',
40
44
  :'status_version' => :'status_version'
@@ -51,6 +55,7 @@ module Crisphive
51
55
  {
52
56
  :'crew' => :'Array<JobRequestCrewMemberInput>',
53
57
  :'demobilization_minutes' => :'Integer',
58
+ :'force' => :'Boolean',
54
59
  :'job_duration_minutes' => :'Integer',
55
60
  :'mobilization_minutes' => :'Integer',
56
61
  :'status_version' => :'Integer'
@@ -88,10 +93,12 @@ module Crisphive
88
93
  self.demobilization_minutes = attributes[:'demobilization_minutes']
89
94
  end
90
95
 
96
+ if attributes.key?(:'force')
97
+ self.force = attributes[:'force']
98
+ end
99
+
91
100
  if attributes.key?(:'job_duration_minutes')
92
101
  self.job_duration_minutes = attributes[:'job_duration_minutes']
93
- else
94
- self.job_duration_minutes = nil
95
102
  end
96
103
 
97
104
  if attributes.key?(:'mobilization_minutes')
@@ -116,11 +123,7 @@ module Crisphive
116
123
  invalid_properties.push('invalid value for "demobilization_minutes", must be greater than or equal to 0.')
117
124
  end
118
125
 
119
- if @job_duration_minutes.nil?
120
- invalid_properties.push('invalid value for "job_duration_minutes", job_duration_minutes cannot be nil.')
121
- end
122
-
123
- if @job_duration_minutes < 1
126
+ if !@job_duration_minutes.nil? && @job_duration_minutes < 1
124
127
  invalid_properties.push('invalid value for "job_duration_minutes", must be greater than or equal to 1.')
125
128
  end
126
129
 
@@ -137,8 +140,7 @@ module Crisphive
137
140
  warn '[DEPRECATED] the `valid?` method is obsolete'
138
141
  return false if !@crew.nil? && @crew.length > 20
139
142
  return false if !@demobilization_minutes.nil? && @demobilization_minutes < 0
140
- return false if @job_duration_minutes.nil?
141
- return false if @job_duration_minutes < 1
143
+ return false if !@job_duration_minutes.nil? && @job_duration_minutes < 1
142
144
  return false if !@mobilization_minutes.nil? && @mobilization_minutes < 0
143
145
  true
144
146
  end
@@ -206,6 +208,7 @@ module Crisphive
206
208
  self.class == o.class &&
207
209
  crew == o.crew &&
208
210
  demobilization_minutes == o.demobilization_minutes &&
211
+ force == o.force &&
209
212
  job_duration_minutes == o.job_duration_minutes &&
210
213
  mobilization_minutes == o.mobilization_minutes &&
211
214
  status_version == o.status_version
@@ -220,7 +223,7 @@ module Crisphive
220
223
  # Calculates hash code according to all attributes.
221
224
  # @return [Integer] Hash code
222
225
  def hash
223
- [crew, demobilization_minutes, job_duration_minutes, mobilization_minutes, status_version].hash
226
+ [crew, demobilization_minutes, force, job_duration_minutes, mobilization_minutes, status_version].hash
224
227
  end
225
228
 
226
229
  # Builds the object from hash