gonebusy-ruby-client 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +1963 -0
  4. data/lib/gonebusy/api_helper.rb +149 -0
  5. data/lib/gonebusy/configuration.rb +16 -0
  6. data/lib/gonebusy/controllers/base_controller.rb +45 -0
  7. data/lib/gonebusy/controllers/bookings_controller.rb +298 -0
  8. data/lib/gonebusy/controllers/categories_controller.rb +180 -0
  9. data/lib/gonebusy/controllers/pricing_models_controller.rb +241 -0
  10. data/lib/gonebusy/controllers/resources_controller.rb +355 -0
  11. data/lib/gonebusy/controllers/schedules_controller.rb +426 -0
  12. data/lib/gonebusy/controllers/search_controller.rb +64 -0
  13. data/lib/gonebusy/controllers/services_controller.rb +367 -0
  14. data/lib/gonebusy/controllers/users_controller.rb +288 -0
  15. data/lib/gonebusy/exceptions/api_exception.rb +16 -0
  16. data/lib/gonebusy/exceptions/entities_error_exception.rb +27 -0
  17. data/lib/gonebusy/gonebusy_client.rb +58 -0
  18. data/lib/gonebusy/http/auth/custom_auth.rb +16 -0
  19. data/lib/gonebusy/http/faraday_client.rb +41 -0
  20. data/lib/gonebusy/http/http_call_back.rb +17 -0
  21. data/lib/gonebusy/http/http_client.rb +82 -0
  22. data/lib/gonebusy/http/http_context.rb +15 -0
  23. data/lib/gonebusy/http/http_method_enum.rb +7 -0
  24. data/lib/gonebusy/http/http_request.rb +44 -0
  25. data/lib/gonebusy/http/http_response.rb +19 -0
  26. data/lib/gonebusy/models/base_model.rb +32 -0
  27. data/lib/gonebusy/models/cancel_booking_by_id_response.rb +35 -0
  28. data/lib/gonebusy/models/create_booking_body.rb +80 -0
  29. data/lib/gonebusy/models/create_booking_response.rb +35 -0
  30. data/lib/gonebusy/models/create_category_body.rb +71 -0
  31. data/lib/gonebusy/models/create_category_response.rb +35 -0
  32. data/lib/gonebusy/models/create_pricing_model_body.rb +80 -0
  33. data/lib/gonebusy/models/create_pricing_model_response.rb +35 -0
  34. data/lib/gonebusy/models/create_resource_body.rb +89 -0
  35. data/lib/gonebusy/models/create_resource_response.rb +35 -0
  36. data/lib/gonebusy/models/create_schedule_body.rb +144 -0
  37. data/lib/gonebusy/models/create_schedule_response.rb +35 -0
  38. data/lib/gonebusy/models/create_schedule_time_window_body.rb +117 -0
  39. data/lib/gonebusy/models/create_schedule_time_window_response.rb +35 -0
  40. data/lib/gonebusy/models/create_service_body.rb +98 -0
  41. data/lib/gonebusy/models/create_service_response.rb +35 -0
  42. data/lib/gonebusy/models/create_user_body.rb +89 -0
  43. data/lib/gonebusy/models/create_user_response.rb +35 -0
  44. data/lib/gonebusy/models/date_recurs_by_enum.rb +13 -0
  45. data/lib/gonebusy/models/delete_resource_by_id_response.rb +35 -0
  46. data/lib/gonebusy/models/delete_schedule_by_id_response.rb +35 -0
  47. data/lib/gonebusy/models/delete_schedule_time_window_by_id_response.rb +35 -0
  48. data/lib/gonebusy/models/delete_service_by_id_response.rb +35 -0
  49. data/lib/gonebusy/models/entities_address_entity.rb +116 -0
  50. data/lib/gonebusy/models/entities_availability_response.rb +58 -0
  51. data/lib/gonebusy/models/entities_booking_response.rb +71 -0
  52. data/lib/gonebusy/models/entities_category_response.rb +98 -0
  53. data/lib/gonebusy/models/entities_pricing_model_response.rb +89 -0
  54. data/lib/gonebusy/models/entities_resource_availabilities.rb +49 -0
  55. data/lib/gonebusy/models/entities_resource_response.rb +98 -0
  56. data/lib/gonebusy/models/entities_schedule_response.rb +76 -0
  57. data/lib/gonebusy/models/entities_search_response.rb +54 -0
  58. data/lib/gonebusy/models/entities_service_response.rb +116 -0
  59. data/lib/gonebusy/models/entities_slots.rb +45 -0
  60. data/lib/gonebusy/models/entities_thing_type_response.rb +44 -0
  61. data/lib/gonebusy/models/entities_time_window_response.rb +135 -0
  62. data/lib/gonebusy/models/entities_user_response.rb +152 -0
  63. data/lib/gonebusy/models/frequency_enum.rb +18 -0
  64. data/lib/gonebusy/models/gender_enum.rb +10 -0
  65. data/lib/gonebusy/models/get_booking_by_id_response.rb +35 -0
  66. data/lib/gonebusy/models/get_bookings_response.rb +40 -0
  67. data/lib/gonebusy/models/get_categories_response.rb +40 -0
  68. data/lib/gonebusy/models/get_category_by_id_response.rb +35 -0
  69. data/lib/gonebusy/models/get_pricing_model_by_id_response.rb +35 -0
  70. data/lib/gonebusy/models/get_pricing_models_response.rb +40 -0
  71. data/lib/gonebusy/models/get_resource_by_id_response.rb +35 -0
  72. data/lib/gonebusy/models/get_resource_things_response.rb +40 -0
  73. data/lib/gonebusy/models/get_resources_response.rb +40 -0
  74. data/lib/gonebusy/models/get_schedule_by_id_response.rb +35 -0
  75. data/lib/gonebusy/models/get_schedules_response.rb +40 -0
  76. data/lib/gonebusy/models/get_service_available_slots_by_id_response.rb +35 -0
  77. data/lib/gonebusy/models/get_service_by_id_response.rb +35 -0
  78. data/lib/gonebusy/models/get_services_response.rb +40 -0
  79. data/lib/gonebusy/models/get_user_by_id_response.rb +35 -0
  80. data/lib/gonebusy/models/get_users_pros_response.rb +40 -0
  81. data/lib/gonebusy/models/get_users_response.rb +40 -0
  82. data/lib/gonebusy/models/occurrence_enum.rb +22 -0
  83. data/lib/gonebusy/models/recurs_by_enum.rb +16 -0
  84. data/lib/gonebusy/models/search_query_response.rb +35 -0
  85. data/lib/gonebusy/models/update_booking_by_id_response.rb +35 -0
  86. data/lib/gonebusy/models/update_pricing_model_by_id_body.rb +62 -0
  87. data/lib/gonebusy/models/update_pricing_model_by_id_response.rb +35 -0
  88. data/lib/gonebusy/models/update_resource_by_id_body.rb +71 -0
  89. data/lib/gonebusy/models/update_resource_by_id_response.rb +35 -0
  90. data/lib/gonebusy/models/update_schedule_time_window_by_id_body.rb +117 -0
  91. data/lib/gonebusy/models/update_schedule_time_window_by_id_response.rb +35 -0
  92. data/lib/gonebusy/models/update_service_by_id_body.rb +89 -0
  93. data/lib/gonebusy/models/update_service_by_id_response.rb +35 -0
  94. data/lib/gonebusy/models/update_user_by_id_body.rb +89 -0
  95. data/lib/gonebusy/models/update_user_by_id_response.rb +35 -0
  96. data/lib/gonebusy.rb +105 -0
  97. metadata +186 -0
@@ -0,0 +1,426 @@
1
+ # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class SchedulesController < BaseController
5
+ @@instance = SchedulesController.new
6
+ # Singleton instance of the controller class
7
+ def self.instance
8
+ @@instance
9
+ end
10
+
11
+ # Delete a TimeWindow from a Schedule
12
+ # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
13
+ # @param [String] id Required parameter: Example:
14
+ # @param [String] time_window_id Required parameter: Example:
15
+ # @return DeleteScheduleTimeWindowByIdResponse response from the API call
16
+ def delete_schedule_time_window_by_id(options = Hash.new)
17
+
18
+ # the base uri for api requests
19
+ _query_builder = Configuration.base_uri.dup
20
+
21
+ # prepare query string for API call
22
+ _query_builder << '/schedules/{id}/time_windows/{time_window_id}'
23
+
24
+ # process optional query parameters
25
+ _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
26
+ 'id' => options['id'],
27
+ 'time_window_id' => options['time_window_id']
28
+ }
29
+
30
+ # validate and preprocess url
31
+ _query_url = APIHelper.clean_url _query_builder
32
+
33
+ # prepare headers
34
+ _headers = {
35
+ 'accept' => 'application/json',
36
+ 'Authorization' => Configuration.authorization,
37
+ 'Authorization' => options['authorization']
38
+ }
39
+
40
+ # create the HttpRequest object for the call
41
+ _request = @http_client.delete _query_url, headers: _headers
42
+
43
+ # apply authentication
44
+ CustomAuth.apply(_request)
45
+
46
+ # execute the request
47
+ _context = execute_request(_request)
48
+
49
+ # endpoint error handling using HTTP status codes.
50
+ if _context.response.status_code == 400
51
+ raise EntitiesErrorException.new '400 - Bad Request', _context
52
+ elsif _context.response.status_code == 401
53
+ raise EntitiesErrorException.new '401 - Unauthorized/Missing Token', _context
54
+ elsif _context.response.status_code == 403
55
+ raise EntitiesErrorException.new '403 - Forbidden', _context
56
+ elsif _context.response.status_code == 404
57
+ raise EntitiesErrorException.new '404 - Not Found', _context
58
+ elsif _context.response.status_code == 500
59
+ raise APIException.new '500 - Unexpected error', _context
60
+ end
61
+
62
+ # global error handling using HTTP status codes.
63
+ validate_response(_context)
64
+
65
+ # return appropriate response type
66
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
67
+ return DeleteScheduleTimeWindowByIdResponse.from_hash(decoded)
68
+ end
69
+
70
+ # Add a TimeWindow to a Schedule.
71
+ # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
72
+ # @param [CreateScheduleTimeWindowBody] create_schedule_time_window_body Required parameter: the content of the request
73
+ # @param [String] id Required parameter: Example:
74
+ # @return CreateScheduleTimeWindowResponse response from the API call
75
+ def create_schedule_time_window(options = Hash.new)
76
+
77
+ # the base uri for api requests
78
+ _query_builder = Configuration.base_uri.dup
79
+
80
+ # prepare query string for API call
81
+ _query_builder << '/schedules/{id}/time_windows/new'
82
+
83
+ # process optional query parameters
84
+ _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
85
+ 'id' => options['id']
86
+ }
87
+
88
+ # validate and preprocess url
89
+ _query_url = APIHelper.clean_url _query_builder
90
+
91
+ # prepare headers
92
+ _headers = {
93
+ 'accept' => 'application/json',
94
+ 'content-type' => 'application/json; charset=utf-8',
95
+ 'Authorization' => Configuration.authorization,
96
+ 'Authorization' => options['authorization']
97
+ }
98
+
99
+ # create the HttpRequest object for the call
100
+ _request = @http_client.post _query_url, headers: _headers, parameters: options['create_schedule_time_window_body'].to_json
101
+
102
+ # apply authentication
103
+ CustomAuth.apply(_request)
104
+
105
+ # execute the request
106
+ _context = execute_request(_request)
107
+
108
+ # endpoint error handling using HTTP status codes.
109
+ if _context.response.status_code == 400
110
+ raise EntitiesErrorException.new '400 - Bad Request', _context
111
+ elsif _context.response.status_code == 401
112
+ raise EntitiesErrorException.new '401 - Unauthorized/Missing Token', _context
113
+ elsif _context.response.status_code == 403
114
+ raise EntitiesErrorException.new '403 - Forbidden', _context
115
+ elsif _context.response.status_code == 404
116
+ raise EntitiesErrorException.new '404 - Not Found', _context
117
+ elsif _context.response.status_code == 422
118
+ raise EntitiesErrorException.new '422 - Unprocessable Entity', _context
119
+ elsif _context.response.status_code == 500
120
+ raise APIException.new '500 - Unexpected error', _context
121
+ end
122
+
123
+ # global error handling using HTTP status codes.
124
+ validate_response(_context)
125
+
126
+ # return appropriate response type
127
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
128
+ return CreateScheduleTimeWindowResponse.from_hash(decoded)
129
+ end
130
+
131
+ # Delete a Schedule
132
+ # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
133
+ # @param [String] id Required parameter: Example:
134
+ # @return DeleteScheduleByIdResponse response from the API call
135
+ def delete_schedule_by_id(options = Hash.new)
136
+
137
+ # the base uri for api requests
138
+ _query_builder = Configuration.base_uri.dup
139
+
140
+ # prepare query string for API call
141
+ _query_builder << '/schedules/{id}'
142
+
143
+ # process optional query parameters
144
+ _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
145
+ 'id' => options['id']
146
+ }
147
+
148
+ # validate and preprocess url
149
+ _query_url = APIHelper.clean_url _query_builder
150
+
151
+ # prepare headers
152
+ _headers = {
153
+ 'accept' => 'application/json',
154
+ 'Authorization' => Configuration.authorization,
155
+ 'Authorization' => options['authorization']
156
+ }
157
+
158
+ # create the HttpRequest object for the call
159
+ _request = @http_client.delete _query_url, headers: _headers
160
+
161
+ # apply authentication
162
+ CustomAuth.apply(_request)
163
+
164
+ # execute the request
165
+ _context = execute_request(_request)
166
+
167
+ # endpoint error handling using HTTP status codes.
168
+ if _context.response.status_code == 400
169
+ raise EntitiesErrorException.new '400 - Bad Request', _context
170
+ elsif _context.response.status_code == 401
171
+ raise EntitiesErrorException.new '401 - Unauthorized/Missing Token', _context
172
+ elsif _context.response.status_code == 403
173
+ raise EntitiesErrorException.new '403 - Forbidden', _context
174
+ elsif _context.response.status_code == 404
175
+ raise EntitiesErrorException.new '404 - Not Found', _context
176
+ elsif _context.response.status_code == 500
177
+ raise APIException.new '500 - Unexpected error', _context
178
+ end
179
+
180
+ # global error handling using HTTP status codes.
181
+ validate_response(_context)
182
+
183
+ # return appropriate response type
184
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
185
+ return DeleteScheduleByIdResponse.from_hash(decoded)
186
+ end
187
+
188
+ # Return a Schedule by id.
189
+ # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
190
+ # @param [String] id Required parameter: Example:
191
+ # @return GetScheduleByIdResponse response from the API call
192
+ def get_schedule_by_id(options = Hash.new)
193
+
194
+ # the base uri for api requests
195
+ _query_builder = Configuration.base_uri.dup
196
+
197
+ # prepare query string for API call
198
+ _query_builder << '/schedules/{id}'
199
+
200
+ # process optional query parameters
201
+ _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
202
+ 'id' => options['id']
203
+ }
204
+
205
+ # validate and preprocess url
206
+ _query_url = APIHelper.clean_url _query_builder
207
+
208
+ # prepare headers
209
+ _headers = {
210
+ 'accept' => 'application/json',
211
+ 'Authorization' => Configuration.authorization,
212
+ 'Authorization' => options['authorization']
213
+ }
214
+
215
+ # create the HttpRequest object for the call
216
+ _request = @http_client.get _query_url, headers: _headers
217
+
218
+ # apply authentication
219
+ CustomAuth.apply(_request)
220
+
221
+ # execute the request
222
+ _context = execute_request(_request)
223
+
224
+ # endpoint error handling using HTTP status codes.
225
+ if _context.response.status_code == 400
226
+ raise EntitiesErrorException.new '400 - Bad Request', _context
227
+ elsif _context.response.status_code == 401
228
+ raise EntitiesErrorException.new '401 - Unauthorized/Missing Token', _context
229
+ elsif _context.response.status_code == 403
230
+ raise EntitiesErrorException.new '403 - Forbidden', _context
231
+ elsif _context.response.status_code == 404
232
+ raise EntitiesErrorException.new '404 - Not Found', _context
233
+ elsif _context.response.status_code == 410
234
+ raise EntitiesErrorException.new '410 - Gone', _context
235
+ elsif _context.response.status_code == 500
236
+ raise APIException.new '500 - Unexpected error', _context
237
+ end
238
+
239
+ # global error handling using HTTP status codes.
240
+ validate_response(_context)
241
+
242
+ # return appropriate response type
243
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
244
+ return GetScheduleByIdResponse.from_hash(decoded)
245
+ end
246
+
247
+ # Create a Schedule with params.
248
+ # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
249
+ # @param [CreateScheduleBody] create_schedule_body Required parameter: the content of the request
250
+ # @return CreateScheduleResponse response from the API call
251
+ def create_schedule(options = Hash.new)
252
+
253
+ # the base uri for api requests
254
+ _query_builder = Configuration.base_uri.dup
255
+
256
+ # prepare query string for API call
257
+ _query_builder << '/schedules/new'
258
+
259
+ # validate and preprocess url
260
+ _query_url = APIHelper.clean_url _query_builder
261
+
262
+ # prepare headers
263
+ _headers = {
264
+ 'accept' => 'application/json',
265
+ 'content-type' => 'application/json; charset=utf-8',
266
+ 'Authorization' => Configuration.authorization,
267
+ 'Authorization' => options['authorization']
268
+ }
269
+
270
+ # create the HttpRequest object for the call
271
+ _request = @http_client.post _query_url, headers: _headers, parameters: options['create_schedule_body'].to_json
272
+
273
+ # apply authentication
274
+ CustomAuth.apply(_request)
275
+
276
+ # execute the request
277
+ _context = execute_request(_request)
278
+
279
+ # endpoint error handling using HTTP status codes.
280
+ if _context.response.status_code == 400
281
+ raise EntitiesErrorException.new '400 - Bad Request', _context
282
+ elsif _context.response.status_code == 401
283
+ raise EntitiesErrorException.new '401 - Unauthorized/Missing Token', _context
284
+ elsif _context.response.status_code == 403
285
+ raise EntitiesErrorException.new '403 - Forbidden', _context
286
+ elsif _context.response.status_code == 404
287
+ raise EntitiesErrorException.new '404 - Not Found', _context
288
+ elsif _context.response.status_code == 422
289
+ raise EntitiesErrorException.new '422 - Unprocessable Entity', _context
290
+ elsif _context.response.status_code == 500
291
+ raise APIException.new '500 - Unexpected error', _context
292
+ end
293
+
294
+ # global error handling using HTTP status codes.
295
+ validate_response(_context)
296
+
297
+ # return appropriate response type
298
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
299
+ return CreateScheduleResponse.from_hash(decoded)
300
+ end
301
+
302
+ # Update a TimeWindow for a Schedule.
303
+ # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
304
+ # @param [String] id Required parameter: Example:
305
+ # @param [String] time_window_id Required parameter: Example:
306
+ # @param [UpdateScheduleTimeWindowByIdBody] update_schedule_time_window_by_id_body Required parameter: the content of the request
307
+ # @return UpdateScheduleTimeWindowByIdResponse response from the API call
308
+ def update_schedule_time_window_by_id(options = Hash.new)
309
+
310
+ # the base uri for api requests
311
+ _query_builder = Configuration.base_uri.dup
312
+
313
+ # prepare query string for API call
314
+ _query_builder << '/schedules/{id}/time_windows/{time_window_id}'
315
+
316
+ # process optional query parameters
317
+ _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
318
+ 'id' => options['id'],
319
+ 'time_window_id' => options['time_window_id']
320
+ }
321
+
322
+ # validate and preprocess url
323
+ _query_url = APIHelper.clean_url _query_builder
324
+
325
+ # prepare headers
326
+ _headers = {
327
+ 'accept' => 'application/json',
328
+ 'content-type' => 'application/json; charset=utf-8',
329
+ 'Authorization' => Configuration.authorization,
330
+ 'Authorization' => options['authorization']
331
+ }
332
+
333
+ # create the HttpRequest object for the call
334
+ _request = @http_client.put _query_url, headers: _headers, parameters: options['update_schedule_time_window_by_id_body'].to_json
335
+
336
+ # apply authentication
337
+ CustomAuth.apply(_request)
338
+
339
+ # execute the request
340
+ _context = execute_request(_request)
341
+
342
+ # endpoint error handling using HTTP status codes.
343
+ if _context.response.status_code == 400
344
+ raise EntitiesErrorException.new '400 - Bad Request', _context
345
+ elsif _context.response.status_code == 401
346
+ raise EntitiesErrorException.new '401 - Unauthorized/Missing Token', _context
347
+ elsif _context.response.status_code == 403
348
+ raise EntitiesErrorException.new '403 - Forbidden', _context
349
+ elsif _context.response.status_code == 404
350
+ raise EntitiesErrorException.new '404 - Not Found', _context
351
+ elsif _context.response.status_code == 422
352
+ raise EntitiesErrorException.new '422 - Unprocessable Entity', _context
353
+ elsif _context.response.status_code == 500
354
+ raise APIException.new '500 - Unexpected error', _context
355
+ end
356
+
357
+ # global error handling using HTTP status codes.
358
+ validate_response(_context)
359
+
360
+ # return appropriate response type
361
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
362
+ return UpdateScheduleTimeWindowByIdResponse.from_hash(decoded)
363
+ end
364
+
365
+ # Return all Schedules that your account has access to. Includes Schedules for your own User as well as any Users for which you are the Account Manager.
366
+ # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
367
+ # @param [Integer] page Optional parameter: Page offset to fetch.
368
+ # @param [Integer] per_page Optional parameter: Number of results to return per page.
369
+ # @param [Integer] user_id Optional parameter: Retrieve Schedules owned only by this User Id. You must be authorized to manage this User Id.
370
+ # @return GetSchedulesResponse response from the API call
371
+ def get_schedules(options = Hash.new)
372
+
373
+ # the base uri for api requests
374
+ _query_builder = Configuration.base_uri.dup
375
+
376
+ # prepare query string for API call
377
+ _query_builder << '/schedules'
378
+
379
+ # process optional query parameters
380
+ _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
381
+ 'page' => options['page'],
382
+ 'per_page' => options['per_page'],
383
+ 'user_id' => options['user_id']
384
+ }
385
+
386
+ # validate and preprocess url
387
+ _query_url = APIHelper.clean_url _query_builder
388
+
389
+ # prepare headers
390
+ _headers = {
391
+ 'accept' => 'application/json',
392
+ 'Authorization' => Configuration.authorization,
393
+ 'Authorization' => options['authorization']
394
+ }
395
+
396
+ # create the HttpRequest object for the call
397
+ _request = @http_client.get _query_url, headers: _headers
398
+
399
+ # apply authentication
400
+ CustomAuth.apply(_request)
401
+
402
+ # execute the request
403
+ _context = execute_request(_request)
404
+
405
+ # endpoint error handling using HTTP status codes.
406
+ if _context.response.status_code == 400
407
+ raise EntitiesErrorException.new '400 - Bad Request', _context
408
+ elsif _context.response.status_code == 401
409
+ raise EntitiesErrorException.new '401 - Unauthorized/Missing Token', _context
410
+ elsif _context.response.status_code == 403
411
+ raise EntitiesErrorException.new '403 - Forbidden', _context
412
+ elsif _context.response.status_code == 404
413
+ raise EntitiesErrorException.new '404 - Not Found', _context
414
+ elsif _context.response.status_code == 500
415
+ raise APIException.new '500 - Unexpected error', _context
416
+ end
417
+
418
+ # global error handling using HTTP status codes.
419
+ validate_response(_context)
420
+
421
+ # return appropriate response type
422
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
423
+ return GetSchedulesResponse.from_hash(decoded)
424
+ end
425
+ end
426
+ end
@@ -0,0 +1,64 @@
1
+ # This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module Gonebusy
4
+ class SearchController < BaseController
5
+ @@instance = SearchController.new
6
+ # Singleton instance of the controller class
7
+ def self.instance
8
+ @@instance
9
+ end
10
+
11
+ # Search for Providers and Provided Services.
12
+ # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
13
+ # @param [String] query Required parameter: Example:
14
+ # @return SearchQueryResponse response from the API call
15
+ def search_query(options = Hash.new)
16
+
17
+ # the base uri for api requests
18
+ _query_builder = Configuration.base_uri.dup
19
+
20
+ # prepare query string for API call
21
+ _query_builder << '/search/{query}'
22
+
23
+ # process optional query parameters
24
+ _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
25
+ 'query' => options['query']
26
+ }
27
+
28
+ # validate and preprocess url
29
+ _query_url = APIHelper.clean_url _query_builder
30
+
31
+ # prepare headers
32
+ _headers = {
33
+ 'accept' => 'application/json',
34
+ 'Authorization' => Configuration.authorization,
35
+ 'Authorization' => options['authorization']
36
+ }
37
+
38
+ # create the HttpRequest object for the call
39
+ _request = @http_client.get _query_url, headers: _headers
40
+
41
+ # apply authentication
42
+ CustomAuth.apply(_request)
43
+
44
+ # execute the request
45
+ _context = execute_request(_request)
46
+
47
+ # endpoint error handling using HTTP status codes.
48
+ if _context.response.status_code == 400
49
+ raise EntitiesErrorException.new '400 - Bad Request', _context
50
+ elsif _context.response.status_code == 401
51
+ raise EntitiesErrorException.new '401 - Unauthorized/Missing Token', _context
52
+ elsif _context.response.status_code == 500
53
+ raise APIException.new '500 - Unexpected error', _context
54
+ end
55
+
56
+ # global error handling using HTTP status codes.
57
+ validate_response(_context)
58
+
59
+ # return appropriate response type
60
+ decoded = APIHelper.json_deserialize(_context.response.raw_body)
61
+ return SearchQueryResponse.from_hash(decoded)
62
+ end
63
+ end
64
+ end