crisphive 0.1.0 → 0.2.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 (163) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +90 -11
  3. data/crisphive.gemspec +5 -5
  4. data/lib/crisphive/api/business_skill_api.rb +154 -8
  5. data/lib/crisphive/api/customer_api.rb +15 -12
  6. data/lib/crisphive/api/job_request_business_api.rb +1002 -112
  7. data/lib/crisphive/api/job_types_api.rb +6 -2
  8. data/lib/crisphive/api/service_area_api.rb +6 -6
  9. data/lib/crisphive/api/technician_api.rb +510 -6
  10. data/lib/crisphive/api/vehicle_api.rb +6 -6
  11. data/lib/crisphive/api_client.rb +2 -2
  12. data/lib/crisphive/api_error.rb +2 -2
  13. data/lib/crisphive/configuration.rb +3 -3
  14. data/lib/crisphive/models/commit_emergency_reschedule200_response.rb +253 -0
  15. data/lib/crisphive/models/commit_job_request_move200_response.rb +253 -0
  16. data/lib/crisphive/models/create_customer200_response.rb +5 -2
  17. data/lib/crisphive/models/create_job_request200_response.rb +5 -2
  18. data/lib/crisphive/models/create_technician200_response.rb +253 -0
  19. data/lib/crisphive/models/customer.rb +2 -2
  20. data/lib/crisphive/models/customer_address.rb +2 -2
  21. data/lib/crisphive/models/customer_address_request.rb +11 -2
  22. data/lib/crisphive/models/customer_contact.rb +2 -2
  23. data/lib/crisphive/models/customer_create_request.rb +2 -2
  24. data/lib/crisphive/models/customer_create_response.rb +2 -2
  25. data/lib/crisphive/models/customer_list.rb +3 -3
  26. data/lib/crisphive/models/customer_list_item.rb +2 -2
  27. data/lib/crisphive/models/customer_profile.rb +2 -2
  28. data/lib/crisphive/models/customer_spending.rb +2 -2
  29. data/lib/crisphive/models/customer_tier_progress.rb +2 -2
  30. data/lib/crisphive/models/customer_update_request.rb +2 -2
  31. data/lib/crisphive/models/get_customer200_response.rb +5 -2
  32. data/lib/crisphive/models/get_job_request200_response.rb +5 -2
  33. data/lib/crisphive/models/get_job_request_timeline200_response.rb +5 -2
  34. data/lib/crisphive/models/get_job_type200_response.rb +5 -2
  35. data/lib/crisphive/models/get_service_area200_response.rb +5 -2
  36. data/lib/crisphive/models/get_technician200_response.rb +5 -2
  37. data/lib/crisphive/models/get_technician_schedule200_response.rb +253 -0
  38. data/lib/crisphive/models/get_vehicle200_response.rb +5 -2
  39. data/lib/crisphive/models/job_date.rb +5 -3
  40. data/lib/crisphive/models/job_date_business_range.rb +7 -3
  41. data/lib/crisphive/models/job_date_period.rb +2 -2
  42. data/lib/crisphive/models/job_date_period_entry.rb +4 -2
  43. data/lib/crisphive/models/job_request.rb +46 -6
  44. data/lib/crisphive/models/job_request_action_audit_by.rb +2 -2
  45. data/lib/crisphive/models/job_request_action_audit_entry.rb +3 -3
  46. data/lib/crisphive/models/job_request_action_summary.rb +2 -2
  47. data/lib/crisphive/models/job_request_address_summary.rb +2 -2
  48. data/lib/crisphive/models/job_request_archive_summary.rb +2 -2
  49. data/lib/crisphive/models/job_request_arrival_window.rb +4 -4
  50. data/lib/crisphive/models/job_request_assigned_vehicle.rb +2 -2
  51. data/lib/crisphive/models/job_request_assignment_summary.rb +2 -2
  52. data/lib/crisphive/models/job_request_attention_summary.rb +259 -0
  53. data/lib/crisphive/models/job_request_available_vehicle.rb +235 -0
  54. data/lib/crisphive/models/job_request_booking_windows.rb +2 -2
  55. data/lib/crisphive/models/job_request_buddy_slot_candidates.rb +239 -0
  56. data/lib/crisphive/models/job_request_business_time_range.rb +3 -3
  57. data/lib/crisphive/models/job_request_changes.rb +2 -2
  58. data/lib/crisphive/models/job_request_confirm_request.rb +245 -0
  59. data/lib/crisphive/models/job_request_create_request.rb +60 -6
  60. data/lib/crisphive/models/job_request_create_response.rb +2 -2
  61. data/lib/crisphive/models/job_request_crew_candidates.rb +227 -0
  62. data/lib/crisphive/models/job_request_crew_change.rb +299 -0
  63. data/lib/crisphive/models/job_request_crew_member.rb +7 -4
  64. data/lib/crisphive/models/job_request_crew_member_input.rb +284 -0
  65. data/lib/crisphive/models/job_request_crew_recommendation.rb +255 -0
  66. data/lib/crisphive/models/job_request_customer_summary.rb +2 -2
  67. data/lib/crisphive/models/job_request_day_windows.rb +3 -3
  68. data/lib/crisphive/models/job_request_emergency_candidate.rb +297 -0
  69. data/lib/crisphive/models/job_request_emergency_candidates.rb +311 -0
  70. data/lib/crisphive/models/job_request_emergency_candidates_request.rb +328 -0
  71. data/lib/crisphive/models/job_request_emergency_commit_request.rb +351 -0
  72. data/lib/crisphive/models/job_request_emergency_plan.rb +345 -0
  73. data/lib/crisphive/models/job_request_emergency_preview_request.rb +329 -0
  74. data/lib/crisphive/models/job_request_job_date_business_range_request.rb +3 -3
  75. data/lib/crisphive/models/job_request_job_date_period_request.rb +2 -2
  76. data/lib/crisphive/models/job_request_job_date_request.rb +3 -3
  77. data/lib/crisphive/models/job_request_lead_candidate.rb +311 -0
  78. data/lib/crisphive/models/job_request_list.rb +2 -2
  79. data/lib/crisphive/models/job_request_move_commit_req.rb +343 -0
  80. data/lib/crisphive/models/job_request_move_member.rb +299 -0
  81. data/lib/crisphive/models/job_request_move_plan.rb +377 -0
  82. data/lib/crisphive/models/job_request_move_preview_req.rb +290 -0
  83. data/lib/crisphive/models/job_request_move_warning.rb +311 -0
  84. data/lib/crisphive/models/job_request_period.rb +2 -2
  85. data/lib/crisphive/models/job_request_quote_request.rb +340 -0
  86. data/lib/crisphive/models/job_request_quote_summary.rb +2 -2
  87. data/lib/crisphive/models/job_request_rating_summary.rb +2 -2
  88. data/lib/crisphive/models/job_request_reschedule_day.rb +227 -0
  89. data/lib/crisphive/models/job_request_reschedule_move.rb +319 -0
  90. data/lib/crisphive/models/job_request_reschedule_reassignment.rb +339 -0
  91. data/lib/crisphive/models/job_request_schedule.rb +2 -2
  92. data/lib/crisphive/models/job_request_session.rb +8 -7
  93. data/lib/crisphive/models/job_request_skill_summary.rb +2 -2
  94. data/lib/crisphive/models/job_request_status_summary.rb +2 -2
  95. data/lib/crisphive/models/job_request_tech_candidate.rb +287 -0
  96. data/lib/crisphive/models/job_request_technician_info.rb +2 -2
  97. data/lib/crisphive/models/job_request_time_segments.rb +287 -0
  98. data/lib/crisphive/models/job_request_time_segments_business_time.rb +321 -0
  99. data/lib/crisphive/models/job_request_time_segments_day.rb +247 -0
  100. data/lib/crisphive/models/job_request_time_segments_slot.rb +375 -0
  101. data/lib/crisphive/models/job_request_time_segments_worker.rb +295 -0
  102. data/lib/crisphive/models/job_request_timeline.rb +2 -2
  103. data/lib/crisphive/models/job_request_timeline_action.rb +2 -2
  104. data/lib/crisphive/models/job_request_timeline_event.rb +2 -2
  105. data/lib/crisphive/models/job_request_update_priority_request.rb +295 -0
  106. data/lib/crisphive/models/job_type.rb +2 -2
  107. data/lib/crisphive/models/list_crew_candidates200_response.rb +253 -0
  108. data/lib/crisphive/models/list_customers200_response.rb +5 -2
  109. data/lib/crisphive/models/list_emergency_candidates200_response.rb +253 -0
  110. data/lib/crisphive/models/list_job_request_booking_windows200_response.rb +5 -2
  111. data/lib/crisphive/models/list_job_request_changes200_response.rb +5 -2
  112. data/lib/crisphive/models/list_job_requests200_response.rb +5 -2
  113. data/lib/crisphive/models/list_job_types200_response.rb +5 -2
  114. data/lib/crisphive/models/list_matching_slots200_response.rb +253 -0
  115. data/lib/crisphive/models/list_nearby_technicians200_response.rb +253 -0
  116. data/lib/crisphive/models/list_service_areas200_response.rb +5 -2
  117. data/lib/crisphive/models/list_skill_categories200_response.rb +5 -2
  118. data/lib/crisphive/models/list_skills200_response.rb +5 -2
  119. data/lib/crisphive/models/list_skills_by_category200_response.rb +5 -2
  120. data/lib/crisphive/models/list_technician_skills200_response.rb +253 -0
  121. data/lib/crisphive/models/list_technicians200_response.rb +5 -2
  122. data/lib/crisphive/models/list_vehicles200_response.rb +5 -2
  123. data/lib/crisphive/models/nearby_technician.rb +319 -0
  124. data/lib/crisphive/models/nearby_technicians.rb +237 -0
  125. data/lib/crisphive/models/pagination.rb +7 -2
  126. data/lib/crisphive/models/replace_technician_service_areas200_response.rb +253 -0
  127. data/lib/crisphive/models/response_envelope.rb +6 -2
  128. data/lib/crisphive/models/service_area.rb +2 -2
  129. data/lib/crisphive/models/service_area_list.rb +2 -2
  130. data/lib/crisphive/models/skill.rb +9 -2
  131. data/lib/crisphive/models/skill_by_category_list.rb +4 -2
  132. data/lib/crisphive/models/skill_category.rb +7 -2
  133. data/lib/crisphive/models/skill_category_list.rb +4 -2
  134. data/lib/crisphive/models/skill_list.rb +2 -2
  135. data/lib/crisphive/models/skill_summary.rb +2 -2
  136. data/lib/crisphive/models/technician.rb +2 -2
  137. data/lib/crisphive/models/technician_address.rb +2 -2
  138. data/lib/crisphive/models/technician_address_input.rb +408 -0
  139. data/lib/crisphive/models/technician_buddies_request.rb +236 -0
  140. data/lib/crisphive/models/technician_create_request.rb +600 -0
  141. data/lib/crisphive/models/technician_create_response.rb +215 -0
  142. data/lib/crisphive/models/technician_lead_ref.rb +2 -2
  143. data/lib/crisphive/models/technician_leads_request.rb +236 -0
  144. data/lib/crisphive/models/technician_list.rb +3 -3
  145. data/lib/crisphive/models/technician_schedule.rb +279 -0
  146. data/lib/crisphive/models/technician_schedule_block.rb +225 -0
  147. data/lib/crisphive/models/technician_schedule_session.rb +311 -0
  148. data/lib/crisphive/models/technician_service_area_ref.rb +2 -2
  149. data/lib/crisphive/models/technician_service_areas_request.rb +236 -0
  150. data/lib/crisphive/models/technician_service_areas_response.rb +217 -0
  151. data/lib/crisphive/models/technician_skill.rb +265 -0
  152. data/lib/crisphive/models/technician_skill_list.rb +227 -0
  153. data/lib/crisphive/models/technician_skills_request.rb +236 -0
  154. data/lib/crisphive/models/technician_status.rb +2 -2
  155. data/lib/crisphive/models/technician_update_request.rb +507 -0
  156. data/lib/crisphive/models/technician_vehicles_request.rb +236 -0
  157. data/lib/crisphive/models/vehicle.rb +26 -4
  158. data/lib/crisphive/models/vehicle_list.rb +2 -2
  159. data/lib/crisphive/models/vehicle_owner.rb +2 -2
  160. data/lib/crisphive/version.rb +3 -3
  161. data/lib/crisphive.rb +60 -2
  162. data/spec/spec_helper.rb +2 -2
  163. metadata +63 -5
@@ -0,0 +1,600 @@
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).
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. Discover IDs via GET /permission/groups (Owner/Administrator groups are rejected in sandbox mode).
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
+ # At least one of phone/email is required (identity resolution key).
46
+ attr_accessor :phone
47
+
48
+ # Service areas to assign the technician to. Optional; max 50. Discover via GET /service-areas.
49
+ attr_accessor :service_area_ids
50
+
51
+ # Explicit day-start latitude in decimal degrees (-90..90); when set it wins over the address geocode.
52
+ attr_accessor :start_location_lat
53
+
54
+ # Explicit day-start longitude in decimal degrees (-180..180); when set it wins over the address geocode.
55
+ attr_accessor :start_location_long
56
+
57
+ # Where the technician starts their day: home (their address) or office (the business location). Drives the engine's travel estimates.
58
+ attr_accessor :start_location_type
59
+
60
+ class EnumAttributeValidator
61
+ attr_reader :datatype
62
+ attr_reader :allowable_values
63
+
64
+ def initialize(datatype, allowable_values)
65
+ @allowable_values = allowable_values.map do |value|
66
+ case datatype.to_s
67
+ when /Integer/i
68
+ value.to_i
69
+ when /Float/i
70
+ value.to_f
71
+ else
72
+ value
73
+ end
74
+ end
75
+ end
76
+
77
+ def valid?(value)
78
+ !value || allowable_values.include?(value)
79
+ end
80
+ end
81
+
82
+ # Attribute mapping from ruby-style variable name to JSON key.
83
+ def self.attribute_map
84
+ {
85
+ :'address' => :'address',
86
+ :'assignment_tier' => :'assignment_tier',
87
+ :'buddy_ids' => :'buddy_ids',
88
+ :'business_group_id' => :'business_group_id',
89
+ :'email' => :'email',
90
+ :'full_name' => :'full_name',
91
+ :'job_title' => :'job_title',
92
+ :'join_date' => :'join_date',
93
+ :'lead_ids' => :'lead_ids',
94
+ :'phone' => :'phone',
95
+ :'service_area_ids' => :'service_area_ids',
96
+ :'start_location_lat' => :'start_location_lat',
97
+ :'start_location_long' => :'start_location_long',
98
+ :'start_location_type' => :'start_location_type'
99
+ }
100
+ end
101
+
102
+ # Returns all the JSON keys this model knows about
103
+ def self.acceptable_attributes
104
+ attribute_map.values
105
+ end
106
+
107
+ # Attribute type mapping.
108
+ def self.openapi_types
109
+ {
110
+ :'address' => :'TechnicianAddressInput',
111
+ :'assignment_tier' => :'String',
112
+ :'buddy_ids' => :'Array<String>',
113
+ :'business_group_id' => :'String',
114
+ :'email' => :'String',
115
+ :'full_name' => :'String',
116
+ :'job_title' => :'String',
117
+ :'join_date' => :'Date',
118
+ :'lead_ids' => :'Array<String>',
119
+ :'phone' => :'String',
120
+ :'service_area_ids' => :'Array<String>',
121
+ :'start_location_lat' => :'Float',
122
+ :'start_location_long' => :'Float',
123
+ :'start_location_type' => :'String'
124
+ }
125
+ end
126
+
127
+ # List of attributes with nullable: true
128
+ def self.openapi_nullable
129
+ Set.new([
130
+ ])
131
+ end
132
+
133
+ # Initializes the object
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ def initialize(attributes = {})
136
+ if (!attributes.is_a?(Hash))
137
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::TechnicianCreateRequest` initialize method"
138
+ end
139
+
140
+ # check to see if the attribute exists and convert string to symbol for hash key
141
+ attributes = attributes.each_with_object({}) { |(k, v), h|
142
+ if (!self.class.attribute_map.key?(k.to_sym))
143
+ 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
144
+ end
145
+ h[k.to_sym] = v
146
+ }
147
+
148
+ if attributes.key?(:'address')
149
+ self.address = attributes[:'address']
150
+ end
151
+
152
+ if attributes.key?(:'assignment_tier')
153
+ self.assignment_tier = attributes[:'assignment_tier']
154
+ end
155
+
156
+ if attributes.key?(:'buddy_ids')
157
+ if (value = attributes[:'buddy_ids']).is_a?(Array)
158
+ self.buddy_ids = value
159
+ end
160
+ end
161
+
162
+ if attributes.key?(:'business_group_id')
163
+ self.business_group_id = attributes[:'business_group_id']
164
+ else
165
+ self.business_group_id = nil
166
+ end
167
+
168
+ if attributes.key?(:'email')
169
+ self.email = attributes[:'email']
170
+ end
171
+
172
+ if attributes.key?(:'full_name')
173
+ self.full_name = attributes[:'full_name']
174
+ else
175
+ self.full_name = nil
176
+ end
177
+
178
+ if attributes.key?(:'job_title')
179
+ self.job_title = attributes[:'job_title']
180
+ end
181
+
182
+ if attributes.key?(:'join_date')
183
+ self.join_date = attributes[:'join_date']
184
+ end
185
+
186
+ if attributes.key?(:'lead_ids')
187
+ if (value = attributes[:'lead_ids']).is_a?(Array)
188
+ self.lead_ids = value
189
+ end
190
+ end
191
+
192
+ if attributes.key?(:'phone')
193
+ self.phone = attributes[:'phone']
194
+ end
195
+
196
+ if attributes.key?(:'service_area_ids')
197
+ if (value = attributes[:'service_area_ids']).is_a?(Array)
198
+ self.service_area_ids = value
199
+ end
200
+ end
201
+
202
+ if attributes.key?(:'start_location_lat')
203
+ self.start_location_lat = attributes[:'start_location_lat']
204
+ end
205
+
206
+ if attributes.key?(:'start_location_long')
207
+ self.start_location_long = attributes[:'start_location_long']
208
+ end
209
+
210
+ if attributes.key?(:'start_location_type')
211
+ self.start_location_type = attributes[:'start_location_type']
212
+ end
213
+ end
214
+
215
+ # Show invalid properties with the reasons. Usually used together with valid?
216
+ # @return Array for valid properties with the reasons
217
+ def list_invalid_properties
218
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
219
+ invalid_properties = Array.new
220
+ if !@buddy_ids.nil? && @buddy_ids.length > 50
221
+ invalid_properties.push('invalid value for "buddy_ids", number of items must be less than or equal to 50.')
222
+ end
223
+
224
+ if @business_group_id.nil?
225
+ invalid_properties.push('invalid value for "business_group_id", business_group_id cannot be nil.')
226
+ end
227
+
228
+ if !@email.nil? && @email.to_s.length > 255
229
+ invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 255.')
230
+ end
231
+
232
+ if @full_name.nil?
233
+ invalid_properties.push('invalid value for "full_name", full_name cannot be nil.')
234
+ end
235
+
236
+ if @full_name.to_s.length > 255
237
+ invalid_properties.push('invalid value for "full_name", the character length must be smaller than or equal to 255.')
238
+ end
239
+
240
+ if !@job_title.nil? && @job_title.to_s.length > 255
241
+ invalid_properties.push('invalid value for "job_title", the character length must be smaller than or equal to 255.')
242
+ end
243
+
244
+ if !@lead_ids.nil? && @lead_ids.length > 50
245
+ invalid_properties.push('invalid value for "lead_ids", number of items must be less than or equal to 50.')
246
+ end
247
+
248
+ if !@phone.nil? && @phone.to_s.length > 50
249
+ invalid_properties.push('invalid value for "phone", the character length must be smaller than or equal to 50.')
250
+ end
251
+
252
+ if !@service_area_ids.nil? && @service_area_ids.length > 50
253
+ invalid_properties.push('invalid value for "service_area_ids", number of items must be less than or equal to 50.')
254
+ end
255
+
256
+ if !@start_location_lat.nil? && @start_location_lat > 90
257
+ invalid_properties.push('invalid value for "start_location_lat", must be smaller than or equal to 90.')
258
+ end
259
+
260
+ if !@start_location_lat.nil? && @start_location_lat < -90
261
+ invalid_properties.push('invalid value for "start_location_lat", must be greater than or equal to -90.')
262
+ end
263
+
264
+ if !@start_location_long.nil? && @start_location_long > 180
265
+ invalid_properties.push('invalid value for "start_location_long", must be smaller than or equal to 180.')
266
+ end
267
+
268
+ if !@start_location_long.nil? && @start_location_long < -180
269
+ invalid_properties.push('invalid value for "start_location_long", must be greater than or equal to -180.')
270
+ end
271
+
272
+ invalid_properties
273
+ end
274
+
275
+ # Check to see if the all the properties in the model are valid
276
+ # @return true if the model is valid
277
+ def valid?
278
+ warn '[DEPRECATED] the `valid?` method is obsolete'
279
+ assignment_tier_validator = EnumAttributeValidator.new('String', ["lead", "buddy", "float"])
280
+ return false unless assignment_tier_validator.valid?(@assignment_tier)
281
+ return false if !@buddy_ids.nil? && @buddy_ids.length > 50
282
+ return false if @business_group_id.nil?
283
+ return false if !@email.nil? && @email.to_s.length > 255
284
+ return false if @full_name.nil?
285
+ return false if @full_name.to_s.length > 255
286
+ return false if !@job_title.nil? && @job_title.to_s.length > 255
287
+ return false if !@lead_ids.nil? && @lead_ids.length > 50
288
+ return false if !@phone.nil? && @phone.to_s.length > 50
289
+ return false if !@service_area_ids.nil? && @service_area_ids.length > 50
290
+ return false if !@start_location_lat.nil? && @start_location_lat > 90
291
+ return false if !@start_location_lat.nil? && @start_location_lat < -90
292
+ return false if !@start_location_long.nil? && @start_location_long > 180
293
+ return false if !@start_location_long.nil? && @start_location_long < -180
294
+ start_location_type_validator = EnumAttributeValidator.new('String', ["home", "office"])
295
+ return false unless start_location_type_validator.valid?(@start_location_type)
296
+ true
297
+ end
298
+
299
+ # Custom attribute writer method checking allowed values (enum).
300
+ # @param [Object] assignment_tier Object to be assigned
301
+ def assignment_tier=(assignment_tier)
302
+ validator = EnumAttributeValidator.new('String', ["lead", "buddy", "float"])
303
+ unless validator.valid?(assignment_tier)
304
+ fail ArgumentError, "invalid value for \"assignment_tier\", must be one of #{validator.allowable_values}."
305
+ end
306
+ @assignment_tier = assignment_tier
307
+ end
308
+
309
+ # Custom attribute writer method with validation
310
+ # @param [Object] buddy_ids Value to be assigned
311
+ def buddy_ids=(buddy_ids)
312
+ if buddy_ids.nil?
313
+ fail ArgumentError, 'buddy_ids cannot be nil'
314
+ end
315
+
316
+ if buddy_ids.length > 50
317
+ fail ArgumentError, 'invalid value for "buddy_ids", number of items must be less than or equal to 50.'
318
+ end
319
+
320
+ @buddy_ids = buddy_ids
321
+ end
322
+
323
+ # Custom attribute writer method with validation
324
+ # @param [Object] email Value to be assigned
325
+ def email=(email)
326
+ if email.nil?
327
+ fail ArgumentError, 'email cannot be nil'
328
+ end
329
+
330
+ if email.to_s.length > 255
331
+ fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 255.'
332
+ end
333
+
334
+ @email = email
335
+ end
336
+
337
+ # Custom attribute writer method with validation
338
+ # @param [Object] full_name Value to be assigned
339
+ def full_name=(full_name)
340
+ if full_name.nil?
341
+ fail ArgumentError, 'full_name cannot be nil'
342
+ end
343
+
344
+ if full_name.to_s.length > 255
345
+ fail ArgumentError, 'invalid value for "full_name", the character length must be smaller than or equal to 255.'
346
+ end
347
+
348
+ @full_name = full_name
349
+ end
350
+
351
+ # Custom attribute writer method with validation
352
+ # @param [Object] job_title Value to be assigned
353
+ def job_title=(job_title)
354
+ if job_title.nil?
355
+ fail ArgumentError, 'job_title cannot be nil'
356
+ end
357
+
358
+ if job_title.to_s.length > 255
359
+ fail ArgumentError, 'invalid value for "job_title", the character length must be smaller than or equal to 255.'
360
+ end
361
+
362
+ @job_title = job_title
363
+ end
364
+
365
+ # Custom attribute writer method with validation
366
+ # @param [Object] lead_ids Value to be assigned
367
+ def lead_ids=(lead_ids)
368
+ if lead_ids.nil?
369
+ fail ArgumentError, 'lead_ids cannot be nil'
370
+ end
371
+
372
+ if lead_ids.length > 50
373
+ fail ArgumentError, 'invalid value for "lead_ids", number of items must be less than or equal to 50.'
374
+ end
375
+
376
+ @lead_ids = lead_ids
377
+ end
378
+
379
+ # Custom attribute writer method with validation
380
+ # @param [Object] phone Value to be assigned
381
+ def phone=(phone)
382
+ if phone.nil?
383
+ fail ArgumentError, 'phone cannot be nil'
384
+ end
385
+
386
+ if phone.to_s.length > 50
387
+ fail ArgumentError, 'invalid value for "phone", the character length must be smaller than or equal to 50.'
388
+ end
389
+
390
+ @phone = phone
391
+ end
392
+
393
+ # Custom attribute writer method with validation
394
+ # @param [Object] service_area_ids Value to be assigned
395
+ def service_area_ids=(service_area_ids)
396
+ if service_area_ids.nil?
397
+ fail ArgumentError, 'service_area_ids cannot be nil'
398
+ end
399
+
400
+ if service_area_ids.length > 50
401
+ fail ArgumentError, 'invalid value for "service_area_ids", number of items must be less than or equal to 50.'
402
+ end
403
+
404
+ @service_area_ids = service_area_ids
405
+ end
406
+
407
+ # Custom attribute writer method with validation
408
+ # @param [Object] start_location_lat Value to be assigned
409
+ def start_location_lat=(start_location_lat)
410
+ if start_location_lat.nil?
411
+ fail ArgumentError, 'start_location_lat cannot be nil'
412
+ end
413
+
414
+ if start_location_lat > 90
415
+ fail ArgumentError, 'invalid value for "start_location_lat", must be smaller than or equal to 90.'
416
+ end
417
+
418
+ if start_location_lat < -90
419
+ fail ArgumentError, 'invalid value for "start_location_lat", must be greater than or equal to -90.'
420
+ end
421
+
422
+ @start_location_lat = start_location_lat
423
+ end
424
+
425
+ # Custom attribute writer method with validation
426
+ # @param [Object] start_location_long Value to be assigned
427
+ def start_location_long=(start_location_long)
428
+ if start_location_long.nil?
429
+ fail ArgumentError, 'start_location_long cannot be nil'
430
+ end
431
+
432
+ if start_location_long > 180
433
+ fail ArgumentError, 'invalid value for "start_location_long", must be smaller than or equal to 180.'
434
+ end
435
+
436
+ if start_location_long < -180
437
+ fail ArgumentError, 'invalid value for "start_location_long", must be greater than or equal to -180.'
438
+ end
439
+
440
+ @start_location_long = start_location_long
441
+ end
442
+
443
+ # Custom attribute writer method checking allowed values (enum).
444
+ # @param [Object] start_location_type Object to be assigned
445
+ def start_location_type=(start_location_type)
446
+ validator = EnumAttributeValidator.new('String', ["home", "office"])
447
+ unless validator.valid?(start_location_type)
448
+ fail ArgumentError, "invalid value for \"start_location_type\", must be one of #{validator.allowable_values}."
449
+ end
450
+ @start_location_type = start_location_type
451
+ end
452
+
453
+ # Checks equality by comparing each attribute.
454
+ # @param [Object] Object to be compared
455
+ def ==(o)
456
+ return true if self.equal?(o)
457
+ self.class == o.class &&
458
+ address == o.address &&
459
+ assignment_tier == o.assignment_tier &&
460
+ buddy_ids == o.buddy_ids &&
461
+ business_group_id == o.business_group_id &&
462
+ email == o.email &&
463
+ full_name == o.full_name &&
464
+ job_title == o.job_title &&
465
+ join_date == o.join_date &&
466
+ lead_ids == o.lead_ids &&
467
+ phone == o.phone &&
468
+ service_area_ids == o.service_area_ids &&
469
+ start_location_lat == o.start_location_lat &&
470
+ start_location_long == o.start_location_long &&
471
+ start_location_type == o.start_location_type
472
+ end
473
+
474
+ # @see the `==` method
475
+ # @param [Object] Object to be compared
476
+ def eql?(o)
477
+ self == o
478
+ end
479
+
480
+ # Calculates hash code according to all attributes.
481
+ # @return [Integer] Hash code
482
+ def hash
483
+ [address, assignment_tier, buddy_ids, business_group_id, email, full_name, job_title, join_date, lead_ids, phone, service_area_ids, start_location_lat, start_location_long, start_location_type].hash
484
+ end
485
+
486
+ # Builds the object from hash
487
+ # @param [Hash] attributes Model attributes in the form of hash
488
+ # @return [Object] Returns the model itself
489
+ def self.build_from_hash(attributes)
490
+ return nil unless attributes.is_a?(Hash)
491
+ attributes = attributes.transform_keys(&:to_sym)
492
+ transformed_hash = {}
493
+ openapi_types.each_pair do |key, type|
494
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
495
+ transformed_hash["#{key}"] = nil
496
+ elsif type =~ /\AArray<(.*)>/i
497
+ # check to ensure the input is an array given that the attribute
498
+ # is documented as an array but the input is not
499
+ if attributes[attribute_map[key]].is_a?(Array)
500
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
501
+ end
502
+ elsif !attributes[attribute_map[key]].nil?
503
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
504
+ end
505
+ end
506
+ new(transformed_hash)
507
+ end
508
+
509
+ # Deserializes the data based on type
510
+ # @param string type Data type
511
+ # @param string value Value to be deserialized
512
+ # @return [Object] Deserialized data
513
+ def self._deserialize(type, value)
514
+ case type.to_sym
515
+ when :Time
516
+ Time.parse(value)
517
+ when :Date
518
+ Date.parse(value)
519
+ when :String
520
+ value.to_s
521
+ when :Integer
522
+ value.to_i
523
+ when :Float
524
+ value.to_f
525
+ when :Boolean
526
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
527
+ true
528
+ else
529
+ false
530
+ end
531
+ when :Object
532
+ # generic object (usually a Hash), return directly
533
+ value
534
+ when /\AArray<(?<inner_type>.+)>\z/
535
+ inner_type = Regexp.last_match[:inner_type]
536
+ value.map { |v| _deserialize(inner_type, v) }
537
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
538
+ k_type = Regexp.last_match[:k_type]
539
+ v_type = Regexp.last_match[:v_type]
540
+ {}.tap do |hash|
541
+ value.each do |k, v|
542
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
543
+ end
544
+ end
545
+ else # model
546
+ # models (e.g. Pet) or oneOf
547
+ klass = Crisphive.const_get(type)
548
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
549
+ end
550
+ end
551
+
552
+ # Returns the string representation of the object
553
+ # @return [String] String presentation of the object
554
+ def to_s
555
+ to_hash.to_s
556
+ end
557
+
558
+ # to_body is an alias to to_hash (backward compatibility)
559
+ # @return [Hash] Returns the object in the form of hash
560
+ def to_body
561
+ to_hash
562
+ end
563
+
564
+ # Returns the object in the form of hash
565
+ # @return [Hash] Returns the object in the form of hash
566
+ def to_hash
567
+ hash = {}
568
+ self.class.attribute_map.each_pair do |attr, param|
569
+ value = self.send(attr)
570
+ if value.nil?
571
+ is_nullable = self.class.openapi_nullable.include?(attr)
572
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
573
+ end
574
+
575
+ hash[param] = _to_hash(value)
576
+ end
577
+ hash
578
+ end
579
+
580
+ # Outputs non-array value in the form of hash
581
+ # For object, use to_hash. Otherwise, just return the value
582
+ # @param [Object] value Any valid value
583
+ # @return [Hash] Returns the value in the form of hash
584
+ def _to_hash(value)
585
+ if value.is_a?(Array)
586
+ value.compact.map { |v| _to_hash(v) }
587
+ elsif value.is_a?(Hash)
588
+ {}.tap do |hash|
589
+ value.each { |k, v| hash[k] = _to_hash(v) }
590
+ end
591
+ elsif value.respond_to? :to_hash
592
+ value.to_hash
593
+ else
594
+ value
595
+ end
596
+ end
597
+
598
+ end
599
+
600
+ end