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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +2 -1
- data/lib/gonebusy/controllers/bookings_controller.rb +77 -74
- data/lib/gonebusy/controllers/categories_controller.rb +29 -29
- data/lib/gonebusy/controllers/pricing_models_controller.rb +47 -47
- data/lib/gonebusy/controllers/resources_controller.rb +77 -77
- data/lib/gonebusy/controllers/schedules_controller.rb +92 -92
- data/lib/gonebusy/controllers/services_controller.rb +86 -86
- data/lib/gonebusy/controllers/users_controller.rb +56 -56
- data/lib/gonebusy/models/cancel_booking_by_id_response.rb +10 -12
- data/lib/gonebusy/models/create_booking_body.rb +78 -80
- data/lib/gonebusy/models/create_booking_response.rb +10 -12
- data/lib/gonebusy/models/create_category_body.rb +34 -36
- data/lib/gonebusy/models/create_category_response.rb +10 -12
- data/lib/gonebusy/models/create_pricing_model_body.rb +35 -37
- data/lib/gonebusy/models/create_pricing_model_response.rb +10 -12
- data/lib/gonebusy/models/create_resource_body.rb +39 -41
- data/lib/gonebusy/models/create_resource_response.rb +10 -12
- data/lib/gonebusy/models/create_schedule_body.rb +92 -94
- data/lib/gonebusy/models/create_schedule_response.rb +10 -12
- data/lib/gonebusy/models/create_schedule_time_window_body.rb +64 -66
- data/lib/gonebusy/models/create_schedule_time_window_response.rb +10 -12
- data/lib/gonebusy/models/create_service_body.rb +57 -59
- data/lib/gonebusy/models/create_service_response.rb +10 -12
- data/lib/gonebusy/models/create_user_body.rb +40 -42
- data/lib/gonebusy/models/create_user_response.rb +10 -12
- data/lib/gonebusy/models/delete_resource_by_id_response.rb +10 -12
- data/lib/gonebusy/models/delete_schedule_by_id_response.rb +10 -12
- data/lib/gonebusy/models/delete_schedule_time_window_by_id_response.rb +10 -12
- data/lib/gonebusy/models/delete_service_by_id_response.rb +10 -12
- data/lib/gonebusy/models/entities_address_entity.rb +69 -71
- data/lib/gonebusy/models/entities_availability_response.rb +21 -23
- data/lib/gonebusy/models/entities_booking_response.rb +32 -34
- data/lib/gonebusy/models/entities_category_response.rb +52 -54
- data/lib/gonebusy/models/entities_pricing_model_response.rb +44 -46
- data/lib/gonebusy/models/entities_resource_availabilities.rb +24 -26
- data/lib/gonebusy/models/entities_resource_response.rb +60 -62
- data/lib/gonebusy/models/entities_schedule_response.rb +26 -28
- data/lib/gonebusy/models/entities_search_response.rb +29 -31
- data/lib/gonebusy/models/entities_service_response.rb +82 -84
- data/lib/gonebusy/models/entities_slots.rb +13 -15
- data/lib/gonebusy/models/entities_thing_type_response.rb +13 -15
- data/lib/gonebusy/models/entities_time_window_response.rb +81 -83
- data/lib/gonebusy/models/entities_user_response.rb +95 -97
- data/lib/gonebusy/models/get_booking_by_id_response.rb +10 -12
- data/lib/gonebusy/models/get_bookings_response.rb +14 -16
- data/lib/gonebusy/models/get_categories_response.rb +14 -16
- data/lib/gonebusy/models/get_category_by_id_response.rb +10 -12
- data/lib/gonebusy/models/get_pricing_model_by_id_response.rb +10 -12
- data/lib/gonebusy/models/get_pricing_models_response.rb +14 -16
- data/lib/gonebusy/models/get_resource_by_id_response.rb +10 -12
- data/lib/gonebusy/models/get_resource_things_response.rb +14 -16
- data/lib/gonebusy/models/get_resources_response.rb +14 -16
- data/lib/gonebusy/models/get_schedule_by_id_response.rb +10 -12
- data/lib/gonebusy/models/get_schedules_response.rb +14 -16
- data/lib/gonebusy/models/get_service_available_slots_by_id_response.rb +10 -12
- data/lib/gonebusy/models/get_service_by_id_response.rb +10 -12
- data/lib/gonebusy/models/get_services_response.rb +14 -16
- data/lib/gonebusy/models/get_user_by_id_response.rb +10 -12
- data/lib/gonebusy/models/get_users_response.rb +14 -16
- data/lib/gonebusy/models/search_query_response.rb +10 -12
- data/lib/gonebusy/models/update_booking_by_id_body.rb +58 -60
- data/lib/gonebusy/models/update_booking_by_id_response.rb +10 -12
- data/lib/gonebusy/models/update_pricing_model_by_id_body.rb +28 -30
- data/lib/gonebusy/models/update_pricing_model_by_id_response.rb +10 -12
- data/lib/gonebusy/models/update_resource_by_id_body.rb +33 -35
- data/lib/gonebusy/models/update_resource_by_id_response.rb +10 -12
- data/lib/gonebusy/models/update_schedule_time_window_by_id_body.rb +71 -73
- data/lib/gonebusy/models/update_schedule_time_window_by_id_response.rb +10 -12
- data/lib/gonebusy/models/update_service_by_id_body.rb +43 -45
- data/lib/gonebusy/models/update_service_by_id_response.rb +10 -12
- data/lib/gonebusy/models/update_user_by_id_body.rb +41 -43
- data/lib/gonebusy/models/update_user_by_id_response.rb +10 -12
- data/lib/gonebusy.rb +67 -67
- metadata +2 -3
- 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
|
-
#
|
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 [
|
14
|
-
# @param [
|
15
|
-
# @param [
|
16
|
-
# @
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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.
|
30
|
-
'
|
31
|
-
'
|
32
|
-
|
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.
|
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
|
62
|
+
return UpdateScheduleTimeWindowByIdResponse.from_hash(decoded)
|
67
63
|
end
|
68
64
|
|
69
|
-
#
|
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 [
|
72
|
-
# @
|
73
|
-
|
74
|
-
|
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:
|
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
|
113
|
+
return CreateScheduleTimeWindowResponse.from_hash(decoded)
|
113
114
|
end
|
114
115
|
|
115
|
-
# Return
|
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 [
|
118
|
-
# @
|
119
|
-
|
120
|
-
|
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
|
125
|
-
_query_builder = APIHelper.
|
126
|
-
'
|
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
|
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
|
-
# @
|
167
|
-
|
168
|
-
|
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
|
220
|
+
return DeleteScheduleTimeWindowByIdResponse.from_hash(decoded)
|
207
221
|
end
|
208
222
|
|
209
|
-
#
|
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
|
-
# @
|
213
|
-
|
214
|
-
|
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}
|
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.
|
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
|
266
|
+
return DeleteScheduleByIdResponse.from_hash(decoded)
|
258
267
|
end
|
259
268
|
|
260
|
-
#
|
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
|
-
# @
|
264
|
-
|
265
|
-
|
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}
|
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.
|
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 ==
|
303
|
-
raise EntitiesErrorErrorException.new '
|
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
|
314
|
+
return GetScheduleByIdResponse.from_hash(decoded)
|
312
315
|
end
|
313
316
|
|
314
|
-
#
|
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 [
|
317
|
-
# @
|
318
|
-
|
319
|
-
|
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/
|
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.
|
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
|
360
|
+
return CreateScheduleResponse.from_hash(decoded)
|
361
361
|
end
|
362
362
|
end
|
363
363
|
end
|