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,236 @@
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 TechnicianSkillsRequest
18
+ # Skill ids (max 100). Discover via GET /skills.
19
+ attr_accessor :skill_ids
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'skill_ids' => :'skill_ids'
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
+ :'skill_ids' => :'Array<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::TechnicianSkillsRequest` 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::TechnicianSkillsRequest`. 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?(:'skill_ids')
62
+ if (value = attributes[:'skill_ids']).is_a?(Array)
63
+ self.skill_ids = 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
+ if !@skill_ids.nil? && @skill_ids.length > 100
74
+ invalid_properties.push('invalid value for "skill_ids", number of items must be less than or equal to 100.')
75
+ end
76
+
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ warn '[DEPRECATED] the `valid?` method is obsolete'
84
+ return false if !@skill_ids.nil? && @skill_ids.length > 100
85
+ true
86
+ end
87
+
88
+ # Custom attribute writer method with validation
89
+ # @param [Object] skill_ids Value to be assigned
90
+ def skill_ids=(skill_ids)
91
+ if skill_ids.nil?
92
+ fail ArgumentError, 'skill_ids cannot be nil'
93
+ end
94
+
95
+ if skill_ids.length > 100
96
+ fail ArgumentError, 'invalid value for "skill_ids", number of items must be less than or equal to 100.'
97
+ end
98
+
99
+ @skill_ids = skill_ids
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ skill_ids == o.skill_ids
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] Object to be compared
112
+ def eql?(o)
113
+ self == o
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Integer] Hash code
118
+ def hash
119
+ [skill_ids].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def self.build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ attributes = attributes.transform_keys(&:to_sym)
128
+ transformed_hash = {}
129
+ openapi_types.each_pair do |key, type|
130
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
131
+ transformed_hash["#{key}"] = nil
132
+ elsif type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[attribute_map[key]].is_a?(Array)
136
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
137
+ end
138
+ elsif !attributes[attribute_map[key]].nil?
139
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
140
+ end
141
+ end
142
+ new(transformed_hash)
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def self._deserialize(type, value)
150
+ case type.to_sym
151
+ when :Time
152
+ Time.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ # models (e.g. Pet) or oneOf
183
+ klass = Crisphive.const_get(type)
184
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.openapi_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ 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
 
@@ -0,0 +1,334 @@
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 TechnicianTimeOff
18
+ # Which dashboard actions the caller may take on this record.
19
+ attr_accessor :actions
20
+
21
+ # Owning business.
22
+ attr_accessor :business_id
23
+
24
+ attr_accessor :created_at
25
+
26
+ attr_accessor :deleted_at
27
+
28
+ # Block end (RFC3339 instant, UTC).
29
+ attr_accessor :end_datetime
30
+
31
+ # UUID of the record.
32
+ attr_accessor :id
33
+
34
+ # Free-text reason.
35
+ attr_accessor :reason
36
+
37
+ # Block start (RFC3339 instant, UTC).
38
+ attr_accessor :start_datetime
39
+
40
+ # pending (awaiting approval — the engine does NOT honour it yet) | approved (blocks scheduling) | rejected | cancelled.
41
+ attr_accessor :status
42
+
43
+ # The technician the block belongs to.
44
+ attr_accessor :technician_id
45
+
46
+ attr_accessor :updated_at
47
+
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'actions' => :'actions',
74
+ :'business_id' => :'business_id',
75
+ :'created_at' => :'created_at',
76
+ :'deleted_at' => :'deleted_at',
77
+ :'end_datetime' => :'end_datetime',
78
+ :'id' => :'id',
79
+ :'reason' => :'reason',
80
+ :'start_datetime' => :'start_datetime',
81
+ :'status' => :'status',
82
+ :'technician_id' => :'technician_id',
83
+ :'updated_at' => :'updated_at'
84
+ }
85
+ end
86
+
87
+ # Returns all the JSON keys this model knows about
88
+ def self.acceptable_attributes
89
+ attribute_map.values
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.openapi_types
94
+ {
95
+ :'actions' => :'ApiInternalTechtimeoffActions',
96
+ :'business_id' => :'String',
97
+ :'created_at' => :'Time',
98
+ :'deleted_at' => :'Time',
99
+ :'end_datetime' => :'Time',
100
+ :'id' => :'String',
101
+ :'reason' => :'String',
102
+ :'start_datetime' => :'Time',
103
+ :'status' => :'ApiInternalTechtimeoffStatus',
104
+ :'technician_id' => :'String',
105
+ :'updated_at' => :'Time'
106
+ }
107
+ end
108
+
109
+ # List of attributes with nullable: true
110
+ def self.openapi_nullable
111
+ Set.new([
112
+ ])
113
+ end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ if (!attributes.is_a?(Hash))
119
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::TechnicianTimeOff` initialize method"
120
+ end
121
+
122
+ # check to see if the attribute exists and convert string to symbol for hash key
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!self.class.attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::TechnicianTimeOff`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'actions')
131
+ self.actions = attributes[:'actions']
132
+ end
133
+
134
+ if attributes.key?(:'business_id')
135
+ self.business_id = attributes[:'business_id']
136
+ end
137
+
138
+ if attributes.key?(:'created_at')
139
+ self.created_at = attributes[:'created_at']
140
+ end
141
+
142
+ if attributes.key?(:'deleted_at')
143
+ self.deleted_at = attributes[:'deleted_at']
144
+ end
145
+
146
+ if attributes.key?(:'end_datetime')
147
+ self.end_datetime = attributes[:'end_datetime']
148
+ end
149
+
150
+ if attributes.key?(:'id')
151
+ self.id = attributes[:'id']
152
+ end
153
+
154
+ if attributes.key?(:'reason')
155
+ self.reason = attributes[:'reason']
156
+ end
157
+
158
+ if attributes.key?(:'start_datetime')
159
+ self.start_datetime = attributes[:'start_datetime']
160
+ end
161
+
162
+ if attributes.key?(:'status')
163
+ self.status = attributes[:'status']
164
+ end
165
+
166
+ if attributes.key?(:'technician_id')
167
+ self.technician_id = attributes[:'technician_id']
168
+ end
169
+
170
+ if attributes.key?(:'updated_at')
171
+ self.updated_at = attributes[:'updated_at']
172
+ end
173
+ end
174
+
175
+ # Show invalid properties with the reasons. Usually used together with valid?
176
+ # @return Array for valid properties with the reasons
177
+ def list_invalid_properties
178
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
179
+ invalid_properties = Array.new
180
+ invalid_properties
181
+ end
182
+
183
+ # Check to see if the all the properties in the model are valid
184
+ # @return true if the model is valid
185
+ def valid?
186
+ warn '[DEPRECATED] the `valid?` method is obsolete'
187
+ true
188
+ end
189
+
190
+ # Checks equality by comparing each attribute.
191
+ # @param [Object] Object to be compared
192
+ def ==(o)
193
+ return true if self.equal?(o)
194
+ self.class == o.class &&
195
+ actions == o.actions &&
196
+ business_id == o.business_id &&
197
+ created_at == o.created_at &&
198
+ deleted_at == o.deleted_at &&
199
+ end_datetime == o.end_datetime &&
200
+ id == o.id &&
201
+ reason == o.reason &&
202
+ start_datetime == o.start_datetime &&
203
+ status == o.status &&
204
+ technician_id == o.technician_id &&
205
+ updated_at == o.updated_at
206
+ end
207
+
208
+ # @see the `==` method
209
+ # @param [Object] Object to be compared
210
+ def eql?(o)
211
+ self == o
212
+ end
213
+
214
+ # Calculates hash code according to all attributes.
215
+ # @return [Integer] Hash code
216
+ def hash
217
+ [actions, business_id, created_at, deleted_at, end_datetime, id, reason, start_datetime, status, technician_id, updated_at].hash
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def self.build_from_hash(attributes)
224
+ return nil unless attributes.is_a?(Hash)
225
+ attributes = attributes.transform_keys(&:to_sym)
226
+ transformed_hash = {}
227
+ openapi_types.each_pair do |key, type|
228
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
229
+ transformed_hash["#{key}"] = nil
230
+ elsif type =~ /\AArray<(.*)>/i
231
+ # check to ensure the input is an array given that the attribute
232
+ # is documented as an array but the input is not
233
+ if attributes[attribute_map[key]].is_a?(Array)
234
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
235
+ end
236
+ elsif !attributes[attribute_map[key]].nil?
237
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
238
+ end
239
+ end
240
+ new(transformed_hash)
241
+ end
242
+
243
+ # Deserializes the data based on type
244
+ # @param string type Data type
245
+ # @param string value Value to be deserialized
246
+ # @return [Object] Deserialized data
247
+ def self._deserialize(type, value)
248
+ case type.to_sym
249
+ when :Time
250
+ Time.parse(value)
251
+ when :Date
252
+ Date.parse(value)
253
+ when :String
254
+ value.to_s
255
+ when :Integer
256
+ value.to_i
257
+ when :Float
258
+ value.to_f
259
+ when :Boolean
260
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
261
+ true
262
+ else
263
+ false
264
+ end
265
+ when :Object
266
+ # generic object (usually a Hash), return directly
267
+ value
268
+ when /\AArray<(?<inner_type>.+)>\z/
269
+ inner_type = Regexp.last_match[:inner_type]
270
+ value.map { |v| _deserialize(inner_type, v) }
271
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
272
+ k_type = Regexp.last_match[:k_type]
273
+ v_type = Regexp.last_match[:v_type]
274
+ {}.tap do |hash|
275
+ value.each do |k, v|
276
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
+ end
278
+ end
279
+ else # model
280
+ # models (e.g. Pet) or oneOf
281
+ klass = Crisphive.const_get(type)
282
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
283
+ end
284
+ end
285
+
286
+ # Returns the string representation of the object
287
+ # @return [String] String presentation of the object
288
+ def to_s
289
+ to_hash.to_s
290
+ end
291
+
292
+ # to_body is an alias to to_hash (backward compatibility)
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_body
295
+ to_hash
296
+ end
297
+
298
+ # Returns the object in the form of hash
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_hash
301
+ hash = {}
302
+ self.class.attribute_map.each_pair do |attr, param|
303
+ value = self.send(attr)
304
+ if value.nil?
305
+ is_nullable = self.class.openapi_nullable.include?(attr)
306
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
307
+ end
308
+
309
+ hash[param] = _to_hash(value)
310
+ end
311
+ hash
312
+ end
313
+
314
+ # Outputs non-array value in the form of hash
315
+ # For object, use to_hash. Otherwise, just return the value
316
+ # @param [Object] value Any valid value
317
+ # @return [Hash] Returns the value in the form of hash
318
+ def _to_hash(value)
319
+ if value.is_a?(Array)
320
+ value.compact.map { |v| _to_hash(v) }
321
+ elsif value.is_a?(Hash)
322
+ {}.tap do |hash|
323
+ value.each { |k, v| hash[k] = _to_hash(v) }
324
+ end
325
+ elsif value.respond_to? :to_hash
326
+ value.to_hash
327
+ else
328
+ value
329
+ end
330
+ end
331
+
332
+ end
333
+
334
+ end