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,603 @@
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 TechnicianCreateRequest
18
+ # Home address (the day-start point when start_location_type=home).
19
+ attr_accessor :address
20
+
21
+ # Crew tier the matching engine assigns by: lead (can head a job), buddy (crew helper), float (excluded from auto crew-assign). IGNORED — stored empty, no error — when the role is Booking Coordinator, Administrator or Viewer: office roles are never assigned jobs. Technician, Owner, Supervisor and custom roles keep the tier.
22
+ attr_accessor :assignment_tier
23
+
24
+ # Buddies of this technician (set when creating a lead). Optional; max 50 technician ids.
25
+ attr_accessor :buddy_ids
26
+
27
+ # Role group for the new member. Optional: omitted or empty assigns the business's Technician group. To assign another group, copy its ID from the dashboard (Settings → Permissions) or from an existing member's `business_group_id`. Owner/Administrator groups are rejected in sandbox mode and for API-key callers.
28
+ attr_accessor :business_group_id
29
+
30
+ # Email address. At least one of phone/email is required (identity resolution key).
31
+ attr_accessor :email
32
+
33
+ # The person's full display name. Required; max 255 chars.
34
+ attr_accessor :full_name
35
+
36
+ # Display title (e.g. \"Senior HVAC Technician\").
37
+ attr_accessor :job_title
38
+
39
+ # First working day (YYYY-MM-DD).
40
+ attr_accessor :join_date
41
+
42
+ # Leads this technician is a buddy of (set when creating a buddy; the technician is appended to each lead's buddy list). Optional; max 50 technician ids.
43
+ attr_accessor :lead_ids
44
+
45
+ # Whether to send the new member the \"you have been added to {business}\" message (email when an email was supplied, SMS when a phone was, both when both). Omitted or true sends it; false stays silent. Set false for bulk imports so seeding a roster does not text everybody at once.
46
+ attr_accessor :notify
47
+
48
+ # Phone number in E.164 international format: a leading `+` and the country code, e.g. `+16135550188`. A bare national number (`6135550188`) is REJECTED with PHONE_INVALID — there is no default region to guess the country from. At least one of phone/email is required (identity resolution key).
49
+ attr_accessor :phone
50
+
51
+ # Service areas to assign the technician to. Optional; max 50. Discover via GET /service-areas.
52
+ attr_accessor :service_area_ids
53
+
54
+ # Explicit day-start latitude in decimal degrees (-90..90); when set it wins over the address geocode.
55
+ attr_accessor :start_location_lat
56
+
57
+ # Explicit day-start longitude in decimal degrees (-180..180); when set it wins over the address geocode.
58
+ attr_accessor :start_location_long
59
+
60
+ # Where the technician starts their day: home (their address) or office (the business location). Drives the engine's travel estimates.
61
+ attr_accessor :start_location_type
62
+
63
+ class EnumAttributeValidator
64
+ attr_reader :datatype
65
+ attr_reader :allowable_values
66
+
67
+ def initialize(datatype, allowable_values)
68
+ @allowable_values = allowable_values.map do |value|
69
+ case datatype.to_s
70
+ when /Integer/i
71
+ value.to_i
72
+ when /Float/i
73
+ value.to_f
74
+ else
75
+ value
76
+ end
77
+ end
78
+ end
79
+
80
+ def valid?(value)
81
+ !value || allowable_values.include?(value)
82
+ end
83
+ end
84
+
85
+ # Attribute mapping from ruby-style variable name to JSON key.
86
+ def self.attribute_map
87
+ {
88
+ :'address' => :'address',
89
+ :'assignment_tier' => :'assignment_tier',
90
+ :'buddy_ids' => :'buddy_ids',
91
+ :'business_group_id' => :'business_group_id',
92
+ :'email' => :'email',
93
+ :'full_name' => :'full_name',
94
+ :'job_title' => :'job_title',
95
+ :'join_date' => :'join_date',
96
+ :'lead_ids' => :'lead_ids',
97
+ :'notify' => :'notify',
98
+ :'phone' => :'phone',
99
+ :'service_area_ids' => :'service_area_ids',
100
+ :'start_location_lat' => :'start_location_lat',
101
+ :'start_location_long' => :'start_location_long',
102
+ :'start_location_type' => :'start_location_type'
103
+ }
104
+ end
105
+
106
+ # Returns all the JSON keys this model knows about
107
+ def self.acceptable_attributes
108
+ attribute_map.values
109
+ end
110
+
111
+ # Attribute type mapping.
112
+ def self.openapi_types
113
+ {
114
+ :'address' => :'TechnicianAddressInput',
115
+ :'assignment_tier' => :'String',
116
+ :'buddy_ids' => :'Array<String>',
117
+ :'business_group_id' => :'String',
118
+ :'email' => :'String',
119
+ :'full_name' => :'String',
120
+ :'job_title' => :'String',
121
+ :'join_date' => :'Date',
122
+ :'lead_ids' => :'Array<String>',
123
+ :'notify' => :'Boolean',
124
+ :'phone' => :'String',
125
+ :'service_area_ids' => :'Array<String>',
126
+ :'start_location_lat' => :'Float',
127
+ :'start_location_long' => :'Float',
128
+ :'start_location_type' => :'String'
129
+ }
130
+ end
131
+
132
+ # List of attributes with nullable: true
133
+ def self.openapi_nullable
134
+ Set.new([
135
+ ])
136
+ end
137
+
138
+ # Initializes the object
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ def initialize(attributes = {})
141
+ if (!attributes.is_a?(Hash))
142
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::TechnicianCreateRequest` initialize method"
143
+ end
144
+
145
+ # check to see if the attribute exists and convert string to symbol for hash key
146
+ attributes = attributes.each_with_object({}) { |(k, v), h|
147
+ if (!self.class.attribute_map.key?(k.to_sym))
148
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::TechnicianCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
149
+ end
150
+ h[k.to_sym] = v
151
+ }
152
+
153
+ if attributes.key?(:'address')
154
+ self.address = attributes[:'address']
155
+ end
156
+
157
+ if attributes.key?(:'assignment_tier')
158
+ self.assignment_tier = attributes[:'assignment_tier']
159
+ end
160
+
161
+ if attributes.key?(:'buddy_ids')
162
+ if (value = attributes[:'buddy_ids']).is_a?(Array)
163
+ self.buddy_ids = value
164
+ end
165
+ end
166
+
167
+ if attributes.key?(:'business_group_id')
168
+ self.business_group_id = attributes[:'business_group_id']
169
+ end
170
+
171
+ if attributes.key?(:'email')
172
+ self.email = attributes[:'email']
173
+ end
174
+
175
+ if attributes.key?(:'full_name')
176
+ self.full_name = attributes[:'full_name']
177
+ else
178
+ self.full_name = nil
179
+ end
180
+
181
+ if attributes.key?(:'job_title')
182
+ self.job_title = attributes[:'job_title']
183
+ end
184
+
185
+ if attributes.key?(:'join_date')
186
+ self.join_date = attributes[:'join_date']
187
+ end
188
+
189
+ if attributes.key?(:'lead_ids')
190
+ if (value = attributes[:'lead_ids']).is_a?(Array)
191
+ self.lead_ids = value
192
+ end
193
+ end
194
+
195
+ if attributes.key?(:'notify')
196
+ self.notify = attributes[:'notify']
197
+ end
198
+
199
+ if attributes.key?(:'phone')
200
+ self.phone = attributes[:'phone']
201
+ end
202
+
203
+ if attributes.key?(:'service_area_ids')
204
+ if (value = attributes[:'service_area_ids']).is_a?(Array)
205
+ self.service_area_ids = value
206
+ end
207
+ end
208
+
209
+ if attributes.key?(:'start_location_lat')
210
+ self.start_location_lat = attributes[:'start_location_lat']
211
+ end
212
+
213
+ if attributes.key?(:'start_location_long')
214
+ self.start_location_long = attributes[:'start_location_long']
215
+ end
216
+
217
+ if attributes.key?(:'start_location_type')
218
+ self.start_location_type = attributes[:'start_location_type']
219
+ end
220
+ end
221
+
222
+ # Show invalid properties with the reasons. Usually used together with valid?
223
+ # @return Array for valid properties with the reasons
224
+ def list_invalid_properties
225
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
226
+ invalid_properties = Array.new
227
+ if !@buddy_ids.nil? && @buddy_ids.length > 50
228
+ invalid_properties.push('invalid value for "buddy_ids", number of items must be less than or equal to 50.')
229
+ end
230
+
231
+ if !@email.nil? && @email.to_s.length > 255
232
+ invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 255.')
233
+ end
234
+
235
+ if @full_name.nil?
236
+ invalid_properties.push('invalid value for "full_name", full_name cannot be nil.')
237
+ end
238
+
239
+ if @full_name.to_s.length > 255
240
+ invalid_properties.push('invalid value for "full_name", the character length must be smaller than or equal to 255.')
241
+ end
242
+
243
+ if !@job_title.nil? && @job_title.to_s.length > 255
244
+ invalid_properties.push('invalid value for "job_title", the character length must be smaller than or equal to 255.')
245
+ end
246
+
247
+ if !@lead_ids.nil? && @lead_ids.length > 50
248
+ invalid_properties.push('invalid value for "lead_ids", number of items must be less than or equal to 50.')
249
+ end
250
+
251
+ if !@phone.nil? && @phone.to_s.length > 50
252
+ invalid_properties.push('invalid value for "phone", the character length must be smaller than or equal to 50.')
253
+ end
254
+
255
+ if !@service_area_ids.nil? && @service_area_ids.length > 50
256
+ invalid_properties.push('invalid value for "service_area_ids", number of items must be less than or equal to 50.')
257
+ end
258
+
259
+ if !@start_location_lat.nil? && @start_location_lat > 90
260
+ invalid_properties.push('invalid value for "start_location_lat", must be smaller than or equal to 90.')
261
+ end
262
+
263
+ if !@start_location_lat.nil? && @start_location_lat < -90
264
+ invalid_properties.push('invalid value for "start_location_lat", must be greater than or equal to -90.')
265
+ end
266
+
267
+ if !@start_location_long.nil? && @start_location_long > 180
268
+ invalid_properties.push('invalid value for "start_location_long", must be smaller than or equal to 180.')
269
+ end
270
+
271
+ if !@start_location_long.nil? && @start_location_long < -180
272
+ invalid_properties.push('invalid value for "start_location_long", must be greater than or equal to -180.')
273
+ end
274
+
275
+ invalid_properties
276
+ end
277
+
278
+ # Check to see if the all the properties in the model are valid
279
+ # @return true if the model is valid
280
+ def valid?
281
+ warn '[DEPRECATED] the `valid?` method is obsolete'
282
+ assignment_tier_validator = EnumAttributeValidator.new('String', ["lead", "buddy", "float"])
283
+ return false unless assignment_tier_validator.valid?(@assignment_tier)
284
+ return false if !@buddy_ids.nil? && @buddy_ids.length > 50
285
+ return false if !@email.nil? && @email.to_s.length > 255
286
+ return false if @full_name.nil?
287
+ return false if @full_name.to_s.length > 255
288
+ return false if !@job_title.nil? && @job_title.to_s.length > 255
289
+ return false if !@lead_ids.nil? && @lead_ids.length > 50
290
+ return false if !@phone.nil? && @phone.to_s.length > 50
291
+ return false if !@service_area_ids.nil? && @service_area_ids.length > 50
292
+ return false if !@start_location_lat.nil? && @start_location_lat > 90
293
+ return false if !@start_location_lat.nil? && @start_location_lat < -90
294
+ return false if !@start_location_long.nil? && @start_location_long > 180
295
+ return false if !@start_location_long.nil? && @start_location_long < -180
296
+ start_location_type_validator = EnumAttributeValidator.new('String', ["home", "office"])
297
+ return false unless start_location_type_validator.valid?(@start_location_type)
298
+ true
299
+ end
300
+
301
+ # Custom attribute writer method checking allowed values (enum).
302
+ # @param [Object] assignment_tier Object to be assigned
303
+ def assignment_tier=(assignment_tier)
304
+ validator = EnumAttributeValidator.new('String', ["lead", "buddy", "float"])
305
+ unless validator.valid?(assignment_tier)
306
+ fail ArgumentError, "invalid value for \"assignment_tier\", must be one of #{validator.allowable_values}."
307
+ end
308
+ @assignment_tier = assignment_tier
309
+ end
310
+
311
+ # Custom attribute writer method with validation
312
+ # @param [Object] buddy_ids Value to be assigned
313
+ def buddy_ids=(buddy_ids)
314
+ if buddy_ids.nil?
315
+ fail ArgumentError, 'buddy_ids cannot be nil'
316
+ end
317
+
318
+ if buddy_ids.length > 50
319
+ fail ArgumentError, 'invalid value for "buddy_ids", number of items must be less than or equal to 50.'
320
+ end
321
+
322
+ @buddy_ids = buddy_ids
323
+ end
324
+
325
+ # Custom attribute writer method with validation
326
+ # @param [Object] email Value to be assigned
327
+ def email=(email)
328
+ if email.nil?
329
+ fail ArgumentError, 'email cannot be nil'
330
+ end
331
+
332
+ if email.to_s.length > 255
333
+ fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 255.'
334
+ end
335
+
336
+ @email = email
337
+ end
338
+
339
+ # Custom attribute writer method with validation
340
+ # @param [Object] full_name Value to be assigned
341
+ def full_name=(full_name)
342
+ if full_name.nil?
343
+ fail ArgumentError, 'full_name cannot be nil'
344
+ end
345
+
346
+ if full_name.to_s.length > 255
347
+ fail ArgumentError, 'invalid value for "full_name", the character length must be smaller than or equal to 255.'
348
+ end
349
+
350
+ @full_name = full_name
351
+ end
352
+
353
+ # Custom attribute writer method with validation
354
+ # @param [Object] job_title Value to be assigned
355
+ def job_title=(job_title)
356
+ if job_title.nil?
357
+ fail ArgumentError, 'job_title cannot be nil'
358
+ end
359
+
360
+ if job_title.to_s.length > 255
361
+ fail ArgumentError, 'invalid value for "job_title", the character length must be smaller than or equal to 255.'
362
+ end
363
+
364
+ @job_title = job_title
365
+ end
366
+
367
+ # Custom attribute writer method with validation
368
+ # @param [Object] lead_ids Value to be assigned
369
+ def lead_ids=(lead_ids)
370
+ if lead_ids.nil?
371
+ fail ArgumentError, 'lead_ids cannot be nil'
372
+ end
373
+
374
+ if lead_ids.length > 50
375
+ fail ArgumentError, 'invalid value for "lead_ids", number of items must be less than or equal to 50.'
376
+ end
377
+
378
+ @lead_ids = lead_ids
379
+ end
380
+
381
+ # Custom attribute writer method with validation
382
+ # @param [Object] phone Value to be assigned
383
+ def phone=(phone)
384
+ if phone.nil?
385
+ fail ArgumentError, 'phone cannot be nil'
386
+ end
387
+
388
+ if phone.to_s.length > 50
389
+ fail ArgumentError, 'invalid value for "phone", the character length must be smaller than or equal to 50.'
390
+ end
391
+
392
+ @phone = phone
393
+ end
394
+
395
+ # Custom attribute writer method with validation
396
+ # @param [Object] service_area_ids Value to be assigned
397
+ def service_area_ids=(service_area_ids)
398
+ if service_area_ids.nil?
399
+ fail ArgumentError, 'service_area_ids cannot be nil'
400
+ end
401
+
402
+ if service_area_ids.length > 50
403
+ fail ArgumentError, 'invalid value for "service_area_ids", number of items must be less than or equal to 50.'
404
+ end
405
+
406
+ @service_area_ids = service_area_ids
407
+ end
408
+
409
+ # Custom attribute writer method with validation
410
+ # @param [Object] start_location_lat Value to be assigned
411
+ def start_location_lat=(start_location_lat)
412
+ if start_location_lat.nil?
413
+ fail ArgumentError, 'start_location_lat cannot be nil'
414
+ end
415
+
416
+ if start_location_lat > 90
417
+ fail ArgumentError, 'invalid value for "start_location_lat", must be smaller than or equal to 90.'
418
+ end
419
+
420
+ if start_location_lat < -90
421
+ fail ArgumentError, 'invalid value for "start_location_lat", must be greater than or equal to -90.'
422
+ end
423
+
424
+ @start_location_lat = start_location_lat
425
+ end
426
+
427
+ # Custom attribute writer method with validation
428
+ # @param [Object] start_location_long Value to be assigned
429
+ def start_location_long=(start_location_long)
430
+ if start_location_long.nil?
431
+ fail ArgumentError, 'start_location_long cannot be nil'
432
+ end
433
+
434
+ if start_location_long > 180
435
+ fail ArgumentError, 'invalid value for "start_location_long", must be smaller than or equal to 180.'
436
+ end
437
+
438
+ if start_location_long < -180
439
+ fail ArgumentError, 'invalid value for "start_location_long", must be greater than or equal to -180.'
440
+ end
441
+
442
+ @start_location_long = start_location_long
443
+ end
444
+
445
+ # Custom attribute writer method checking allowed values (enum).
446
+ # @param [Object] start_location_type Object to be assigned
447
+ def start_location_type=(start_location_type)
448
+ validator = EnumAttributeValidator.new('String', ["home", "office"])
449
+ unless validator.valid?(start_location_type)
450
+ fail ArgumentError, "invalid value for \"start_location_type\", must be one of #{validator.allowable_values}."
451
+ end
452
+ @start_location_type = start_location_type
453
+ end
454
+
455
+ # Checks equality by comparing each attribute.
456
+ # @param [Object] Object to be compared
457
+ def ==(o)
458
+ return true if self.equal?(o)
459
+ self.class == o.class &&
460
+ address == o.address &&
461
+ assignment_tier == o.assignment_tier &&
462
+ buddy_ids == o.buddy_ids &&
463
+ business_group_id == o.business_group_id &&
464
+ email == o.email &&
465
+ full_name == o.full_name &&
466
+ job_title == o.job_title &&
467
+ join_date == o.join_date &&
468
+ lead_ids == o.lead_ids &&
469
+ notify == o.notify &&
470
+ phone == o.phone &&
471
+ service_area_ids == o.service_area_ids &&
472
+ start_location_lat == o.start_location_lat &&
473
+ start_location_long == o.start_location_long &&
474
+ start_location_type == o.start_location_type
475
+ end
476
+
477
+ # @see the `==` method
478
+ # @param [Object] Object to be compared
479
+ def eql?(o)
480
+ self == o
481
+ end
482
+
483
+ # Calculates hash code according to all attributes.
484
+ # @return [Integer] Hash code
485
+ def hash
486
+ [address, assignment_tier, buddy_ids, business_group_id, email, full_name, job_title, join_date, lead_ids, notify, phone, service_area_ids, start_location_lat, start_location_long, start_location_type].hash
487
+ end
488
+
489
+ # Builds the object from hash
490
+ # @param [Hash] attributes Model attributes in the form of hash
491
+ # @return [Object] Returns the model itself
492
+ def self.build_from_hash(attributes)
493
+ return nil unless attributes.is_a?(Hash)
494
+ attributes = attributes.transform_keys(&:to_sym)
495
+ transformed_hash = {}
496
+ openapi_types.each_pair do |key, type|
497
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
498
+ transformed_hash["#{key}"] = nil
499
+ elsif type =~ /\AArray<(.*)>/i
500
+ # check to ensure the input is an array given that the attribute
501
+ # is documented as an array but the input is not
502
+ if attributes[attribute_map[key]].is_a?(Array)
503
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
504
+ end
505
+ elsif !attributes[attribute_map[key]].nil?
506
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
507
+ end
508
+ end
509
+ new(transformed_hash)
510
+ end
511
+
512
+ # Deserializes the data based on type
513
+ # @param string type Data type
514
+ # @param string value Value to be deserialized
515
+ # @return [Object] Deserialized data
516
+ def self._deserialize(type, value)
517
+ case type.to_sym
518
+ when :Time
519
+ Time.parse(value)
520
+ when :Date
521
+ Date.parse(value)
522
+ when :String
523
+ value.to_s
524
+ when :Integer
525
+ value.to_i
526
+ when :Float
527
+ value.to_f
528
+ when :Boolean
529
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
530
+ true
531
+ else
532
+ false
533
+ end
534
+ when :Object
535
+ # generic object (usually a Hash), return directly
536
+ value
537
+ when /\AArray<(?<inner_type>.+)>\z/
538
+ inner_type = Regexp.last_match[:inner_type]
539
+ value.map { |v| _deserialize(inner_type, v) }
540
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
541
+ k_type = Regexp.last_match[:k_type]
542
+ v_type = Regexp.last_match[:v_type]
543
+ {}.tap do |hash|
544
+ value.each do |k, v|
545
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
546
+ end
547
+ end
548
+ else # model
549
+ # models (e.g. Pet) or oneOf
550
+ klass = Crisphive.const_get(type)
551
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
552
+ end
553
+ end
554
+
555
+ # Returns the string representation of the object
556
+ # @return [String] String presentation of the object
557
+ def to_s
558
+ to_hash.to_s
559
+ end
560
+
561
+ # to_body is an alias to to_hash (backward compatibility)
562
+ # @return [Hash] Returns the object in the form of hash
563
+ def to_body
564
+ to_hash
565
+ end
566
+
567
+ # Returns the object in the form of hash
568
+ # @return [Hash] Returns the object in the form of hash
569
+ def to_hash
570
+ hash = {}
571
+ self.class.attribute_map.each_pair do |attr, param|
572
+ value = self.send(attr)
573
+ if value.nil?
574
+ is_nullable = self.class.openapi_nullable.include?(attr)
575
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
576
+ end
577
+
578
+ hash[param] = _to_hash(value)
579
+ end
580
+ hash
581
+ end
582
+
583
+ # Outputs non-array value in the form of hash
584
+ # For object, use to_hash. Otherwise, just return the value
585
+ # @param [Object] value Any valid value
586
+ # @return [Hash] Returns the value in the form of hash
587
+ def _to_hash(value)
588
+ if value.is_a?(Array)
589
+ value.compact.map { |v| _to_hash(v) }
590
+ elsif value.is_a?(Hash)
591
+ {}.tap do |hash|
592
+ value.each { |k, v| hash[k] = _to_hash(v) }
593
+ end
594
+ elsif value.respond_to? :to_hash
595
+ value.to_hash
596
+ else
597
+ value
598
+ end
599
+ end
600
+
601
+ end
602
+
603
+ end