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,507 @@
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 TechnicianUpdateRequest
18
+ # Home address (the day-start point when start_location_type=home).
19
+ attr_accessor :address
20
+
21
+ # Crew tier: lead / buddy / float (float = excluded from auto crew-assign).
22
+ attr_accessor :assignment_tier
23
+
24
+ # Role group. Discover IDs via GET /permission/groups.
25
+ attr_accessor :business_group_id
26
+
27
+ # Email address. At least one of phone/email is required.
28
+ attr_accessor :email
29
+
30
+ # The person's full display name. Required; max 255 chars.
31
+ attr_accessor :full_name
32
+
33
+ # Display title.
34
+ attr_accessor :job_title
35
+
36
+ # First working day (YYYY-MM-DD).
37
+ attr_accessor :join_date
38
+
39
+ # At least one of phone/email is required.
40
+ attr_accessor :phone
41
+
42
+ # Explicit day-start latitude in decimal degrees (-90..90); when set it wins over the address geocode.
43
+ attr_accessor :start_location_lat
44
+
45
+ # Explicit day-start longitude in decimal degrees (-180..180); when set it wins over the address geocode.
46
+ attr_accessor :start_location_long
47
+
48
+ # Day-start point: home or office; explicit coordinates win when set.
49
+ attr_accessor :start_location_type
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'address' => :'address',
77
+ :'assignment_tier' => :'assignment_tier',
78
+ :'business_group_id' => :'business_group_id',
79
+ :'email' => :'email',
80
+ :'full_name' => :'full_name',
81
+ :'job_title' => :'job_title',
82
+ :'join_date' => :'join_date',
83
+ :'phone' => :'phone',
84
+ :'start_location_lat' => :'start_location_lat',
85
+ :'start_location_long' => :'start_location_long',
86
+ :'start_location_type' => :'start_location_type'
87
+ }
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'address' => :'TechnicianAddressInput',
99
+ :'assignment_tier' => :'String',
100
+ :'business_group_id' => :'String',
101
+ :'email' => :'String',
102
+ :'full_name' => :'String',
103
+ :'job_title' => :'String',
104
+ :'join_date' => :'Date',
105
+ :'phone' => :'String',
106
+ :'start_location_lat' => :'Float',
107
+ :'start_location_long' => :'Float',
108
+ :'start_location_type' => :'String'
109
+ }
110
+ end
111
+
112
+ # List of attributes with nullable: true
113
+ def self.openapi_nullable
114
+ Set.new([
115
+ ])
116
+ end
117
+
118
+ # Initializes the object
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ def initialize(attributes = {})
121
+ if (!attributes.is_a?(Hash))
122
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::TechnicianUpdateRequest` initialize method"
123
+ end
124
+
125
+ # check to see if the attribute exists and convert string to symbol for hash key
126
+ attributes = attributes.each_with_object({}) { |(k, v), h|
127
+ if (!self.class.attribute_map.key?(k.to_sym))
128
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::TechnicianUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
129
+ end
130
+ h[k.to_sym] = v
131
+ }
132
+
133
+ if attributes.key?(:'address')
134
+ self.address = attributes[:'address']
135
+ end
136
+
137
+ if attributes.key?(:'assignment_tier')
138
+ self.assignment_tier = attributes[:'assignment_tier']
139
+ end
140
+
141
+ if attributes.key?(:'business_group_id')
142
+ self.business_group_id = attributes[:'business_group_id']
143
+ else
144
+ self.business_group_id = nil
145
+ end
146
+
147
+ if attributes.key?(:'email')
148
+ self.email = attributes[:'email']
149
+ end
150
+
151
+ if attributes.key?(:'full_name')
152
+ self.full_name = attributes[:'full_name']
153
+ else
154
+ self.full_name = nil
155
+ end
156
+
157
+ if attributes.key?(:'job_title')
158
+ self.job_title = attributes[:'job_title']
159
+ end
160
+
161
+ if attributes.key?(:'join_date')
162
+ self.join_date = attributes[:'join_date']
163
+ end
164
+
165
+ if attributes.key?(:'phone')
166
+ self.phone = attributes[:'phone']
167
+ end
168
+
169
+ if attributes.key?(:'start_location_lat')
170
+ self.start_location_lat = attributes[:'start_location_lat']
171
+ end
172
+
173
+ if attributes.key?(:'start_location_long')
174
+ self.start_location_long = attributes[:'start_location_long']
175
+ end
176
+
177
+ if attributes.key?(:'start_location_type')
178
+ self.start_location_type = attributes[:'start_location_type']
179
+ end
180
+ end
181
+
182
+ # Show invalid properties with the reasons. Usually used together with valid?
183
+ # @return Array for valid properties with the reasons
184
+ def list_invalid_properties
185
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
186
+ invalid_properties = Array.new
187
+ if @business_group_id.nil?
188
+ invalid_properties.push('invalid value for "business_group_id", business_group_id cannot be nil.')
189
+ end
190
+
191
+ if !@email.nil? && @email.to_s.length > 255
192
+ invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 255.')
193
+ end
194
+
195
+ if @full_name.nil?
196
+ invalid_properties.push('invalid value for "full_name", full_name cannot be nil.')
197
+ end
198
+
199
+ if @full_name.to_s.length > 255
200
+ invalid_properties.push('invalid value for "full_name", the character length must be smaller than or equal to 255.')
201
+ end
202
+
203
+ if !@job_title.nil? && @job_title.to_s.length > 255
204
+ invalid_properties.push('invalid value for "job_title", the character length must be smaller than or equal to 255.')
205
+ end
206
+
207
+ if !@phone.nil? && @phone.to_s.length > 50
208
+ invalid_properties.push('invalid value for "phone", the character length must be smaller than or equal to 50.')
209
+ end
210
+
211
+ if !@start_location_lat.nil? && @start_location_lat > 90
212
+ invalid_properties.push('invalid value for "start_location_lat", must be smaller than or equal to 90.')
213
+ end
214
+
215
+ if !@start_location_lat.nil? && @start_location_lat < -90
216
+ invalid_properties.push('invalid value for "start_location_lat", must be greater than or equal to -90.')
217
+ end
218
+
219
+ if !@start_location_long.nil? && @start_location_long > 180
220
+ invalid_properties.push('invalid value for "start_location_long", must be smaller than or equal to 180.')
221
+ end
222
+
223
+ if !@start_location_long.nil? && @start_location_long < -180
224
+ invalid_properties.push('invalid value for "start_location_long", must be greater than or equal to -180.')
225
+ end
226
+
227
+ invalid_properties
228
+ end
229
+
230
+ # Check to see if the all the properties in the model are valid
231
+ # @return true if the model is valid
232
+ def valid?
233
+ warn '[DEPRECATED] the `valid?` method is obsolete'
234
+ assignment_tier_validator = EnumAttributeValidator.new('String', ["lead", "buddy", "float"])
235
+ return false unless assignment_tier_validator.valid?(@assignment_tier)
236
+ return false if @business_group_id.nil?
237
+ return false if !@email.nil? && @email.to_s.length > 255
238
+ return false if @full_name.nil?
239
+ return false if @full_name.to_s.length > 255
240
+ return false if !@job_title.nil? && @job_title.to_s.length > 255
241
+ return false if !@phone.nil? && @phone.to_s.length > 50
242
+ return false if !@start_location_lat.nil? && @start_location_lat > 90
243
+ return false if !@start_location_lat.nil? && @start_location_lat < -90
244
+ return false if !@start_location_long.nil? && @start_location_long > 180
245
+ return false if !@start_location_long.nil? && @start_location_long < -180
246
+ start_location_type_validator = EnumAttributeValidator.new('String', ["home", "office"])
247
+ return false unless start_location_type_validator.valid?(@start_location_type)
248
+ true
249
+ end
250
+
251
+ # Custom attribute writer method checking allowed values (enum).
252
+ # @param [Object] assignment_tier Object to be assigned
253
+ def assignment_tier=(assignment_tier)
254
+ validator = EnumAttributeValidator.new('String', ["lead", "buddy", "float"])
255
+ unless validator.valid?(assignment_tier)
256
+ fail ArgumentError, "invalid value for \"assignment_tier\", must be one of #{validator.allowable_values}."
257
+ end
258
+ @assignment_tier = assignment_tier
259
+ end
260
+
261
+ # Custom attribute writer method with validation
262
+ # @param [Object] email Value to be assigned
263
+ def email=(email)
264
+ if email.nil?
265
+ fail ArgumentError, 'email cannot be nil'
266
+ end
267
+
268
+ if email.to_s.length > 255
269
+ fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 255.'
270
+ end
271
+
272
+ @email = email
273
+ end
274
+
275
+ # Custom attribute writer method with validation
276
+ # @param [Object] full_name Value to be assigned
277
+ def full_name=(full_name)
278
+ if full_name.nil?
279
+ fail ArgumentError, 'full_name cannot be nil'
280
+ end
281
+
282
+ if full_name.to_s.length > 255
283
+ fail ArgumentError, 'invalid value for "full_name", the character length must be smaller than or equal to 255.'
284
+ end
285
+
286
+ @full_name = full_name
287
+ end
288
+
289
+ # Custom attribute writer method with validation
290
+ # @param [Object] job_title Value to be assigned
291
+ def job_title=(job_title)
292
+ if job_title.nil?
293
+ fail ArgumentError, 'job_title cannot be nil'
294
+ end
295
+
296
+ if job_title.to_s.length > 255
297
+ fail ArgumentError, 'invalid value for "job_title", the character length must be smaller than or equal to 255.'
298
+ end
299
+
300
+ @job_title = job_title
301
+ end
302
+
303
+ # Custom attribute writer method with validation
304
+ # @param [Object] phone Value to be assigned
305
+ def phone=(phone)
306
+ if phone.nil?
307
+ fail ArgumentError, 'phone cannot be nil'
308
+ end
309
+
310
+ if phone.to_s.length > 50
311
+ fail ArgumentError, 'invalid value for "phone", the character length must be smaller than or equal to 50.'
312
+ end
313
+
314
+ @phone = phone
315
+ end
316
+
317
+ # Custom attribute writer method with validation
318
+ # @param [Object] start_location_lat Value to be assigned
319
+ def start_location_lat=(start_location_lat)
320
+ if start_location_lat.nil?
321
+ fail ArgumentError, 'start_location_lat cannot be nil'
322
+ end
323
+
324
+ if start_location_lat > 90
325
+ fail ArgumentError, 'invalid value for "start_location_lat", must be smaller than or equal to 90.'
326
+ end
327
+
328
+ if start_location_lat < -90
329
+ fail ArgumentError, 'invalid value for "start_location_lat", must be greater than or equal to -90.'
330
+ end
331
+
332
+ @start_location_lat = start_location_lat
333
+ end
334
+
335
+ # Custom attribute writer method with validation
336
+ # @param [Object] start_location_long Value to be assigned
337
+ def start_location_long=(start_location_long)
338
+ if start_location_long.nil?
339
+ fail ArgumentError, 'start_location_long cannot be nil'
340
+ end
341
+
342
+ if start_location_long > 180
343
+ fail ArgumentError, 'invalid value for "start_location_long", must be smaller than or equal to 180.'
344
+ end
345
+
346
+ if start_location_long < -180
347
+ fail ArgumentError, 'invalid value for "start_location_long", must be greater than or equal to -180.'
348
+ end
349
+
350
+ @start_location_long = start_location_long
351
+ end
352
+
353
+ # Custom attribute writer method checking allowed values (enum).
354
+ # @param [Object] start_location_type Object to be assigned
355
+ def start_location_type=(start_location_type)
356
+ validator = EnumAttributeValidator.new('String', ["home", "office"])
357
+ unless validator.valid?(start_location_type)
358
+ fail ArgumentError, "invalid value for \"start_location_type\", must be one of #{validator.allowable_values}."
359
+ end
360
+ @start_location_type = start_location_type
361
+ end
362
+
363
+ # Checks equality by comparing each attribute.
364
+ # @param [Object] Object to be compared
365
+ def ==(o)
366
+ return true if self.equal?(o)
367
+ self.class == o.class &&
368
+ address == o.address &&
369
+ assignment_tier == o.assignment_tier &&
370
+ business_group_id == o.business_group_id &&
371
+ email == o.email &&
372
+ full_name == o.full_name &&
373
+ job_title == o.job_title &&
374
+ join_date == o.join_date &&
375
+ phone == o.phone &&
376
+ start_location_lat == o.start_location_lat &&
377
+ start_location_long == o.start_location_long &&
378
+ start_location_type == o.start_location_type
379
+ end
380
+
381
+ # @see the `==` method
382
+ # @param [Object] Object to be compared
383
+ def eql?(o)
384
+ self == o
385
+ end
386
+
387
+ # Calculates hash code according to all attributes.
388
+ # @return [Integer] Hash code
389
+ def hash
390
+ [address, assignment_tier, business_group_id, email, full_name, job_title, join_date, phone, start_location_lat, start_location_long, start_location_type].hash
391
+ end
392
+
393
+ # Builds the object from hash
394
+ # @param [Hash] attributes Model attributes in the form of hash
395
+ # @return [Object] Returns the model itself
396
+ def self.build_from_hash(attributes)
397
+ return nil unless attributes.is_a?(Hash)
398
+ attributes = attributes.transform_keys(&:to_sym)
399
+ transformed_hash = {}
400
+ openapi_types.each_pair do |key, type|
401
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
402
+ transformed_hash["#{key}"] = nil
403
+ elsif type =~ /\AArray<(.*)>/i
404
+ # check to ensure the input is an array given that the attribute
405
+ # is documented as an array but the input is not
406
+ if attributes[attribute_map[key]].is_a?(Array)
407
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
408
+ end
409
+ elsif !attributes[attribute_map[key]].nil?
410
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
411
+ end
412
+ end
413
+ new(transformed_hash)
414
+ end
415
+
416
+ # Deserializes the data based on type
417
+ # @param string type Data type
418
+ # @param string value Value to be deserialized
419
+ # @return [Object] Deserialized data
420
+ def self._deserialize(type, value)
421
+ case type.to_sym
422
+ when :Time
423
+ Time.parse(value)
424
+ when :Date
425
+ Date.parse(value)
426
+ when :String
427
+ value.to_s
428
+ when :Integer
429
+ value.to_i
430
+ when :Float
431
+ value.to_f
432
+ when :Boolean
433
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
434
+ true
435
+ else
436
+ false
437
+ end
438
+ when :Object
439
+ # generic object (usually a Hash), return directly
440
+ value
441
+ when /\AArray<(?<inner_type>.+)>\z/
442
+ inner_type = Regexp.last_match[:inner_type]
443
+ value.map { |v| _deserialize(inner_type, v) }
444
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
445
+ k_type = Regexp.last_match[:k_type]
446
+ v_type = Regexp.last_match[:v_type]
447
+ {}.tap do |hash|
448
+ value.each do |k, v|
449
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
450
+ end
451
+ end
452
+ else # model
453
+ # models (e.g. Pet) or oneOf
454
+ klass = Crisphive.const_get(type)
455
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
456
+ end
457
+ end
458
+
459
+ # Returns the string representation of the object
460
+ # @return [String] String presentation of the object
461
+ def to_s
462
+ to_hash.to_s
463
+ end
464
+
465
+ # to_body is an alias to to_hash (backward compatibility)
466
+ # @return [Hash] Returns the object in the form of hash
467
+ def to_body
468
+ to_hash
469
+ end
470
+
471
+ # Returns the object in the form of hash
472
+ # @return [Hash] Returns the object in the form of hash
473
+ def to_hash
474
+ hash = {}
475
+ self.class.attribute_map.each_pair do |attr, param|
476
+ value = self.send(attr)
477
+ if value.nil?
478
+ is_nullable = self.class.openapi_nullable.include?(attr)
479
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
480
+ end
481
+
482
+ hash[param] = _to_hash(value)
483
+ end
484
+ hash
485
+ end
486
+
487
+ # Outputs non-array value in the form of hash
488
+ # For object, use to_hash. Otherwise, just return the value
489
+ # @param [Object] value Any valid value
490
+ # @return [Hash] Returns the value in the form of hash
491
+ def _to_hash(value)
492
+ if value.is_a?(Array)
493
+ value.compact.map { |v| _to_hash(v) }
494
+ elsif value.is_a?(Hash)
495
+ {}.tap do |hash|
496
+ value.each { |k, v| hash[k] = _to_hash(v) }
497
+ end
498
+ elsif value.respond_to? :to_hash
499
+ value.to_hash
500
+ else
501
+ value
502
+ end
503
+ end
504
+
505
+ end
506
+
507
+ end