crisphive 0.1.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.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +219 -0
- data/Rakefile +10 -0
- data/crisphive.gemspec +40 -0
- data/git_push.sh +57 -0
- data/lib/crisphive/api/business_skill_api.rb +211 -0
- data/lib/crisphive/api/customer_api.rb +371 -0
- data/lib/crisphive/api/job_request_business_api.rb +449 -0
- data/lib/crisphive/api/job_types_api.rb +141 -0
- data/lib/crisphive/api/service_area_api.rb +148 -0
- data/lib/crisphive/api/technician_api.rb +163 -0
- data/lib/crisphive/api/vehicle_api.rb +157 -0
- data/lib/crisphive/api_client.rb +437 -0
- data/lib/crisphive/api_error.rb +58 -0
- data/lib/crisphive/configuration.rb +393 -0
- data/lib/crisphive/models/create_customer200_response.rb +250 -0
- data/lib/crisphive/models/create_job_request200_response.rb +250 -0
- data/lib/crisphive/models/customer.rb +235 -0
- data/lib/crisphive/models/customer_address.rb +295 -0
- data/lib/crisphive/models/customer_address_request.rb +475 -0
- data/lib/crisphive/models/customer_contact.rb +255 -0
- data/lib/crisphive/models/customer_create_request.rb +383 -0
- data/lib/crisphive/models/customer_create_response.rb +215 -0
- data/lib/crisphive/models/customer_list.rb +247 -0
- data/lib/crisphive/models/customer_list_item.rb +341 -0
- data/lib/crisphive/models/customer_profile.rb +321 -0
- data/lib/crisphive/models/customer_spending.rb +299 -0
- data/lib/crisphive/models/customer_tier_progress.rb +235 -0
- data/lib/crisphive/models/customer_update_request.rb +434 -0
- data/lib/crisphive/models/get_customer200_response.rb +250 -0
- data/lib/crisphive/models/get_job_request200_response.rb +250 -0
- data/lib/crisphive/models/get_job_request_timeline200_response.rb +250 -0
- data/lib/crisphive/models/get_job_type200_response.rb +250 -0
- data/lib/crisphive/models/get_service_area200_response.rb +250 -0
- data/lib/crisphive/models/get_technician200_response.rb +250 -0
- data/lib/crisphive/models/get_vehicle200_response.rb +250 -0
- data/lib/crisphive/models/job_date.rb +225 -0
- data/lib/crisphive/models/job_date_business_range.rb +263 -0
- data/lib/crisphive/models/job_date_period.rb +41 -0
- data/lib/crisphive/models/job_date_period_entry.rb +247 -0
- data/lib/crisphive/models/job_request.rb +537 -0
- data/lib/crisphive/models/job_request_action_audit_by.rb +259 -0
- data/lib/crisphive/models/job_request_action_audit_entry.rb +235 -0
- data/lib/crisphive/models/job_request_action_summary.rb +281 -0
- data/lib/crisphive/models/job_request_address_summary.rb +295 -0
- data/lib/crisphive/models/job_request_archive_summary.rb +245 -0
- data/lib/crisphive/models/job_request_arrival_window.rb +235 -0
- data/lib/crisphive/models/job_request_assigned_vehicle.rb +225 -0
- data/lib/crisphive/models/job_request_assignment_summary.rb +255 -0
- data/lib/crisphive/models/job_request_booking_windows.rb +247 -0
- data/lib/crisphive/models/job_request_business_time_range.rb +279 -0
- data/lib/crisphive/models/job_request_changes.rb +237 -0
- data/lib/crisphive/models/job_request_create_request.rb +339 -0
- data/lib/crisphive/models/job_request_create_response.rb +245 -0
- data/lib/crisphive/models/job_request_crew_member.rb +352 -0
- data/lib/crisphive/models/job_request_customer_summary.rb +245 -0
- data/lib/crisphive/models/job_request_day_windows.rb +227 -0
- data/lib/crisphive/models/job_request_job_date_business_range_request.rb +279 -0
- data/lib/crisphive/models/job_request_job_date_period_request.rb +268 -0
- data/lib/crisphive/models/job_request_job_date_request.rb +269 -0
- data/lib/crisphive/models/job_request_list.rb +227 -0
- data/lib/crisphive/models/job_request_period.rb +261 -0
- data/lib/crisphive/models/job_request_quote_summary.rb +245 -0
- data/lib/crisphive/models/job_request_rating_summary.rb +245 -0
- data/lib/crisphive/models/job_request_schedule.rb +289 -0
- data/lib/crisphive/models/job_request_session.rb +274 -0
- data/lib/crisphive/models/job_request_skill_summary.rb +255 -0
- data/lib/crisphive/models/job_request_status_summary.rb +225 -0
- data/lib/crisphive/models/job_request_technician_info.rb +265 -0
- data/lib/crisphive/models/job_request_timeline.rb +257 -0
- data/lib/crisphive/models/job_request_timeline_action.rb +311 -0
- data/lib/crisphive/models/job_request_timeline_event.rb +291 -0
- data/lib/crisphive/models/job_type.rb +309 -0
- data/lib/crisphive/models/list_customers200_response.rb +250 -0
- data/lib/crisphive/models/list_job_request_booking_windows200_response.rb +250 -0
- data/lib/crisphive/models/list_job_request_changes200_response.rb +250 -0
- data/lib/crisphive/models/list_job_requests200_response.rb +250 -0
- data/lib/crisphive/models/list_job_types200_response.rb +252 -0
- data/lib/crisphive/models/list_service_areas200_response.rb +250 -0
- data/lib/crisphive/models/list_skill_categories200_response.rb +250 -0
- data/lib/crisphive/models/list_skills200_response.rb +250 -0
- data/lib/crisphive/models/list_skills_by_category200_response.rb +250 -0
- data/lib/crisphive/models/list_technicians200_response.rb +250 -0
- data/lib/crisphive/models/list_vehicles200_response.rb +250 -0
- data/lib/crisphive/models/pagination.rb +250 -0
- data/lib/crisphive/models/response_envelope.rb +244 -0
- data/lib/crisphive/models/service_area.rb +315 -0
- data/lib/crisphive/models/service_area_list.rb +227 -0
- data/lib/crisphive/models/skill.rb +278 -0
- data/lib/crisphive/models/skill_by_category_list.rb +225 -0
- data/lib/crisphive/models/skill_category.rb +250 -0
- data/lib/crisphive/models/skill_category_list.rb +225 -0
- data/lib/crisphive/models/skill_list.rb +217 -0
- data/lib/crisphive/models/skill_summary.rb +255 -0
- data/lib/crisphive/models/technician.rb +499 -0
- data/lib/crisphive/models/technician_address.rb +275 -0
- data/lib/crisphive/models/technician_lead_ref.rb +225 -0
- data/lib/crisphive/models/technician_list.rb +247 -0
- data/lib/crisphive/models/technician_service_area_ref.rb +225 -0
- data/lib/crisphive/models/technician_status.rb +41 -0
- data/lib/crisphive/models/vehicle.rb +413 -0
- data/lib/crisphive/models/vehicle_list.rb +247 -0
- data/lib/crisphive/models/vehicle_owner.rb +225 -0
- data/lib/crisphive/version.rb +15 -0
- data/lib/crisphive.rb +134 -0
- data/spec/spec_helper.rb +111 -0
- metadata +220 -0
|
@@ -0,0 +1,475 @@
|
|
|
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 CustomerAddressRequest
|
|
18
|
+
attr_accessor :city
|
|
19
|
+
|
|
20
|
+
attr_accessor :country
|
|
21
|
+
|
|
22
|
+
attr_accessor :formatted
|
|
23
|
+
|
|
24
|
+
attr_accessor :latitude
|
|
25
|
+
|
|
26
|
+
attr_accessor :line
|
|
27
|
+
|
|
28
|
+
attr_accessor :line2
|
|
29
|
+
|
|
30
|
+
attr_accessor :longitude
|
|
31
|
+
|
|
32
|
+
attr_accessor :postal_code
|
|
33
|
+
|
|
34
|
+
attr_accessor :state
|
|
35
|
+
|
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
|
+
def self.attribute_map
|
|
38
|
+
{
|
|
39
|
+
:'city' => :'city',
|
|
40
|
+
:'country' => :'country',
|
|
41
|
+
:'formatted' => :'formatted',
|
|
42
|
+
:'latitude' => :'latitude',
|
|
43
|
+
:'line' => :'line',
|
|
44
|
+
:'line2' => :'line2',
|
|
45
|
+
:'longitude' => :'longitude',
|
|
46
|
+
:'postal_code' => :'postal_code',
|
|
47
|
+
:'state' => :'state'
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Returns all the JSON keys this model knows about
|
|
52
|
+
def self.acceptable_attributes
|
|
53
|
+
attribute_map.values
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Attribute type mapping.
|
|
57
|
+
def self.openapi_types
|
|
58
|
+
{
|
|
59
|
+
:'city' => :'String',
|
|
60
|
+
:'country' => :'String',
|
|
61
|
+
:'formatted' => :'String',
|
|
62
|
+
:'latitude' => :'Float',
|
|
63
|
+
:'line' => :'String',
|
|
64
|
+
:'line2' => :'String',
|
|
65
|
+
:'longitude' => :'Float',
|
|
66
|
+
:'postal_code' => :'String',
|
|
67
|
+
:'state' => :'String'
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# List of attributes with nullable: true
|
|
72
|
+
def self.openapi_nullable
|
|
73
|
+
Set.new([
|
|
74
|
+
])
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Initializes the object
|
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
79
|
+
def initialize(attributes = {})
|
|
80
|
+
if (!attributes.is_a?(Hash))
|
|
81
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Crisphive::CustomerAddressRequest` initialize method"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
85
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
86
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
87
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Crisphive::CustomerAddressRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
88
|
+
end
|
|
89
|
+
h[k.to_sym] = v
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if attributes.key?(:'city')
|
|
93
|
+
self.city = attributes[:'city']
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
if attributes.key?(:'country')
|
|
97
|
+
self.country = attributes[:'country']
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'formatted')
|
|
101
|
+
self.formatted = attributes[:'formatted']
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'latitude')
|
|
105
|
+
self.latitude = attributes[:'latitude']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'line')
|
|
109
|
+
self.line = attributes[:'line']
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'line2')
|
|
113
|
+
self.line2 = attributes[:'line2']
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'longitude')
|
|
117
|
+
self.longitude = attributes[:'longitude']
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'postal_code')
|
|
121
|
+
self.postal_code = attributes[:'postal_code']
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'state')
|
|
125
|
+
self.state = attributes[:'state']
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
130
|
+
# @return Array for valid properties with the reasons
|
|
131
|
+
def list_invalid_properties
|
|
132
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
133
|
+
invalid_properties = Array.new
|
|
134
|
+
if !@city.nil? && @city.to_s.length > 100
|
|
135
|
+
invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 100.')
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if !@country.nil? && @country.to_s.length > 100
|
|
139
|
+
invalid_properties.push('invalid value for "country", the character length must be smaller than or equal to 100.')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if !@formatted.nil? && @formatted.to_s.length > 500
|
|
143
|
+
invalid_properties.push('invalid value for "formatted", the character length must be smaller than or equal to 500.')
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if !@latitude.nil? && @latitude > 90
|
|
147
|
+
invalid_properties.push('invalid value for "latitude", must be smaller than or equal to 90.')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if !@latitude.nil? && @latitude < -90
|
|
151
|
+
invalid_properties.push('invalid value for "latitude", must be greater than or equal to -90.')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if !@line.nil? && @line.to_s.length > 255
|
|
155
|
+
invalid_properties.push('invalid value for "line", the character length must be smaller than or equal to 255.')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if !@line2.nil? && @line2.to_s.length > 255
|
|
159
|
+
invalid_properties.push('invalid value for "line2", the character length must be smaller than or equal to 255.')
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if !@longitude.nil? && @longitude > 180
|
|
163
|
+
invalid_properties.push('invalid value for "longitude", must be smaller than or equal to 180.')
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if !@longitude.nil? && @longitude < -180
|
|
167
|
+
invalid_properties.push('invalid value for "longitude", must be greater than or equal to -180.')
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if !@postal_code.nil? && @postal_code.to_s.length > 32
|
|
171
|
+
invalid_properties.push('invalid value for "postal_code", the character length must be smaller than or equal to 32.')
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if !@state.nil? && @state.to_s.length > 100
|
|
175
|
+
invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 100.')
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
invalid_properties
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Check to see if the all the properties in the model are valid
|
|
182
|
+
# @return true if the model is valid
|
|
183
|
+
def valid?
|
|
184
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
185
|
+
return false if !@city.nil? && @city.to_s.length > 100
|
|
186
|
+
return false if !@country.nil? && @country.to_s.length > 100
|
|
187
|
+
return false if !@formatted.nil? && @formatted.to_s.length > 500
|
|
188
|
+
return false if !@latitude.nil? && @latitude > 90
|
|
189
|
+
return false if !@latitude.nil? && @latitude < -90
|
|
190
|
+
return false if !@line.nil? && @line.to_s.length > 255
|
|
191
|
+
return false if !@line2.nil? && @line2.to_s.length > 255
|
|
192
|
+
return false if !@longitude.nil? && @longitude > 180
|
|
193
|
+
return false if !@longitude.nil? && @longitude < -180
|
|
194
|
+
return false if !@postal_code.nil? && @postal_code.to_s.length > 32
|
|
195
|
+
return false if !@state.nil? && @state.to_s.length > 100
|
|
196
|
+
true
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Custom attribute writer method with validation
|
|
200
|
+
# @param [Object] city Value to be assigned
|
|
201
|
+
def city=(city)
|
|
202
|
+
if city.nil?
|
|
203
|
+
fail ArgumentError, 'city cannot be nil'
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
if city.to_s.length > 100
|
|
207
|
+
fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 100.'
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
@city = city
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Custom attribute writer method with validation
|
|
214
|
+
# @param [Object] country Value to be assigned
|
|
215
|
+
def country=(country)
|
|
216
|
+
if country.nil?
|
|
217
|
+
fail ArgumentError, 'country cannot be nil'
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if country.to_s.length > 100
|
|
221
|
+
fail ArgumentError, 'invalid value for "country", the character length must be smaller than or equal to 100.'
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
@country = country
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Custom attribute writer method with validation
|
|
228
|
+
# @param [Object] formatted Value to be assigned
|
|
229
|
+
def formatted=(formatted)
|
|
230
|
+
if formatted.nil?
|
|
231
|
+
fail ArgumentError, 'formatted cannot be nil'
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
if formatted.to_s.length > 500
|
|
235
|
+
fail ArgumentError, 'invalid value for "formatted", the character length must be smaller than or equal to 500.'
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
@formatted = formatted
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Custom attribute writer method with validation
|
|
242
|
+
# @param [Object] latitude Value to be assigned
|
|
243
|
+
def latitude=(latitude)
|
|
244
|
+
if latitude.nil?
|
|
245
|
+
fail ArgumentError, 'latitude cannot be nil'
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
if latitude > 90
|
|
249
|
+
fail ArgumentError, 'invalid value for "latitude", must be smaller than or equal to 90.'
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
if latitude < -90
|
|
253
|
+
fail ArgumentError, 'invalid value for "latitude", must be greater than or equal to -90.'
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
@latitude = latitude
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Custom attribute writer method with validation
|
|
260
|
+
# @param [Object] line Value to be assigned
|
|
261
|
+
def line=(line)
|
|
262
|
+
if line.nil?
|
|
263
|
+
fail ArgumentError, 'line cannot be nil'
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
if line.to_s.length > 255
|
|
267
|
+
fail ArgumentError, 'invalid value for "line", the character length must be smaller than or equal to 255.'
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
@line = line
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Custom attribute writer method with validation
|
|
274
|
+
# @param [Object] line2 Value to be assigned
|
|
275
|
+
def line2=(line2)
|
|
276
|
+
if line2.nil?
|
|
277
|
+
fail ArgumentError, 'line2 cannot be nil'
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
if line2.to_s.length > 255
|
|
281
|
+
fail ArgumentError, 'invalid value for "line2", the character length must be smaller than or equal to 255.'
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
@line2 = line2
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Custom attribute writer method with validation
|
|
288
|
+
# @param [Object] longitude Value to be assigned
|
|
289
|
+
def longitude=(longitude)
|
|
290
|
+
if longitude.nil?
|
|
291
|
+
fail ArgumentError, 'longitude cannot be nil'
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
if longitude > 180
|
|
295
|
+
fail ArgumentError, 'invalid value for "longitude", must be smaller than or equal to 180.'
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
if longitude < -180
|
|
299
|
+
fail ArgumentError, 'invalid value for "longitude", must be greater than or equal to -180.'
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
@longitude = longitude
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Custom attribute writer method with validation
|
|
306
|
+
# @param [Object] postal_code Value to be assigned
|
|
307
|
+
def postal_code=(postal_code)
|
|
308
|
+
if postal_code.nil?
|
|
309
|
+
fail ArgumentError, 'postal_code cannot be nil'
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
if postal_code.to_s.length > 32
|
|
313
|
+
fail ArgumentError, 'invalid value for "postal_code", the character length must be smaller than or equal to 32.'
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
@postal_code = postal_code
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# Custom attribute writer method with validation
|
|
320
|
+
# @param [Object] state Value to be assigned
|
|
321
|
+
def state=(state)
|
|
322
|
+
if state.nil?
|
|
323
|
+
fail ArgumentError, 'state cannot be nil'
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
if state.to_s.length > 100
|
|
327
|
+
fail ArgumentError, 'invalid value for "state", the character length must be smaller than or equal to 100.'
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
@state = state
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# Checks equality by comparing each attribute.
|
|
334
|
+
# @param [Object] Object to be compared
|
|
335
|
+
def ==(o)
|
|
336
|
+
return true if self.equal?(o)
|
|
337
|
+
self.class == o.class &&
|
|
338
|
+
city == o.city &&
|
|
339
|
+
country == o.country &&
|
|
340
|
+
formatted == o.formatted &&
|
|
341
|
+
latitude == o.latitude &&
|
|
342
|
+
line == o.line &&
|
|
343
|
+
line2 == o.line2 &&
|
|
344
|
+
longitude == o.longitude &&
|
|
345
|
+
postal_code == o.postal_code &&
|
|
346
|
+
state == o.state
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# @see the `==` method
|
|
350
|
+
# @param [Object] Object to be compared
|
|
351
|
+
def eql?(o)
|
|
352
|
+
self == o
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
# Calculates hash code according to all attributes.
|
|
356
|
+
# @return [Integer] Hash code
|
|
357
|
+
def hash
|
|
358
|
+
[city, country, formatted, latitude, line, line2, longitude, postal_code, state].hash
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
# Builds the object from hash
|
|
362
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
363
|
+
# @return [Object] Returns the model itself
|
|
364
|
+
def self.build_from_hash(attributes)
|
|
365
|
+
return nil unless attributes.is_a?(Hash)
|
|
366
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
367
|
+
transformed_hash = {}
|
|
368
|
+
openapi_types.each_pair do |key, type|
|
|
369
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
370
|
+
transformed_hash["#{key}"] = nil
|
|
371
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
372
|
+
# check to ensure the input is an array given that the attribute
|
|
373
|
+
# is documented as an array but the input is not
|
|
374
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
375
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
376
|
+
end
|
|
377
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
378
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
new(transformed_hash)
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
# Deserializes the data based on type
|
|
385
|
+
# @param string type Data type
|
|
386
|
+
# @param string value Value to be deserialized
|
|
387
|
+
# @return [Object] Deserialized data
|
|
388
|
+
def self._deserialize(type, value)
|
|
389
|
+
case type.to_sym
|
|
390
|
+
when :Time
|
|
391
|
+
Time.parse(value)
|
|
392
|
+
when :Date
|
|
393
|
+
Date.parse(value)
|
|
394
|
+
when :String
|
|
395
|
+
value.to_s
|
|
396
|
+
when :Integer
|
|
397
|
+
value.to_i
|
|
398
|
+
when :Float
|
|
399
|
+
value.to_f
|
|
400
|
+
when :Boolean
|
|
401
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
402
|
+
true
|
|
403
|
+
else
|
|
404
|
+
false
|
|
405
|
+
end
|
|
406
|
+
when :Object
|
|
407
|
+
# generic object (usually a Hash), return directly
|
|
408
|
+
value
|
|
409
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
410
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
411
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
412
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
413
|
+
k_type = Regexp.last_match[:k_type]
|
|
414
|
+
v_type = Regexp.last_match[:v_type]
|
|
415
|
+
{}.tap do |hash|
|
|
416
|
+
value.each do |k, v|
|
|
417
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
418
|
+
end
|
|
419
|
+
end
|
|
420
|
+
else # model
|
|
421
|
+
# models (e.g. Pet) or oneOf
|
|
422
|
+
klass = Crisphive.const_get(type)
|
|
423
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
424
|
+
end
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
# Returns the string representation of the object
|
|
428
|
+
# @return [String] String presentation of the object
|
|
429
|
+
def to_s
|
|
430
|
+
to_hash.to_s
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
434
|
+
# @return [Hash] Returns the object in the form of hash
|
|
435
|
+
def to_body
|
|
436
|
+
to_hash
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
# Returns the object in the form of hash
|
|
440
|
+
# @return [Hash] Returns the object in the form of hash
|
|
441
|
+
def to_hash
|
|
442
|
+
hash = {}
|
|
443
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
444
|
+
value = self.send(attr)
|
|
445
|
+
if value.nil?
|
|
446
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
447
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
hash[param] = _to_hash(value)
|
|
451
|
+
end
|
|
452
|
+
hash
|
|
453
|
+
end
|
|
454
|
+
|
|
455
|
+
# Outputs non-array value in the form of hash
|
|
456
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
457
|
+
# @param [Object] value Any valid value
|
|
458
|
+
# @return [Hash] Returns the value in the form of hash
|
|
459
|
+
def _to_hash(value)
|
|
460
|
+
if value.is_a?(Array)
|
|
461
|
+
value.compact.map { |v| _to_hash(v) }
|
|
462
|
+
elsif value.is_a?(Hash)
|
|
463
|
+
{}.tap do |hash|
|
|
464
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
465
|
+
end
|
|
466
|
+
elsif value.respond_to? :to_hash
|
|
467
|
+
value.to_hash
|
|
468
|
+
else
|
|
469
|
+
value
|
|
470
|
+
end
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
end
|