crisphive 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +183 -16
  3. data/crisphive.gemspec +5 -5
  4. data/lib/crisphive/api/business_skill_api.rb +502 -8
  5. data/lib/crisphive/api/customer_api.rb +20 -14
  6. data/lib/crisphive/api/job_request_business_api.rb +1273 -167
  7. data/lib/crisphive/api/job_types_api.rb +214 -2
  8. data/lib/crisphive/api/permission_api.rb +79 -0
  9. data/lib/crisphive/api/service_area_api.rb +214 -6
  10. data/lib/crisphive/api/technician_api.rb +510 -6
  11. data/lib/crisphive/api/technician_time_off_api.rb +240 -0
  12. data/lib/crisphive/api/vehicle_api.rb +214 -6
  13. data/lib/crisphive/api/webhooks_api.rb +213 -0
  14. data/lib/crisphive/api_client.rb +2 -2
  15. data/lib/crisphive/api_error.rb +2 -2
  16. data/lib/crisphive/configuration.rb +3 -3
  17. data/lib/crisphive/models/api_internal_techtimeoff_actions.rb +232 -0
  18. data/lib/crisphive/models/api_internal_techtimeoff_status.rb +42 -0
  19. data/lib/crisphive/models/assignable_group.rb +289 -0
  20. data/lib/crisphive/models/book_and_confirm_job_request200_response.rb +253 -0
  21. data/lib/crisphive/models/commit_absence_resolve200_response.rb +253 -0
  22. data/lib/crisphive/models/commit_emergency_reschedule200_response.rb +253 -0
  23. data/lib/crisphive/models/commit_job_request_move200_response.rb +253 -0
  24. data/lib/crisphive/models/create_customer200_response.rb +5 -2
  25. data/lib/crisphive/models/create_job_request200_response.rb +5 -2
  26. data/lib/crisphive/models/create_job_type200_response.rb +253 -0
  27. data/lib/crisphive/models/create_service_area200_response.rb +253 -0
  28. data/lib/crisphive/models/create_skill200_response.rb +253 -0
  29. data/lib/crisphive/models/create_skill_category200_response.rb +253 -0
  30. data/lib/crisphive/models/create_technician200_response.rb +253 -0
  31. data/lib/crisphive/models/create_technician_time_off200_response.rb +253 -0
  32. data/lib/crisphive/models/create_vehicle200_response.rb +253 -0
  33. data/lib/crisphive/models/create_webhook_endpoint200_response.rb +253 -0
  34. data/lib/crisphive/models/customer.rb +13 -3
  35. data/lib/crisphive/models/customer_address.rb +2 -2
  36. data/lib/crisphive/models/customer_address_request.rb +11 -2
  37. data/lib/crisphive/models/customer_contact.rb +27 -7
  38. data/lib/crisphive/models/customer_create_request.rb +14 -4
  39. data/lib/crisphive/models/customer_create_response.rb +2 -2
  40. data/lib/crisphive/models/customer_list.rb +3 -3
  41. data/lib/crisphive/models/customer_list_item.rb +13 -3
  42. data/lib/crisphive/models/customer_profile.rb +2 -2
  43. data/lib/crisphive/models/customer_quick_books_link.rb +235 -0
  44. data/lib/crisphive/models/customer_service_area_ref.rb +225 -0
  45. data/lib/crisphive/models/customer_spending.rb +2 -2
  46. data/lib/crisphive/models/customer_technician_ref.rb +225 -0
  47. data/lib/crisphive/models/customer_tier_progress.rb +2 -2
  48. data/lib/crisphive/models/customer_update_request.rb +25 -22
  49. data/lib/crisphive/models/get_customer200_response.rb +5 -2
  50. data/lib/crisphive/models/get_job_request200_response.rb +5 -2
  51. data/lib/crisphive/models/get_job_request_timeline200_response.rb +5 -2
  52. data/lib/crisphive/models/get_job_type200_response.rb +5 -2
  53. data/lib/crisphive/models/get_service_area200_response.rb +5 -2
  54. data/lib/crisphive/models/get_technician200_response.rb +5 -2
  55. data/lib/crisphive/models/get_technician_schedule200_response.rb +253 -0
  56. data/lib/crisphive/models/get_vehicle200_response.rb +5 -2
  57. data/lib/crisphive/models/internal_jobrequest_http_address_req.rb +475 -0
  58. data/lib/crisphive/models/job_date.rb +5 -3
  59. data/lib/crisphive/models/job_date_business_range.rb +7 -3
  60. data/lib/crisphive/models/job_date_period.rb +2 -2
  61. data/lib/crisphive/models/job_date_period_entry.rb +4 -2
  62. data/lib/crisphive/models/job_request.rb +56 -6
  63. data/lib/crisphive/models/job_request_absence_alternative.rb +356 -0
  64. data/lib/crisphive/models/job_request_absence_alternative_cost.rb +275 -0
  65. data/lib/crisphive/models/job_request_absence_assignment.rb +319 -0
  66. data/lib/crisphive/models/job_request_absence_commit_request.rb +296 -0
  67. data/lib/crisphive/models/job_request_absence_notification.rb +283 -0
  68. data/lib/crisphive/models/job_request_absence_plan.rb +322 -0
  69. data/lib/crisphive/models/job_request_absence_preview_request.rb +280 -0
  70. data/lib/crisphive/models/job_request_absence_resolved_job.rb +499 -0
  71. data/lib/crisphive/models/job_request_absence_solver.rb +289 -0
  72. data/lib/crisphive/models/job_request_absence_time_off.rb +281 -0
  73. data/lib/crisphive/models/job_request_absence_unresolved_job.rb +364 -0
  74. data/lib/crisphive/models/job_request_action_audit_by.rb +2 -2
  75. data/lib/crisphive/models/job_request_action_audit_entry.rb +3 -3
  76. data/lib/crisphive/models/job_request_action_summary.rb +3 -3
  77. data/lib/crisphive/models/job_request_address_summary.rb +2 -2
  78. data/lib/crisphive/models/job_request_archive_summary.rb +2 -2
  79. data/lib/crisphive/models/job_request_arrival_window.rb +4 -4
  80. data/lib/crisphive/models/job_request_assigned_vehicle.rb +2 -2
  81. data/lib/crisphive/models/job_request_assignment_summary.rb +2 -2
  82. data/lib/crisphive/models/job_request_attention_summary.rb +259 -0
  83. data/lib/crisphive/models/job_request_available_vehicle.rb +235 -0
  84. data/lib/crisphive/models/job_request_blocker.rb +363 -0
  85. data/lib/crisphive/models/job_request_blocker_ref.rb +223 -0
  86. data/lib/crisphive/models/job_request_book_and_confirm_customer.rb +302 -0
  87. data/lib/crisphive/models/job_request_book_and_confirm_emergency.rb +315 -0
  88. data/lib/crisphive/models/job_request_book_and_confirm_emergency_result.rb +279 -0
  89. data/lib/crisphive/models/job_request_book_and_confirm_refusal.rb +280 -0
  90. data/lib/crisphive/models/job_request_book_and_confirm_request.rb +466 -0
  91. data/lib/crisphive/models/job_request_book_and_confirm_response.rb +295 -0
  92. data/lib/crisphive/models/job_request_booking_windows.rb +2 -2
  93. data/lib/crisphive/models/job_request_buddy_slot_candidates.rb +239 -0
  94. data/lib/crisphive/models/job_request_business_time_range.rb +3 -3
  95. data/lib/crisphive/models/job_request_changes.rb +2 -2
  96. data/lib/crisphive/models/job_request_confirm_request.rb +255 -0
  97. data/lib/crisphive/models/job_request_create_request.rb +61 -7
  98. data/lib/crisphive/models/job_request_create_response.rb +2 -2
  99. data/lib/crisphive/models/job_request_crew_candidates.rb +227 -0
  100. data/lib/crisphive/models/job_request_crew_change.rb +299 -0
  101. data/lib/crisphive/models/job_request_crew_member.rb +7 -4
  102. data/lib/crisphive/models/job_request_crew_member_input.rb +284 -0
  103. data/lib/crisphive/models/job_request_crew_recommendation.rb +255 -0
  104. data/lib/crisphive/models/job_request_customer_summary.rb +2 -2
  105. data/lib/crisphive/models/job_request_day_windows.rb +3 -3
  106. data/lib/crisphive/models/job_request_emergency_candidate.rb +319 -0
  107. data/lib/crisphive/models/job_request_emergency_candidates.rb +311 -0
  108. data/lib/crisphive/models/job_request_emergency_candidates_request.rb +341 -0
  109. data/lib/crisphive/models/job_request_emergency_commit_request.rb +361 -0
  110. data/lib/crisphive/models/job_request_emergency_inline_job.rb +353 -0
  111. data/lib/crisphive/models/job_request_emergency_plan.rb +367 -0
  112. data/lib/crisphive/models/job_request_emergency_preview_request.rb +342 -0
  113. data/lib/crisphive/models/job_request_job_date_business_range_request.rb +3 -3
  114. data/lib/crisphive/models/job_request_job_date_period_request.rb +2 -2
  115. data/lib/crisphive/models/job_request_job_date_request.rb +3 -3
  116. data/lib/crisphive/models/job_request_lead_candidate.rb +311 -0
  117. data/lib/crisphive/models/job_request_list.rb +2 -2
  118. data/lib/crisphive/models/job_request_move_commit_req.rb +353 -0
  119. data/lib/crisphive/models/job_request_move_member.rb +299 -0
  120. data/lib/crisphive/models/job_request_move_plan.rb +387 -0
  121. data/lib/crisphive/models/job_request_move_preview_req.rb +300 -0
  122. data/lib/crisphive/models/job_request_move_warning.rb +335 -0
  123. data/lib/crisphive/models/job_request_period.rb +2 -2
  124. data/lib/crisphive/models/job_request_priority_update_result.rb +217 -0
  125. data/lib/crisphive/models/job_request_quote_request.rb +343 -0
  126. data/lib/crisphive/models/job_request_quote_summary.rb +2 -2
  127. data/lib/crisphive/models/job_request_rating_summary.rb +2 -2
  128. data/lib/crisphive/models/job_request_reassign_fallback.rb +287 -0
  129. data/lib/crisphive/models/job_request_reschedule_day.rb +227 -0
  130. data/lib/crisphive/models/job_request_reschedule_move.rb +319 -0
  131. data/lib/crisphive/models/job_request_reschedule_reassignment.rb +339 -0
  132. data/lib/crisphive/models/job_request_schedule.rb +2 -2
  133. data/lib/crisphive/models/job_request_session.rb +8 -7
  134. data/lib/crisphive/models/job_request_skill_summary.rb +3 -3
  135. data/lib/crisphive/models/job_request_status_summary.rb +3 -3
  136. data/lib/crisphive/models/job_request_tech_candidate.rb +287 -0
  137. data/lib/crisphive/models/job_request_technician_info.rb +2 -2
  138. data/lib/crisphive/models/job_request_time_segments.rb +287 -0
  139. data/lib/crisphive/models/job_request_time_segments_business_time.rb +321 -0
  140. data/lib/crisphive/models/job_request_time_segments_day.rb +247 -0
  141. data/lib/crisphive/models/job_request_time_segments_slot.rb +375 -0
  142. data/lib/crisphive/models/job_request_time_segments_worker.rb +295 -0
  143. data/lib/crisphive/models/job_request_timeline.rb +2 -2
  144. data/lib/crisphive/models/job_request_timeline_action.rb +2 -2
  145. data/lib/crisphive/models/job_request_timeline_event.rb +2 -2
  146. data/lib/crisphive/models/job_request_update_priority_request.rb +295 -0
  147. data/lib/crisphive/models/job_type.rb +44 -4
  148. data/lib/crisphive/models/job_type_create_request.rb +399 -0
  149. data/lib/crisphive/models/job_type_create_response.rb +215 -0
  150. data/lib/crisphive/models/job_type_update_request.rb +400 -0
  151. data/lib/crisphive/models/list_assignable_groups200_response.rb +255 -0
  152. data/lib/crisphive/models/list_crew_candidates200_response.rb +253 -0
  153. data/lib/crisphive/models/list_customers200_response.rb +5 -2
  154. data/lib/crisphive/models/list_emergency_candidates200_response.rb +253 -0
  155. data/lib/crisphive/models/list_job_request_booking_windows200_response.rb +5 -2
  156. data/lib/crisphive/models/list_job_request_changes200_response.rb +5 -2
  157. data/lib/crisphive/models/list_job_requests200_response.rb +5 -2
  158. data/lib/crisphive/models/list_job_types200_response.rb +5 -2
  159. data/lib/crisphive/models/list_matching_slots200_response.rb +253 -0
  160. data/lib/crisphive/models/list_nearby_technicians200_response.rb +253 -0
  161. data/lib/crisphive/models/list_service_areas200_response.rb +5 -2
  162. data/lib/crisphive/models/list_skill_categories200_response.rb +5 -2
  163. data/lib/crisphive/models/list_skills200_response.rb +5 -2
  164. data/lib/crisphive/models/list_skills_by_category200_response.rb +5 -2
  165. data/lib/crisphive/models/list_technician_skills200_response.rb +253 -0
  166. data/lib/crisphive/models/list_technician_time_off200_response.rb +253 -0
  167. data/lib/crisphive/models/list_technicians200_response.rb +5 -2
  168. data/lib/crisphive/models/list_vehicles200_response.rb +5 -2
  169. data/lib/crisphive/models/list_webhook_event_types200_response.rb +255 -0
  170. data/lib/crisphive/models/nearby_technician.rb +319 -0
  171. data/lib/crisphive/models/nearby_technicians.rb +237 -0
  172. data/lib/crisphive/models/pagination.rb +7 -2
  173. data/lib/crisphive/models/quote_job_request200_response.rb +253 -0
  174. data/lib/crisphive/models/replace_technician_service_areas200_response.rb +253 -0
  175. data/lib/crisphive/models/response_envelope.rb +6 -2
  176. data/lib/crisphive/models/service_area.rb +23 -3
  177. data/lib/crisphive/models/service_area_create_request.rb +455 -0
  178. data/lib/crisphive/models/service_area_create_response.rb +215 -0
  179. data/lib/crisphive/models/service_area_list.rb +2 -2
  180. data/lib/crisphive/models/service_area_update_request.rb +451 -0
  181. data/lib/crisphive/models/skill.rb +9 -2
  182. data/lib/crisphive/models/skill_by_category_list.rb +4 -2
  183. data/lib/crisphive/models/skill_category.rb +7 -2
  184. data/lib/crisphive/models/skill_category_create_request.rb +270 -0
  185. data/lib/crisphive/models/skill_category_create_response.rb +215 -0
  186. data/lib/crisphive/models/skill_category_list.rb +4 -2
  187. data/lib/crisphive/models/skill_create_request.rb +270 -0
  188. data/lib/crisphive/models/skill_create_response.rb +215 -0
  189. data/lib/crisphive/models/skill_list.rb +2 -2
  190. data/lib/crisphive/models/skill_summary.rb +2 -2
  191. data/lib/crisphive/models/skill_update_request.rb +281 -0
  192. data/lib/crisphive/models/technician.rb +66 -4
  193. data/lib/crisphive/models/technician_address.rb +2 -2
  194. data/lib/crisphive/models/technician_address_input.rb +408 -0
  195. data/lib/crisphive/models/technician_buddies_request.rb +236 -0
  196. data/lib/crisphive/models/technician_create_request.rb +603 -0
  197. data/lib/crisphive/models/technician_create_response.rb +215 -0
  198. data/lib/crisphive/models/technician_lead_ref.rb +2 -2
  199. data/lib/crisphive/models/technician_leads_request.rb +236 -0
  200. data/lib/crisphive/models/technician_list.rb +3 -3
  201. data/lib/crisphive/models/technician_schedule.rb +279 -0
  202. data/lib/crisphive/models/technician_schedule_block.rb +225 -0
  203. data/lib/crisphive/models/technician_schedule_session.rb +311 -0
  204. data/lib/crisphive/models/technician_service_area_ref.rb +2 -2
  205. data/lib/crisphive/models/technician_service_areas_request.rb +236 -0
  206. data/lib/crisphive/models/technician_service_areas_response.rb +217 -0
  207. data/lib/crisphive/models/technician_skill.rb +265 -0
  208. data/lib/crisphive/models/technician_skill_list.rb +227 -0
  209. data/lib/crisphive/models/technician_skills_request.rb +236 -0
  210. data/lib/crisphive/models/technician_status.rb +2 -2
  211. data/lib/crisphive/models/technician_time_off.rb +334 -0
  212. data/lib/crisphive/models/technician_time_off_create_request.rb +285 -0
  213. data/lib/crisphive/models/technician_time_off_create_response.rb +215 -0
  214. data/lib/crisphive/models/technician_time_off_list.rb +246 -0
  215. data/lib/crisphive/models/technician_update_request.rb +507 -0
  216. data/lib/crisphive/models/technician_vehicles_request.rb +236 -0
  217. data/lib/crisphive/models/vehicle.rb +26 -4
  218. data/lib/crisphive/models/vehicle_create_request.rb +420 -0
  219. data/lib/crisphive/models/vehicle_create_response.rb +215 -0
  220. data/lib/crisphive/models/vehicle_list.rb +2 -2
  221. data/lib/crisphive/models/vehicle_owner.rb +2 -2
  222. data/lib/crisphive/models/vehicle_update_request.rb +440 -0
  223. data/lib/crisphive/models/webhook_create_request.rb +320 -0
  224. data/lib/crisphive/models/webhook_create_response.rb +391 -0
  225. data/lib/crisphive/models/webhook_verification.rb +235 -0
  226. data/lib/crisphive/version.rb +3 -3
  227. data/lib/crisphive.rb +126 -2
  228. data/spec/spec_helper.rb +2 -2
  229. metadata +129 -5
@@ -0,0 +1,299 @@
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 JobRequestCrewChange
18
+ # Full name of the member being replaced. Omitted when unresolved.
19
+ attr_accessor :from_name
20
+
21
+ # UUID of the member being replaced (busy/infeasible at the new time).
22
+ attr_accessor :from_technician_id
23
+
24
+ # Role of the slot: lead | buddy.
25
+ attr_accessor :role
26
+
27
+ # Crew slot index (0 = lead).
28
+ attr_accessor :slot
29
+
30
+ # Full name of the proposed replacement. Omitted when unresolved.
31
+ attr_accessor :to_name
32
+
33
+ # UUID of the proposed replacement.
34
+ attr_accessor :to_technician_id
35
+
36
+ class EnumAttributeValidator
37
+ attr_reader :datatype
38
+ attr_reader :allowable_values
39
+
40
+ def initialize(datatype, allowable_values)
41
+ @allowable_values = allowable_values.map do |value|
42
+ case datatype.to_s
43
+ when /Integer/i
44
+ value.to_i
45
+ when /Float/i
46
+ value.to_f
47
+ else
48
+ value
49
+ end
50
+ end
51
+ end
52
+
53
+ def valid?(value)
54
+ !value || allowable_values.include?(value)
55
+ end
56
+ end
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'from_name' => :'from_name',
62
+ :'from_technician_id' => :'from_technician_id',
63
+ :'role' => :'role',
64
+ :'slot' => :'slot',
65
+ :'to_name' => :'to_name',
66
+ :'to_technician_id' => :'to_technician_id'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'from_name' => :'String',
79
+ :'from_technician_id' => :'String',
80
+ :'role' => :'String',
81
+ :'slot' => :'Integer',
82
+ :'to_name' => :'String',
83
+ :'to_technician_id' => :'String'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestCrewChange` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestCrewChange`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'from_name')
109
+ self.from_name = attributes[:'from_name']
110
+ end
111
+
112
+ if attributes.key?(:'from_technician_id')
113
+ self.from_technician_id = attributes[:'from_technician_id']
114
+ end
115
+
116
+ if attributes.key?(:'role')
117
+ self.role = attributes[:'role']
118
+ end
119
+
120
+ if attributes.key?(:'slot')
121
+ self.slot = attributes[:'slot']
122
+ end
123
+
124
+ if attributes.key?(:'to_name')
125
+ self.to_name = attributes[:'to_name']
126
+ end
127
+
128
+ if attributes.key?(:'to_technician_id')
129
+ self.to_technician_id = attributes[:'to_technician_id']
130
+ end
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
137
+ invalid_properties = Array.new
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ warn '[DEPRECATED] the `valid?` method is obsolete'
145
+ role_validator = EnumAttributeValidator.new('String', ["lead", "buddy"])
146
+ return false unless role_validator.valid?(@role)
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method checking allowed values (enum).
151
+ # @param [Object] role Object to be assigned
152
+ def role=(role)
153
+ validator = EnumAttributeValidator.new('String', ["lead", "buddy"])
154
+ unless validator.valid?(role)
155
+ fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
156
+ end
157
+ @role = role
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ from_name == o.from_name &&
166
+ from_technician_id == o.from_technician_id &&
167
+ role == o.role &&
168
+ slot == o.slot &&
169
+ to_name == o.to_name &&
170
+ to_technician_id == o.to_technician_id
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [from_name, from_technician_id, role, slot, to_name, to_technician_id].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ return nil unless attributes.is_a?(Hash)
190
+ attributes = attributes.transform_keys(&:to_sym)
191
+ transformed_hash = {}
192
+ openapi_types.each_pair do |key, type|
193
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
194
+ transformed_hash["#{key}"] = nil
195
+ elsif type =~ /\AArray<(.*)>/i
196
+ # check to ensure the input is an array given that the attribute
197
+ # is documented as an array but the input is not
198
+ if attributes[attribute_map[key]].is_a?(Array)
199
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
200
+ end
201
+ elsif !attributes[attribute_map[key]].nil?
202
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
203
+ end
204
+ end
205
+ new(transformed_hash)
206
+ end
207
+
208
+ # Deserializes the data based on type
209
+ # @param string type Data type
210
+ # @param string value Value to be deserialized
211
+ # @return [Object] Deserialized data
212
+ def self._deserialize(type, value)
213
+ case type.to_sym
214
+ when :Time
215
+ Time.parse(value)
216
+ when :Date
217
+ Date.parse(value)
218
+ when :String
219
+ value.to_s
220
+ when :Integer
221
+ value.to_i
222
+ when :Float
223
+ value.to_f
224
+ when :Boolean
225
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
226
+ true
227
+ else
228
+ false
229
+ end
230
+ when :Object
231
+ # generic object (usually a Hash), return directly
232
+ value
233
+ when /\AArray<(?<inner_type>.+)>\z/
234
+ inner_type = Regexp.last_match[:inner_type]
235
+ value.map { |v| _deserialize(inner_type, v) }
236
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
237
+ k_type = Regexp.last_match[:k_type]
238
+ v_type = Regexp.last_match[:v_type]
239
+ {}.tap do |hash|
240
+ value.each do |k, v|
241
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
242
+ end
243
+ end
244
+ else # model
245
+ # models (e.g. Pet) or oneOf
246
+ klass = Crisphive.const_get(type)
247
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
+ end
249
+ end
250
+
251
+ # Returns the string representation of the object
252
+ # @return [String] String presentation of the object
253
+ def to_s
254
+ to_hash.to_s
255
+ end
256
+
257
+ # to_body is an alias to to_hash (backward compatibility)
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_body
260
+ to_hash
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = self.send(attr)
269
+ if value.nil?
270
+ is_nullable = self.class.openapi_nullable.include?(attr)
271
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
+ end
273
+
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+
299
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #CrispHive Developer API
2
+ #Crisphive Developer API
3
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> }`.
4
+ #Public REST API for integrating Crisphive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
5
5
 
6
6
  The version of the OpenAPI document: 1.0
7
7
 
@@ -15,14 +15,16 @@ require 'time'
15
15
 
16
16
  module Crisphive
17
17
  class JobRequestCrewMember
18
+ # Crew member's email; null if not available.
18
19
  attr_accessor :email
19
20
 
20
21
  # This member's last session end (UTC). Omitted when no session plan exists.
21
22
  attr_accessor :ends_at
22
23
 
23
- # JobTitle/Phone/Email — crew member's contact (resolved like the customer block). Empty for a planned-but-unassigned slot.
24
+ # Crew member's job title. Empty for a planned-but-unassigned slot.
24
25
  attr_accessor :job_title
25
26
 
27
+ # Crew member's phone; null if not available.
26
28
  attr_accessor :phone
27
29
 
28
30
  # Role of this member on the job.
@@ -37,9 +39,10 @@ module Crisphive
37
39
  # Resolved skills (id+name) for SkillIDs. Omitted when the slot carries no skill requirement.
38
40
  attr_accessor :skills
39
41
 
40
- # TechnicianID/Name identify the assigned technician. Empty for a planned- but-unassigned crew member (quoted, not yet confirmed/assigned).
42
+ # UUID of the assigned technician. Empty for a planned-but-unassigned crew member (quoted, not yet confirmed/assigned).
41
43
  attr_accessor :technician_id
42
44
 
45
+ # Full name of the assigned technician. Empty for a planned-but-unassigned slot.
43
46
  attr_accessor :technician_name
44
47
 
45
48
  # Share of the job's man-hours this member works (1–100). Omitted for a single-person job.
@@ -0,0 +1,284 @@
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 JobRequestCrewMemberInput
18
+ # Whether this slot is the crew lead. Exactly one slot must set it.
19
+ attr_accessor :is_lead
20
+
21
+ # UUIDs of the skills this slot requires (hard filter for the matching engine). Optional; up to 20.
22
+ attr_accessor :skill_ids
23
+
24
+ # This slot's share of the job's man-hours, in percent (1–100). Shares across all slots must sum to 100.
25
+ attr_accessor :wrench_percent
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'is_lead' => :'is_lead',
31
+ :'skill_ids' => :'skill_ids',
32
+ :'wrench_percent' => :'wrench_percent'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'is_lead' => :'Boolean',
45
+ :'skill_ids' => :'Array<String>',
46
+ :'wrench_percent' => :'Integer'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::JobRequestCrewMemberInput` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::JobRequestCrewMemberInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'is_lead')
72
+ self.is_lead = attributes[:'is_lead']
73
+ end
74
+
75
+ if attributes.key?(:'skill_ids')
76
+ if (value = attributes[:'skill_ids']).is_a?(Array)
77
+ self.skill_ids = value
78
+ end
79
+ end
80
+
81
+ if attributes.key?(:'wrench_percent')
82
+ self.wrench_percent = attributes[:'wrench_percent']
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
+ invalid_properties = Array.new
91
+ if !@skill_ids.nil? && @skill_ids.length > 20
92
+ invalid_properties.push('invalid value for "skill_ids", number of items must be less than or equal to 20.')
93
+ end
94
+
95
+ if !@wrench_percent.nil? && @wrench_percent > 100
96
+ invalid_properties.push('invalid value for "wrench_percent", must be smaller than or equal to 100.')
97
+ end
98
+
99
+ if !@wrench_percent.nil? && @wrench_percent < 1
100
+ invalid_properties.push('invalid value for "wrench_percent", must be greater than or equal to 1.')
101
+ end
102
+
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ warn '[DEPRECATED] the `valid?` method is obsolete'
110
+ return false if !@skill_ids.nil? && @skill_ids.length > 20
111
+ return false if !@wrench_percent.nil? && @wrench_percent > 100
112
+ return false if !@wrench_percent.nil? && @wrench_percent < 1
113
+ true
114
+ end
115
+
116
+ # Custom attribute writer method with validation
117
+ # @param [Object] skill_ids Value to be assigned
118
+ def skill_ids=(skill_ids)
119
+ if skill_ids.nil?
120
+ fail ArgumentError, 'skill_ids cannot be nil'
121
+ end
122
+
123
+ if skill_ids.length > 20
124
+ fail ArgumentError, 'invalid value for "skill_ids", number of items must be less than or equal to 20.'
125
+ end
126
+
127
+ @skill_ids = skill_ids
128
+ end
129
+
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] wrench_percent Value to be assigned
132
+ def wrench_percent=(wrench_percent)
133
+ if wrench_percent.nil?
134
+ fail ArgumentError, 'wrench_percent cannot be nil'
135
+ end
136
+
137
+ if wrench_percent > 100
138
+ fail ArgumentError, 'invalid value for "wrench_percent", must be smaller than or equal to 100.'
139
+ end
140
+
141
+ if wrench_percent < 1
142
+ fail ArgumentError, 'invalid value for "wrench_percent", must be greater than or equal to 1.'
143
+ end
144
+
145
+ @wrench_percent = wrench_percent
146
+ end
147
+
148
+ # Checks equality by comparing each attribute.
149
+ # @param [Object] Object to be compared
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ is_lead == o.is_lead &&
154
+ skill_ids == o.skill_ids &&
155
+ wrench_percent == o.wrench_percent
156
+ end
157
+
158
+ # @see the `==` method
159
+ # @param [Object] Object to be compared
160
+ def eql?(o)
161
+ self == o
162
+ end
163
+
164
+ # Calculates hash code according to all attributes.
165
+ # @return [Integer] Hash code
166
+ def hash
167
+ [is_lead, skill_ids, wrench_percent].hash
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def self.build_from_hash(attributes)
174
+ return nil unless attributes.is_a?(Hash)
175
+ attributes = attributes.transform_keys(&:to_sym)
176
+ transformed_hash = {}
177
+ openapi_types.each_pair do |key, type|
178
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
179
+ transformed_hash["#{key}"] = nil
180
+ elsif type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[attribute_map[key]].is_a?(Array)
184
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
185
+ end
186
+ elsif !attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
188
+ end
189
+ end
190
+ new(transformed_hash)
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def self._deserialize(type, value)
198
+ case type.to_sym
199
+ when :Time
200
+ Time.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :Boolean
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ # models (e.g. Pet) or oneOf
231
+ klass = Crisphive.const_get(type)
232
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = self.send(attr)
254
+ if value.nil?
255
+ is_nullable = self.class.openapi_nullable.include?(attr)
256
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
257
+ end
258
+
259
+ hash[param] = _to_hash(value)
260
+ end
261
+ hash
262
+ end
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+
282
+ end
283
+
284
+ end