gonebusy-ruby-client 0.1.0 → 0.1.1
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 +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,25 +8,19 @@ module Gonebusy
|
|
8
8
|
@@instance
|
9
9
|
end
|
10
10
|
|
11
|
-
#
|
11
|
+
# Delete a Service by id
|
12
12
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
13
|
-
# @param [
|
14
|
-
# @
|
15
|
-
|
16
|
-
|
17
|
-
def get_services(authorization,
|
18
|
-
page = 1,
|
19
|
-
per_page = 10,
|
20
|
-
user_id = nil)
|
13
|
+
# @param [String] id Required parameter: Example:
|
14
|
+
# @return DeleteServiceByIdResponse response from the API call
|
15
|
+
def delete_service_by_id(authorization,
|
16
|
+
id)
|
21
17
|
|
22
18
|
# prepare query url
|
23
19
|
_query_builder = Configuration.get_base_uri()
|
24
|
-
_query_builder << '/services'
|
25
|
-
_query_builder = APIHelper.
|
26
|
-
'
|
27
|
-
|
28
|
-
'user_id' => user_id
|
29
|
-
}, array_serialization: Configuration.array_serialization
|
20
|
+
_query_builder << '/services/{id}'
|
21
|
+
_query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
|
22
|
+
'id' => id
|
23
|
+
}
|
30
24
|
_query_url = APIHelper.clean_url _query_builder
|
31
25
|
|
32
26
|
# prepare headers
|
@@ -37,12 +31,14 @@ module Gonebusy
|
|
37
31
|
}
|
38
32
|
|
39
33
|
# prepare and execute HttpRequest
|
40
|
-
_request = @http_client.
|
34
|
+
_request = @http_client.delete _query_url, headers: _headers
|
41
35
|
CustomAuth.apply(_request)
|
42
36
|
_context = execute_request(_request)
|
43
37
|
|
44
38
|
# validate response against endpoint and global error codes
|
45
|
-
if _context.response.status_code ==
|
39
|
+
if _context.response.status_code == 400
|
40
|
+
raise EntitiesErrorErrorException.new 'Bad Request', _context
|
41
|
+
elsif _context.response.status_code == 401
|
46
42
|
raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context
|
47
43
|
elsif _context.response.status_code == 403
|
48
44
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
@@ -55,31 +51,33 @@ module Gonebusy
|
|
55
51
|
|
56
52
|
# return appropriate response type
|
57
53
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
58
|
-
return
|
54
|
+
return DeleteServiceByIdResponse.from_hash(decoded)
|
59
55
|
end
|
60
56
|
|
61
|
-
#
|
57
|
+
# Return a Service by id.
|
62
58
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
63
|
-
# @param [
|
64
|
-
# @return
|
65
|
-
def
|
66
|
-
|
59
|
+
# @param [String] id Required parameter: Example:
|
60
|
+
# @return GetServiceByIdResponse response from the API call
|
61
|
+
def get_service_by_id(authorization,
|
62
|
+
id)
|
67
63
|
|
68
64
|
# prepare query url
|
69
65
|
_query_builder = Configuration.get_base_uri()
|
70
|
-
_query_builder << '/services/
|
66
|
+
_query_builder << '/services/{id}'
|
67
|
+
_query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
|
68
|
+
'id' => id
|
69
|
+
}
|
71
70
|
_query_url = APIHelper.clean_url _query_builder
|
72
71
|
|
73
72
|
# prepare headers
|
74
73
|
_headers = {
|
75
74
|
'accept' => 'application/json',
|
76
|
-
'content-type' => 'application/json; charset=utf-8',
|
77
75
|
'Authorization' => Configuration.authorization,
|
78
76
|
'Authorization' => authorization
|
79
77
|
}
|
80
78
|
|
81
79
|
# prepare and execute HttpRequest
|
82
|
-
_request = @http_client.
|
80
|
+
_request = @http_client.get _query_url, headers: _headers
|
83
81
|
CustomAuth.apply(_request)
|
84
82
|
_context = execute_request(_request)
|
85
83
|
|
@@ -92,8 +90,6 @@ module Gonebusy
|
|
92
90
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
93
91
|
elsif _context.response.status_code == 404
|
94
92
|
raise EntitiesErrorErrorException.new 'Not Found', _context
|
95
|
-
elsif _context.response.status_code == 422
|
96
|
-
raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
|
97
93
|
elsif !_context.response.status_code.between?(200, 208)
|
98
94
|
raise APIException.new 'Unexpected error', _context
|
99
95
|
end
|
@@ -101,47 +97,31 @@ module Gonebusy
|
|
101
97
|
|
102
98
|
# return appropriate response type
|
103
99
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
104
|
-
return
|
100
|
+
return GetServiceByIdResponse.from_hash(decoded)
|
105
101
|
end
|
106
102
|
|
107
|
-
#
|
103
|
+
# Create a Service with params.
|
108
104
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
109
|
-
# @param [
|
110
|
-
# @
|
111
|
-
|
112
|
-
|
113
|
-
# @param [Date] start_date Optional parameter: Start Date of a range to check for availability. If supplied, date must not be supplied and end_date must be supplied. Several formats are supported: '2014-10-31', 'October 31, 2014'.
|
114
|
-
# @return GetServiceAvailableSlotsByIdResponse response from the API call
|
115
|
-
def get_service_available_slots_by_id(authorization,
|
116
|
-
id,
|
117
|
-
date = nil,
|
118
|
-
end_date = nil,
|
119
|
-
resource_id = nil,
|
120
|
-
start_date = nil)
|
105
|
+
# @param [CreateServiceBody] create_service_body Optional parameter: the content of the request
|
106
|
+
# @return CreateServiceResponse response from the API call
|
107
|
+
def create_service(authorization,
|
108
|
+
create_service_body = nil)
|
121
109
|
|
122
110
|
# prepare query url
|
123
111
|
_query_builder = Configuration.get_base_uri()
|
124
|
-
_query_builder << '/services/
|
125
|
-
_query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
|
126
|
-
'id' => id
|
127
|
-
}
|
128
|
-
_query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
|
129
|
-
'date' => date,
|
130
|
-
'end_date' => end_date,
|
131
|
-
'resource_id' => resource_id,
|
132
|
-
'start_date' => start_date
|
133
|
-
}, array_serialization: Configuration.array_serialization
|
112
|
+
_query_builder << '/services/new'
|
134
113
|
_query_url = APIHelper.clean_url _query_builder
|
135
114
|
|
136
115
|
# prepare headers
|
137
116
|
_headers = {
|
138
117
|
'accept' => 'application/json',
|
118
|
+
'content-type' => 'application/json; charset=utf-8',
|
139
119
|
'Authorization' => Configuration.authorization,
|
140
120
|
'Authorization' => authorization
|
141
121
|
}
|
142
122
|
|
143
123
|
# prepare and execute HttpRequest
|
144
|
-
_request = @http_client.
|
124
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: create_service_body.to_json
|
145
125
|
CustomAuth.apply(_request)
|
146
126
|
_context = execute_request(_request)
|
147
127
|
|
@@ -154,6 +134,8 @@ module Gonebusy
|
|
154
134
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
155
135
|
elsif _context.response.status_code == 404
|
156
136
|
raise EntitiesErrorErrorException.new 'Not Found', _context
|
137
|
+
elsif _context.response.status_code == 422
|
138
|
+
raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
|
157
139
|
elsif !_context.response.status_code.between?(200, 208)
|
158
140
|
raise APIException.new 'Unexpected error', _context
|
159
141
|
end
|
@@ -161,15 +143,17 @@ module Gonebusy
|
|
161
143
|
|
162
144
|
# return appropriate response type
|
163
145
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
164
|
-
return
|
146
|
+
return CreateServiceResponse.from_hash(decoded)
|
165
147
|
end
|
166
148
|
|
167
|
-
#
|
149
|
+
# Update a Service with params.
|
168
150
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
169
151
|
# @param [String] id Required parameter: Example:
|
170
|
-
# @
|
171
|
-
|
172
|
-
|
152
|
+
# @param [UpdateServiceByIdBody] update_service_by_id_body Optional parameter: the content of the request
|
153
|
+
# @return UpdateServiceByIdResponse response from the API call
|
154
|
+
def update_service_by_id(authorization,
|
155
|
+
id,
|
156
|
+
update_service_by_id_body = nil)
|
173
157
|
|
174
158
|
# prepare query url
|
175
159
|
_query_builder = Configuration.get_base_uri()
|
@@ -182,12 +166,13 @@ module Gonebusy
|
|
182
166
|
# prepare headers
|
183
167
|
_headers = {
|
184
168
|
'accept' => 'application/json',
|
169
|
+
'content-type' => 'application/json; charset=utf-8',
|
185
170
|
'Authorization' => Configuration.authorization,
|
186
171
|
'Authorization' => authorization
|
187
172
|
}
|
188
173
|
|
189
174
|
# prepare and execute HttpRequest
|
190
|
-
_request = @http_client.
|
175
|
+
_request = @http_client.put _query_url, headers: _headers, parameters: update_service_by_id_body.to_json
|
191
176
|
CustomAuth.apply(_request)
|
192
177
|
_context = execute_request(_request)
|
193
178
|
|
@@ -200,6 +185,8 @@ module Gonebusy
|
|
200
185
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
201
186
|
elsif _context.response.status_code == 404
|
202
187
|
raise EntitiesErrorErrorException.new 'Not Found', _context
|
188
|
+
elsif _context.response.status_code == 422
|
189
|
+
raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
|
203
190
|
elsif !_context.response.status_code.between?(200, 208)
|
204
191
|
raise APIException.new 'Unexpected error', _context
|
205
192
|
end
|
@@ -207,36 +194,47 @@ module Gonebusy
|
|
207
194
|
|
208
195
|
# return appropriate response type
|
209
196
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
210
|
-
return
|
197
|
+
return UpdateServiceByIdResponse.from_hash(decoded)
|
211
198
|
end
|
212
199
|
|
213
|
-
#
|
200
|
+
# Return available times for a Service.
|
214
201
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
215
202
|
# @param [String] id Required parameter: Example:
|
216
|
-
# @param [
|
217
|
-
# @
|
218
|
-
|
219
|
-
|
220
|
-
|
203
|
+
# @param [Date] date Optional parameter: Date to check for availability. Either this field or a date range employing start_date and end_date must be supplied. If date is provided, start_date/end_date are ignored. Several formats are supported: '2014-10-31', 'October 31, 2014'.
|
204
|
+
# @param [Date] start_date Optional parameter: Start Date of a range to check for availability. If supplied, date must not be supplied and end_date must be supplied. Several formats are supported: '2014-10-31', 'October 31, 2014'.
|
205
|
+
# @param [Date] end_date Optional parameter: End Date of a range to check for availability. If supplied, date must not be supplied and start_date must be supplied. Several formats are supported: '2014-10-31', 'October 31, 2014'.
|
206
|
+
# @param [Integer] resource_id Optional parameter: Retrieve available slots only for this Resource. You must be authorized to manage this Resource.
|
207
|
+
# @return GetServiceAvailableSlotsByIdResponse response from the API call
|
208
|
+
def get_service_available_slots_by_id(authorization,
|
209
|
+
id,
|
210
|
+
date = nil,
|
211
|
+
start_date = nil,
|
212
|
+
end_date = nil,
|
213
|
+
resource_id = nil)
|
221
214
|
|
222
215
|
# prepare query url
|
223
216
|
_query_builder = Configuration.get_base_uri()
|
224
|
-
_query_builder << '/services/{id}'
|
217
|
+
_query_builder << '/services/{id}/available_slots'
|
225
218
|
_query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
|
226
219
|
'id' => id
|
227
220
|
}
|
221
|
+
_query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
|
222
|
+
'date' => date,
|
223
|
+
'start_date' => start_date,
|
224
|
+
'end_date' => end_date,
|
225
|
+
'resource_id' => resource_id
|
226
|
+
}, array_serialization: Configuration.array_serialization
|
228
227
|
_query_url = APIHelper.clean_url _query_builder
|
229
228
|
|
230
229
|
# prepare headers
|
231
230
|
_headers = {
|
232
231
|
'accept' => 'application/json',
|
233
|
-
'content-type' => 'application/json; charset=utf-8',
|
234
232
|
'Authorization' => Configuration.authorization,
|
235
233
|
'Authorization' => authorization
|
236
234
|
}
|
237
235
|
|
238
236
|
# prepare and execute HttpRequest
|
239
|
-
_request = @http_client.
|
237
|
+
_request = @http_client.get _query_url, headers: _headers
|
240
238
|
CustomAuth.apply(_request)
|
241
239
|
_context = execute_request(_request)
|
242
240
|
|
@@ -249,8 +247,6 @@ module Gonebusy
|
|
249
247
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
250
248
|
elsif _context.response.status_code == 404
|
251
249
|
raise EntitiesErrorErrorException.new 'Not Found', _context
|
252
|
-
elsif _context.response.status_code == 422
|
253
|
-
raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
|
254
250
|
elsif !_context.response.status_code.between?(200, 208)
|
255
251
|
raise APIException.new 'Unexpected error', _context
|
256
252
|
end
|
@@ -258,22 +254,28 @@ module Gonebusy
|
|
258
254
|
|
259
255
|
# return appropriate response type
|
260
256
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
261
|
-
return
|
257
|
+
return GetServiceAvailableSlotsByIdResponse.from_hash(decoded)
|
262
258
|
end
|
263
259
|
|
264
|
-
#
|
260
|
+
# Return list of Services.
|
265
261
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
266
|
-
# @param [
|
267
|
-
# @
|
268
|
-
|
269
|
-
|
262
|
+
# @param [Integer] user_id Optional parameter: Retrieve Services provided by the User specified by Id. You must be authorized to manage this User Id.
|
263
|
+
# @param [Integer] page Optional parameter: Page offset to fetch.
|
264
|
+
# @param [Integer] per_page Optional parameter: Number of results to return per page.
|
265
|
+
# @return GetServicesResponse response from the API call
|
266
|
+
def get_services(authorization,
|
267
|
+
user_id = nil,
|
268
|
+
page = 1,
|
269
|
+
per_page = 10)
|
270
270
|
|
271
271
|
# prepare query url
|
272
272
|
_query_builder = Configuration.get_base_uri()
|
273
|
-
_query_builder << '/services
|
274
|
-
_query_builder = APIHelper.
|
275
|
-
'
|
276
|
-
|
273
|
+
_query_builder << '/services'
|
274
|
+
_query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
|
275
|
+
'user_id' => user_id,
|
276
|
+
'page' => page,
|
277
|
+
'per_page' => per_page
|
278
|
+
}, array_serialization: Configuration.array_serialization
|
277
279
|
_query_url = APIHelper.clean_url _query_builder
|
278
280
|
|
279
281
|
# prepare headers
|
@@ -284,14 +286,12 @@ module Gonebusy
|
|
284
286
|
}
|
285
287
|
|
286
288
|
# prepare and execute HttpRequest
|
287
|
-
_request = @http_client.
|
289
|
+
_request = @http_client.get _query_url, headers: _headers
|
288
290
|
CustomAuth.apply(_request)
|
289
291
|
_context = execute_request(_request)
|
290
292
|
|
291
293
|
# validate response against endpoint and global error codes
|
292
|
-
if _context.response.status_code ==
|
293
|
-
raise EntitiesErrorErrorException.new 'Bad Request', _context
|
294
|
-
elsif _context.response.status_code == 401
|
294
|
+
if _context.response.status_code == 401
|
295
295
|
raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context
|
296
296
|
elsif _context.response.status_code == 403
|
297
297
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
@@ -304,7 +304,7 @@ module Gonebusy
|
|
304
304
|
|
305
305
|
# return appropriate response type
|
306
306
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
307
|
-
return
|
307
|
+
return GetServicesResponse.from_hash(decoded)
|
308
308
|
end
|
309
309
|
end
|
310
310
|
end
|
@@ -8,33 +8,33 @@ module Gonebusy
|
|
8
8
|
@@instance
|
9
9
|
end
|
10
10
|
|
11
|
-
#
|
11
|
+
# Update a User by id, with params.
|
12
12
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
13
|
-
# @param [
|
14
|
-
# @param [
|
15
|
-
# @return
|
16
|
-
def
|
17
|
-
|
18
|
-
|
13
|
+
# @param [String] id Required parameter: Example:
|
14
|
+
# @param [UpdateUserByIdBody] update_user_by_id_body Optional parameter: the content of the request
|
15
|
+
# @return UpdateUserByIdResponse response from the API call
|
16
|
+
def update_user_by_id(authorization,
|
17
|
+
id,
|
18
|
+
update_user_by_id_body = nil)
|
19
19
|
|
20
20
|
# prepare query url
|
21
21
|
_query_builder = Configuration.get_base_uri()
|
22
|
-
_query_builder << '/users'
|
23
|
-
_query_builder = APIHelper.
|
24
|
-
'
|
25
|
-
|
26
|
-
}, array_serialization: Configuration.array_serialization
|
22
|
+
_query_builder << '/users/{id}'
|
23
|
+
_query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
|
24
|
+
'id' => id
|
25
|
+
}
|
27
26
|
_query_url = APIHelper.clean_url _query_builder
|
28
27
|
|
29
28
|
# prepare headers
|
30
29
|
_headers = {
|
31
30
|
'accept' => 'application/json',
|
31
|
+
'content-type' => 'application/json; charset=utf-8',
|
32
32
|
'Authorization' => Configuration.authorization,
|
33
33
|
'Authorization' => authorization
|
34
34
|
}
|
35
35
|
|
36
36
|
# prepare and execute HttpRequest
|
37
|
-
_request = @http_client.
|
37
|
+
_request = @http_client.put _query_url, headers: _headers, parameters: update_user_by_id_body.to_json
|
38
38
|
CustomAuth.apply(_request)
|
39
39
|
_context = execute_request(_request)
|
40
40
|
|
@@ -45,6 +45,10 @@ module Gonebusy
|
|
45
45
|
raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context
|
46
46
|
elsif _context.response.status_code == 403
|
47
47
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
48
|
+
elsif _context.response.status_code == 404
|
49
|
+
raise EntitiesErrorErrorException.new 'Not Found', _context
|
50
|
+
elsif _context.response.status_code == 422
|
51
|
+
raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
|
48
52
|
elsif !_context.response.status_code.between?(200, 208)
|
49
53
|
raise APIException.new 'Unexpected error', _context
|
50
54
|
end
|
@@ -52,31 +56,33 @@ module Gonebusy
|
|
52
56
|
|
53
57
|
# return appropriate response type
|
54
58
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
55
|
-
return
|
59
|
+
return UpdateUserByIdResponse.from_hash(decoded)
|
56
60
|
end
|
57
61
|
|
58
|
-
#
|
62
|
+
# Return a User by id.
|
59
63
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
60
|
-
# @param [
|
61
|
-
# @return
|
62
|
-
def
|
63
|
-
|
64
|
+
# @param [String] id Required parameter: Example:
|
65
|
+
# @return GetUserByIdResponse response from the API call
|
66
|
+
def get_user_by_id(authorization,
|
67
|
+
id)
|
64
68
|
|
65
69
|
# prepare query url
|
66
70
|
_query_builder = Configuration.get_base_uri()
|
67
|
-
_query_builder << '/users/
|
71
|
+
_query_builder << '/users/{id}'
|
72
|
+
_query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
|
73
|
+
'id' => id
|
74
|
+
}
|
68
75
|
_query_url = APIHelper.clean_url _query_builder
|
69
76
|
|
70
77
|
# prepare headers
|
71
78
|
_headers = {
|
72
79
|
'accept' => 'application/json',
|
73
|
-
'content-type' => 'application/json; charset=utf-8',
|
74
80
|
'Authorization' => Configuration.authorization,
|
75
81
|
'Authorization' => authorization
|
76
82
|
}
|
77
83
|
|
78
84
|
# prepare and execute HttpRequest
|
79
|
-
_request = @http_client.
|
85
|
+
_request = @http_client.get _query_url, headers: _headers
|
80
86
|
CustomAuth.apply(_request)
|
81
87
|
_context = execute_request(_request)
|
82
88
|
|
@@ -87,8 +93,8 @@ module Gonebusy
|
|
87
93
|
raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context
|
88
94
|
elsif _context.response.status_code == 403
|
89
95
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
90
|
-
elsif _context.response.status_code ==
|
91
|
-
raise EntitiesErrorErrorException.new '
|
96
|
+
elsif _context.response.status_code == 404
|
97
|
+
raise EntitiesErrorErrorException.new 'Not Found', _context
|
92
98
|
elsif !_context.response.status_code.between?(200, 208)
|
93
99
|
raise APIException.new 'Unexpected error', _context
|
94
100
|
end
|
@@ -96,33 +102,31 @@ module Gonebusy
|
|
96
102
|
|
97
103
|
# return appropriate response type
|
98
104
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
99
|
-
return
|
105
|
+
return GetUserByIdResponse.from_hash(decoded)
|
100
106
|
end
|
101
107
|
|
102
|
-
#
|
108
|
+
# Create a User
|
103
109
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
104
|
-
# @param [
|
105
|
-
# @return
|
106
|
-
def
|
107
|
-
|
110
|
+
# @param [CreateUserBody] create_user_body Optional parameter: the content of the request
|
111
|
+
# @return CreateUserResponse response from the API call
|
112
|
+
def create_user(authorization,
|
113
|
+
create_user_body = nil)
|
108
114
|
|
109
115
|
# prepare query url
|
110
116
|
_query_builder = Configuration.get_base_uri()
|
111
|
-
_query_builder << '/users/
|
112
|
-
_query_builder = APIHelper.append_url_with_template_parameters _query_builder, {
|
113
|
-
'id' => id
|
114
|
-
}
|
117
|
+
_query_builder << '/users/new'
|
115
118
|
_query_url = APIHelper.clean_url _query_builder
|
116
119
|
|
117
120
|
# prepare headers
|
118
121
|
_headers = {
|
119
122
|
'accept' => 'application/json',
|
123
|
+
'content-type' => 'application/json; charset=utf-8',
|
120
124
|
'Authorization' => Configuration.authorization,
|
121
125
|
'Authorization' => authorization
|
122
126
|
}
|
123
127
|
|
124
128
|
# prepare and execute HttpRequest
|
125
|
-
_request = @http_client.
|
129
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: create_user_body.to_json
|
126
130
|
CustomAuth.apply(_request)
|
127
131
|
_context = execute_request(_request)
|
128
132
|
|
@@ -133,8 +137,8 @@ module Gonebusy
|
|
133
137
|
raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context
|
134
138
|
elsif _context.response.status_code == 403
|
135
139
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
136
|
-
elsif _context.response.status_code ==
|
137
|
-
raise EntitiesErrorErrorException.new '
|
140
|
+
elsif _context.response.status_code == 422
|
141
|
+
raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
|
138
142
|
elsif !_context.response.status_code.between?(200, 208)
|
139
143
|
raise APIException.new 'Unexpected error', _context
|
140
144
|
end
|
@@ -142,36 +146,36 @@ module Gonebusy
|
|
142
146
|
|
143
147
|
# return appropriate response type
|
144
148
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
145
|
-
return
|
149
|
+
return CreateUserResponse.from_hash(decoded)
|
146
150
|
end
|
147
151
|
|
148
|
-
#
|
152
|
+
# Return all Users that your account has access to. Includes your own User as well as any Users for which you are the Account Manager.
|
149
153
|
# @param [String] authorization Required parameter: A valid API key, in the format 'Token API_KEY'
|
150
|
-
# @param [
|
151
|
-
# @param [
|
152
|
-
# @return
|
153
|
-
def
|
154
|
-
|
155
|
-
|
154
|
+
# @param [Integer] page Optional parameter: Page offset to fetch.
|
155
|
+
# @param [Integer] per_page Optional parameter: Number of results to return per page.
|
156
|
+
# @return GetUsersResponse response from the API call
|
157
|
+
def get_users(authorization,
|
158
|
+
page = 1,
|
159
|
+
per_page = 10)
|
156
160
|
|
157
161
|
# prepare query url
|
158
162
|
_query_builder = Configuration.get_base_uri()
|
159
|
-
_query_builder << '/users
|
160
|
-
_query_builder = APIHelper.
|
161
|
-
'
|
162
|
-
|
163
|
+
_query_builder << '/users'
|
164
|
+
_query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
|
165
|
+
'page' => page,
|
166
|
+
'per_page' => per_page
|
167
|
+
}, array_serialization: Configuration.array_serialization
|
163
168
|
_query_url = APIHelper.clean_url _query_builder
|
164
169
|
|
165
170
|
# prepare headers
|
166
171
|
_headers = {
|
167
172
|
'accept' => 'application/json',
|
168
|
-
'content-type' => 'application/json; charset=utf-8',
|
169
173
|
'Authorization' => Configuration.authorization,
|
170
174
|
'Authorization' => authorization
|
171
175
|
}
|
172
176
|
|
173
177
|
# prepare and execute HttpRequest
|
174
|
-
_request = @http_client.
|
178
|
+
_request = @http_client.get _query_url, headers: _headers
|
175
179
|
CustomAuth.apply(_request)
|
176
180
|
_context = execute_request(_request)
|
177
181
|
|
@@ -182,10 +186,6 @@ module Gonebusy
|
|
182
186
|
raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context
|
183
187
|
elsif _context.response.status_code == 403
|
184
188
|
raise EntitiesErrorErrorException.new 'Forbidden', _context
|
185
|
-
elsif _context.response.status_code == 404
|
186
|
-
raise EntitiesErrorErrorException.new 'Not Found', _context
|
187
|
-
elsif _context.response.status_code == 422
|
188
|
-
raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context
|
189
189
|
elsif !_context.response.status_code.between?(200, 208)
|
190
190
|
raise APIException.new 'Unexpected error', _context
|
191
191
|
end
|
@@ -193,7 +193,7 @@ module Gonebusy
|
|
193
193
|
|
194
194
|
# return appropriate response type
|
195
195
|
decoded = APIHelper.json_deserialize(_context.response.raw_body)
|
196
|
-
return
|
196
|
+
return GetUsersResponse.from_hash(decoded)
|
197
197
|
end
|
198
198
|
end
|
199
199
|
end
|
@@ -8,11 +8,11 @@ module Gonebusy
|
|
8
8
|
|
9
9
|
# A mapping from model property names to API property names
|
10
10
|
def self.names
|
11
|
-
if @
|
12
|
-
@
|
13
|
-
@
|
11
|
+
if @_hash.nil?
|
12
|
+
@_hash = {}
|
13
|
+
@_hash["booking"] = "booking"
|
14
14
|
end
|
15
|
-
@
|
15
|
+
@_hash
|
16
16
|
end
|
17
17
|
|
18
18
|
def initialize(booking = nil)
|
@@ -21,15 +21,13 @@ module Gonebusy
|
|
21
21
|
|
22
22
|
# Creates an instance of the object from a hash
|
23
23
|
def self.from_hash(hash)
|
24
|
-
|
25
|
-
nil
|
26
|
-
else
|
27
|
-
# Extract variables from the hash
|
28
|
-
booking = EntitiesBookingResponse.from_hash(hash['booking']) if hash['booking']
|
24
|
+
return nil unless hash
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
# Extract variables from the hash
|
27
|
+
booking = EntitiesBookingResponse.from_hash(hash['booking']) if hash['booking']
|
28
|
+
|
29
|
+
# Create object from extracted values
|
30
|
+
CancelBookingByIdResponse.new(booking)
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|