gonebusy-ruby-client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +2 -1
  4. data/lib/gonebusy/controllers/bookings_controller.rb +77 -74
  5. data/lib/gonebusy/controllers/categories_controller.rb +29 -29
  6. data/lib/gonebusy/controllers/pricing_models_controller.rb +47 -47
  7. data/lib/gonebusy/controllers/resources_controller.rb +77 -77
  8. data/lib/gonebusy/controllers/schedules_controller.rb +92 -92
  9. data/lib/gonebusy/controllers/services_controller.rb +86 -86
  10. data/lib/gonebusy/controllers/users_controller.rb +56 -56
  11. data/lib/gonebusy/models/cancel_booking_by_id_response.rb +10 -12
  12. data/lib/gonebusy/models/create_booking_body.rb +78 -80
  13. data/lib/gonebusy/models/create_booking_response.rb +10 -12
  14. data/lib/gonebusy/models/create_category_body.rb +34 -36
  15. data/lib/gonebusy/models/create_category_response.rb +10 -12
  16. data/lib/gonebusy/models/create_pricing_model_body.rb +35 -37
  17. data/lib/gonebusy/models/create_pricing_model_response.rb +10 -12
  18. data/lib/gonebusy/models/create_resource_body.rb +39 -41
  19. data/lib/gonebusy/models/create_resource_response.rb +10 -12
  20. data/lib/gonebusy/models/create_schedule_body.rb +92 -94
  21. data/lib/gonebusy/models/create_schedule_response.rb +10 -12
  22. data/lib/gonebusy/models/create_schedule_time_window_body.rb +64 -66
  23. data/lib/gonebusy/models/create_schedule_time_window_response.rb +10 -12
  24. data/lib/gonebusy/models/create_service_body.rb +57 -59
  25. data/lib/gonebusy/models/create_service_response.rb +10 -12
  26. data/lib/gonebusy/models/create_user_body.rb +40 -42
  27. data/lib/gonebusy/models/create_user_response.rb +10 -12
  28. data/lib/gonebusy/models/delete_resource_by_id_response.rb +10 -12
  29. data/lib/gonebusy/models/delete_schedule_by_id_response.rb +10 -12
  30. data/lib/gonebusy/models/delete_schedule_time_window_by_id_response.rb +10 -12
  31. data/lib/gonebusy/models/delete_service_by_id_response.rb +10 -12
  32. data/lib/gonebusy/models/entities_address_entity.rb +69 -71
  33. data/lib/gonebusy/models/entities_availability_response.rb +21 -23
  34. data/lib/gonebusy/models/entities_booking_response.rb +32 -34
  35. data/lib/gonebusy/models/entities_category_response.rb +52 -54
  36. data/lib/gonebusy/models/entities_pricing_model_response.rb +44 -46
  37. data/lib/gonebusy/models/entities_resource_availabilities.rb +24 -26
  38. data/lib/gonebusy/models/entities_resource_response.rb +60 -62
  39. data/lib/gonebusy/models/entities_schedule_response.rb +26 -28
  40. data/lib/gonebusy/models/entities_search_response.rb +29 -31
  41. data/lib/gonebusy/models/entities_service_response.rb +82 -84
  42. data/lib/gonebusy/models/entities_slots.rb +13 -15
  43. data/lib/gonebusy/models/entities_thing_type_response.rb +13 -15
  44. data/lib/gonebusy/models/entities_time_window_response.rb +81 -83
  45. data/lib/gonebusy/models/entities_user_response.rb +95 -97
  46. data/lib/gonebusy/models/get_booking_by_id_response.rb +10 -12
  47. data/lib/gonebusy/models/get_bookings_response.rb +14 -16
  48. data/lib/gonebusy/models/get_categories_response.rb +14 -16
  49. data/lib/gonebusy/models/get_category_by_id_response.rb +10 -12
  50. data/lib/gonebusy/models/get_pricing_model_by_id_response.rb +10 -12
  51. data/lib/gonebusy/models/get_pricing_models_response.rb +14 -16
  52. data/lib/gonebusy/models/get_resource_by_id_response.rb +10 -12
  53. data/lib/gonebusy/models/get_resource_things_response.rb +14 -16
  54. data/lib/gonebusy/models/get_resources_response.rb +14 -16
  55. data/lib/gonebusy/models/get_schedule_by_id_response.rb +10 -12
  56. data/lib/gonebusy/models/get_schedules_response.rb +14 -16
  57. data/lib/gonebusy/models/get_service_available_slots_by_id_response.rb +10 -12
  58. data/lib/gonebusy/models/get_service_by_id_response.rb +10 -12
  59. data/lib/gonebusy/models/get_services_response.rb +14 -16
  60. data/lib/gonebusy/models/get_user_by_id_response.rb +10 -12
  61. data/lib/gonebusy/models/get_users_response.rb +14 -16
  62. data/lib/gonebusy/models/search_query_response.rb +10 -12
  63. data/lib/gonebusy/models/update_booking_by_id_body.rb +58 -60
  64. data/lib/gonebusy/models/update_booking_by_id_response.rb +10 -12
  65. data/lib/gonebusy/models/update_pricing_model_by_id_body.rb +28 -30
  66. data/lib/gonebusy/models/update_pricing_model_by_id_response.rb +10 -12
  67. data/lib/gonebusy/models/update_resource_by_id_body.rb +33 -35
  68. data/lib/gonebusy/models/update_resource_by_id_response.rb +10 -12
  69. data/lib/gonebusy/models/update_schedule_time_window_by_id_body.rb +71 -73
  70. data/lib/gonebusy/models/update_schedule_time_window_by_id_response.rb +10 -12
  71. data/lib/gonebusy/models/update_service_by_id_body.rb +43 -45
  72. data/lib/gonebusy/models/update_service_by_id_response.rb +10 -12
  73. data/lib/gonebusy/models/update_user_by_id_body.rb +41 -43
  74. data/lib/gonebusy/models/update_user_by_id_response.rb +10 -12
  75. data/lib/gonebusy.rb +67 -67
  76. metadata +2 -3
  77. data/lib/gonebusy/exceptions/entities_error_exception.rb +0 -27
@@ -8,42 +8,36 @@ module Gonebusy
8
8
  @@instance
9
9
  end
10
10
 
11
- # 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.
11
+ # Update a TimeWindow for a Schedule.
12
12
  # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
13
- # @param [Integer] page Optional parameter: Page offset to fetch.
14
- # @param [Integer] per_page Optional parameter: Number of results to return per page.
15
- # @param [Integer] resource_id Optional parameter: Retrieve Schedules only for this Resource. You, or provided :user_id, must be authorized to manage this Resource.
16
- # @param [Integer] service_id Optional parameter: Retrieve Schedules only for this Service. You, or provided :user_id, must be authorized to manage this Service.
17
- # @param [Integer] user_id Optional parameter: Retrieve Schedules owned only by this User Id. You must be authorized to manage this User Id.
18
- # @return GetSchedulesResponse response from the API call
19
- def get_schedules(authorization,
20
- page = 1,
21
- per_page = 10,
22
- resource_id = nil,
23
- service_id = nil,
24
- user_id = nil)
13
+ # @param [String] id Required parameter: Example:
14
+ # @param [String] time_window_id Required parameter: Example:
15
+ # @param [UpdateScheduleTimeWindowByIdBody] update_schedule_time_window_by_id_body Optional parameter: the content of the request
16
+ # @return UpdateScheduleTimeWindowByIdResponse response from the API call
17
+ def update_schedule_time_window_by_id(authorization,
18
+ id,
19
+ time_window_id,
20
+ update_schedule_time_window_by_id_body = nil)
25
21
 
26
22
  # prepare query url
27
23
  _query_builder = Configuration.get_base_uri()
28
- _query_builder << '/schedules'
29
- _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
30
- 'page' => page,
31
- 'per_page' => per_page,
32
- 'resource_id' => resource_id,
33
- 'service_id' => service_id,
34
- 'user_id' => user_id
35
- }, array_serialization: Configuration.array_serialization
24
+ _query_builder << '/schedules/{id}/time_windows/{time_window_id}'
25
+ _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
26
+ 'id' => id,
27
+ 'time_window_id' => time_window_id
28
+ }
36
29
  _query_url = APIHelper.clean_url _query_builder
37
30
 
38
31
  # prepare headers
39
32
  _headers = {
40
33
  'accept' => 'application/json',
34
+ 'content-type' => 'application/json; charset=utf-8',
41
35
  'Authorization' => Configuration.authorization,
42
36
  'Authorization' => authorization
43
37
  }
44
38
 
45
39
  # prepare and execute HttpRequest
46
- _request = @http_client.get _query_url, headers: _headers
40
+ _request = @http_client.put _query_url, headers: _headers, parameters: update_schedule_time_window_by_id_body.to_json
47
41
  CustomAuth.apply(_request)
48
42
  _context = execute_request(_request)
49
43
 
@@ -56,6 +50,8 @@ module Gonebusy
56
50
  raise EntitiesErrorErrorException.new 'Forbidden', _context
57
51
  elsif _context.response.status_code == 404
58
52
  raise EntitiesErrorErrorException.new 'Not Found', _context
53
+ elsif _context.response.status_code == 422
54
+ raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
59
55
  elsif !_context.response.status_code.between?(200, 208)
60
56
  raise APIException.new 'Unexpected error', _context
61
57
  end
@@ -63,19 +59,24 @@ module Gonebusy
63
59
 
64
60
  # return appropriate response type
65
61
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
66
- return GetSchedulesResponse.from_hash(decoded)
62
+ return UpdateScheduleTimeWindowByIdResponse.from_hash(decoded)
67
63
  end
68
64
 
69
- # Create a Schedule with params.
65
+ # Add a TimeWindow to a Schedule.
70
66
  # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
71
- # @param [CreateScheduleBody] create_schedule_body Optional parameter: the content of the request
72
- # @return CreateScheduleResponse response from the API call
73
- def create_schedule(authorization,
74
- create_schedule_body = nil)
67
+ # @param [String] id Required parameter: Example:
68
+ # @param [CreateScheduleTimeWindowBody] create_schedule_time_window_body Optional parameter: the content of the request
69
+ # @return CreateScheduleTimeWindowResponse response from the API call
70
+ def create_schedule_time_window(authorization,
71
+ id,
72
+ create_schedule_time_window_body = nil)
75
73
 
76
74
  # prepare query url
77
75
  _query_builder = Configuration.get_base_uri()
78
- _query_builder << '/schedules/new'
76
+ _query_builder << '/schedules/{id}/time_windows/new'
77
+ _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
78
+ 'id' => id
79
+ }
79
80
  _query_url = APIHelper.clean_url _query_builder
80
81
 
81
82
  # prepare headers
@@ -87,7 +88,7 @@ module Gonebusy
87
88
  }
88
89
 
89
90
  # prepare and execute HttpRequest
90
- _request = @http_client.post _query_url, headers: _headers, parameters: create_schedule_body.to_json
91
+ _request = @http_client.post _query_url, headers: _headers, parameters: create_schedule_time_window_body.to_json
91
92
  CustomAuth.apply(_request)
92
93
  _context = execute_request(_request)
93
94
 
@@ -109,22 +110,34 @@ module Gonebusy
109
110
 
110
111
  # return appropriate response type
111
112
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
112
- return CreateScheduleResponse.from_hash(decoded)
113
+ return CreateScheduleTimeWindowResponse.from_hash(decoded)
113
114
  end
114
115
 
115
- # Return a Schedule by id.
116
+ # 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.
116
117
  # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
117
- # @param [String] id Required parameter: Example:
118
- # @return GetScheduleByIdResponse response from the API call
119
- def get_schedule_by_id(authorization,
120
- id)
118
+ # @param [Integer] user_id Optional parameter: Retrieve Schedules owned only by this User Id. You must be authorized to manage this User Id.
119
+ # @param [Integer] resource_id Optional parameter: Retrieve Schedules only for this Resource. You, or provided :user_id, must be authorized to manage this Resource.
120
+ # @param [Integer] service_id Optional parameter: Retrieve Schedules only for this Service. You, or provided :user_id, must be authorized to manage this Service.
121
+ # @param [Integer] page Optional parameter: Page offset to fetch.
122
+ # @param [Integer] per_page Optional parameter: Number of results to return per page.
123
+ # @return GetSchedulesResponse response from the API call
124
+ def get_schedules(authorization,
125
+ user_id = nil,
126
+ resource_id = nil,
127
+ service_id = nil,
128
+ page = 1,
129
+ per_page = 10)
121
130
 
122
131
  # prepare query url
123
132
  _query_builder = Configuration.get_base_uri()
124
- _query_builder << '/schedules/{id}'
125
- _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
126
- 'id' => id
127
- }
133
+ _query_builder << '/schedules'
134
+ _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
135
+ 'user_id' => user_id,
136
+ 'resource_id' => resource_id,
137
+ 'service_id' => service_id,
138
+ 'page' => page,
139
+ 'per_page' => per_page
140
+ }, array_serialization: Configuration.array_serialization
128
141
  _query_url = APIHelper.clean_url _query_builder
129
142
 
130
143
  # prepare headers
@@ -148,8 +161,6 @@ module Gonebusy
148
161
  raise EntitiesErrorErrorException.new 'Forbidden', _context
149
162
  elsif _context.response.status_code == 404
150
163
  raise EntitiesErrorErrorException.new 'Not Found', _context
151
- elsif _context.response.status_code == 410
152
- raise EntitiesErrorErrorException.new 'Gone', _context
153
164
  elsif !_context.response.status_code.between?(200, 208)
154
165
  raise APIException.new 'Unexpected error', _context
155
166
  end
@@ -157,21 +168,24 @@ module Gonebusy
157
168
 
158
169
  # return appropriate response type
159
170
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
160
- return GetScheduleByIdResponse.from_hash(decoded)
171
+ return GetSchedulesResponse.from_hash(decoded)
161
172
  end
162
173
 
163
- # Delete a Schedule
174
+ # Delete a TimeWindow from a Schedule
164
175
  # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
165
176
  # @param [String] id Required parameter: Example:
166
- # @return DeleteScheduleByIdResponse response from the API call
167
- def delete_schedule_by_id(authorization,
168
- id)
177
+ # @param [String] time_window_id Required parameter: Example:
178
+ # @return DeleteScheduleTimeWindowByIdResponse response from the API call
179
+ def delete_schedule_time_window_by_id(authorization,
180
+ id,
181
+ time_window_id)
169
182
 
170
183
  # prepare query url
171
184
  _query_builder = Configuration.get_base_uri()
172
- _query_builder << '/schedules/{id}'
185
+ _query_builder << '/schedules/{id}/time_windows/{time_window_id}'
173
186
  _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
174
- 'id' => id
187
+ 'id' => id,
188
+ 'time_window_id' => time_window_id
175
189
  }
176
190
  _query_url = APIHelper.clean_url _query_builder
177
191
 
@@ -203,21 +217,19 @@ module Gonebusy
203
217
 
204
218
  # return appropriate response type
205
219
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
206
- return DeleteScheduleByIdResponse.from_hash(decoded)
220
+ return DeleteScheduleTimeWindowByIdResponse.from_hash(decoded)
207
221
  end
208
222
 
209
- # Add a TimeWindow to a Schedule.
223
+ # Delete a Schedule
210
224
  # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
211
225
  # @param [String] id Required parameter: Example:
212
- # @param [CreateScheduleTimeWindowBody] create_schedule_time_window_body Optional parameter: the content of the request
213
- # @return CreateScheduleTimeWindowResponse response from the API call
214
- def create_schedule_time_window(authorization,
215
- id,
216
- create_schedule_time_window_body = nil)
226
+ # @return DeleteScheduleByIdResponse response from the API call
227
+ def delete_schedule_by_id(authorization,
228
+ id)
217
229
 
218
230
  # prepare query url
219
231
  _query_builder = Configuration.get_base_uri()
220
- _query_builder << '/schedules/{id}/time_windows/new'
232
+ _query_builder << '/schedules/{id}'
221
233
  _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
222
234
  'id' => id
223
235
  }
@@ -226,13 +238,12 @@ module Gonebusy
226
238
  # prepare headers
227
239
  _headers = {
228
240
  'accept' => 'application/json',
229
- 'content-type' => 'application/json; charset=utf-8',
230
241
  'Authorization' => Configuration.authorization,
231
242
  'Authorization' => authorization
232
243
  }
233
244
 
234
245
  # prepare and execute HttpRequest
235
- _request = @http_client.post _query_url, headers: _headers, parameters: create_schedule_time_window_body.to_json
246
+ _request = @http_client.delete _query_url, headers: _headers
236
247
  CustomAuth.apply(_request)
237
248
  _context = execute_request(_request)
238
249
 
@@ -245,8 +256,6 @@ module Gonebusy
245
256
  raise EntitiesErrorErrorException.new 'Forbidden', _context
246
257
  elsif _context.response.status_code == 404
247
258
  raise EntitiesErrorErrorException.new 'Not Found', _context
248
- elsif _context.response.status_code == 422
249
- raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
250
259
  elsif !_context.response.status_code.between?(200, 208)
251
260
  raise APIException.new 'Unexpected error', _context
252
261
  end
@@ -254,39 +263,33 @@ module Gonebusy
254
263
 
255
264
  # return appropriate response type
256
265
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
257
- return CreateScheduleTimeWindowResponse.from_hash(decoded)
266
+ return DeleteScheduleByIdResponse.from_hash(decoded)
258
267
  end
259
268
 
260
- # Update a TimeWindow for a Schedule.
269
+ # Return a Schedule by id.
261
270
  # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
262
271
  # @param [String] id Required parameter: Example:
263
- # @param [String] time_window_id Required parameter: Example:
264
- # @param [UpdateScheduleTimeWindowByIdBody] update_schedule_time_window_by_id_body Optional parameter: the content of the request
265
- # @return UpdateScheduleTimeWindowByIdResponse response from the API call
266
- def update_schedule_time_window_by_id(authorization,
267
- id,
268
- time_window_id,
269
- update_schedule_time_window_by_id_body = nil)
272
+ # @return GetScheduleByIdResponse response from the API call
273
+ def get_schedule_by_id(authorization,
274
+ id)
270
275
 
271
276
  # prepare query url
272
277
  _query_builder = Configuration.get_base_uri()
273
- _query_builder << '/schedules/{id}/time_windows/{time_window_id}'
278
+ _query_builder << '/schedules/{id}'
274
279
  _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
275
- 'id' => id,
276
- 'time_window_id' => time_window_id
280
+ 'id' => id
277
281
  }
278
282
  _query_url = APIHelper.clean_url _query_builder
279
283
 
280
284
  # prepare headers
281
285
  _headers = {
282
286
  'accept' => 'application/json',
283
- 'content-type' => 'application/json; charset=utf-8',
284
287
  'Authorization' => Configuration.authorization,
285
288
  'Authorization' => authorization
286
289
  }
287
290
 
288
291
  # prepare and execute HttpRequest
289
- _request = @http_client.put _query_url, headers: _headers, parameters: update_schedule_time_window_by_id_body.to_json
292
+ _request = @http_client.get _query_url, headers: _headers
290
293
  CustomAuth.apply(_request)
291
294
  _context = execute_request(_request)
292
295
 
@@ -299,8 +302,8 @@ module Gonebusy
299
302
  raise EntitiesErrorErrorException.new 'Forbidden', _context
300
303
  elsif _context.response.status_code == 404
301
304
  raise EntitiesErrorErrorException.new 'Not Found', _context
302
- elsif _context.response.status_code == 422
303
- raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
305
+ elsif _context.response.status_code == 410
306
+ raise EntitiesErrorErrorException.new 'Gone', _context
304
307
  elsif !_context.response.status_code.between?(200, 208)
305
308
  raise APIException.new 'Unexpected error', _context
306
309
  end
@@ -308,36 +311,31 @@ module Gonebusy
308
311
 
309
312
  # return appropriate response type
310
313
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
311
- return UpdateScheduleTimeWindowByIdResponse.from_hash(decoded)
314
+ return GetScheduleByIdResponse.from_hash(decoded)
312
315
  end
313
316
 
314
- # Delete a TimeWindow from a Schedule
317
+ # Create a Schedule with params.
315
318
  # @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
316
- # @param [String] id Required parameter: Example:
317
- # @param [String] time_window_id Required parameter: Example:
318
- # @return DeleteScheduleTimeWindowByIdResponse response from the API call
319
- def delete_schedule_time_window_by_id(authorization,
320
- id,
321
- time_window_id)
319
+ # @param [CreateScheduleBody] create_schedule_body Optional parameter: the content of the request
320
+ # @return CreateScheduleResponse response from the API call
321
+ def create_schedule(authorization,
322
+ create_schedule_body = nil)
322
323
 
323
324
  # prepare query url
324
325
  _query_builder = Configuration.get_base_uri()
325
- _query_builder << '/schedules/{id}/time_windows/{time_window_id}'
326
- _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
327
- 'id' => id,
328
- 'time_window_id' => time_window_id
329
- }
326
+ _query_builder << '/schedules/new'
330
327
  _query_url = APIHelper.clean_url _query_builder
331
328
 
332
329
  # prepare headers
333
330
  _headers = {
334
331
  'accept' => 'application/json',
332
+ 'content-type' => 'application/json; charset=utf-8',
335
333
  'Authorization' => Configuration.authorization,
336
334
  'Authorization' => authorization
337
335
  }
338
336
 
339
337
  # prepare and execute HttpRequest
340
- _request = @http_client.delete _query_url, headers: _headers
338
+ _request = @http_client.post _query_url, headers: _headers, parameters: create_schedule_body.to_json
341
339
  CustomAuth.apply(_request)
342
340
  _context = execute_request(_request)
343
341
 
@@ -350,6 +348,8 @@ module Gonebusy
350
348
  raise EntitiesErrorErrorException.new 'Forbidden', _context
351
349
  elsif _context.response.status_code == 404
352
350
  raise EntitiesErrorErrorException.new 'Not Found', _context
351
+ elsif _context.response.status_code == 422
352
+ raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
353
353
  elsif !_context.response.status_code.between?(200, 208)
354
354
  raise APIException.new 'Unexpected error', _context
355
355
  end
@@ -357,7 +357,7 @@ module Gonebusy
357
357
 
358
358
  # return appropriate response type
359
359
  decoded = APIHelper.json_deserialize(_context.response.raw_body)
360
- return DeleteScheduleTimeWindowByIdResponse.from_hash(decoded)
360
+ return CreateScheduleResponse.from_hash(decoded)
361
361
  end
362
362
  end
363
363
  end