gonebusy-ruby-client 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +29 -68
- data/lib/gonebusy/api_helper.rb +181 -149
- data/lib/gonebusy/configuration.rb +51 -16
- data/lib/gonebusy/controllers/base_controller.rb +46 -45
- data/lib/gonebusy/controllers/bookings_controller.rb +257 -293
- data/lib/gonebusy/controllers/categories_controller.rb +151 -180
- data/lib/gonebusy/controllers/pricing_models_controller.rb +202 -241
- data/lib/gonebusy/controllers/resources_controller.rb +295 -355
- data/lib/gonebusy/controllers/schedules_controller.rb +361 -428
- data/lib/gonebusy/controllers/search_controller.rb +52 -63
- data/lib/gonebusy/controllers/services_controller.rb +310 -367
- data/lib/gonebusy/controllers/users_controller.rb +199 -239
- data/lib/gonebusy/exceptions/api_exception.rb +16 -16
- data/lib/gonebusy/exceptions/entities_error_error_exception.rb +27 -0
- data/lib/gonebusy/exceptions/entities_error_exception.rb +26 -26
- data/lib/gonebusy/gonebusy_client.rb +58 -58
- data/lib/gonebusy/http/auth/custom_auth.rb +15 -15
- data/lib/gonebusy/http/faraday_client.rb +43 -41
- data/lib/gonebusy/http/http_call_back.rb +17 -17
- data/lib/gonebusy/http/http_client.rb +84 -82
- data/lib/gonebusy/http/http_context.rb +15 -15
- data/lib/gonebusy/http/http_method_enum.rb +7 -7
- data/lib/gonebusy/http/http_request.rb +44 -44
- data/lib/gonebusy/http/http_response.rb +19 -19
- data/lib/gonebusy/models/base_model.rb +31 -31
- data/lib/gonebusy/models/cancel_booking_by_id_response.rb +35 -35
- data/lib/gonebusy/models/create_booking_body.rb +134 -80
- data/lib/gonebusy/models/create_booking_response.rb +35 -35
- data/lib/gonebusy/models/create_category_body.rb +71 -71
- data/lib/gonebusy/models/create_category_response.rb +35 -35
- data/lib/gonebusy/models/create_pricing_model_body.rb +80 -80
- data/lib/gonebusy/models/create_pricing_model_response.rb +35 -35
- data/lib/gonebusy/models/create_resource_body.rb +89 -89
- data/lib/gonebusy/models/create_resource_response.rb +35 -35
- data/lib/gonebusy/models/create_schedule_body.rb +143 -144
- data/lib/gonebusy/models/create_schedule_response.rb +35 -35
- data/lib/gonebusy/models/create_schedule_time_window_body.rb +116 -117
- data/lib/gonebusy/models/create_schedule_time_window_response.rb +35 -35
- data/lib/gonebusy/models/create_service_body.rb +107 -107
- data/lib/gonebusy/models/create_service_response.rb +35 -35
- data/lib/gonebusy/models/create_user_body.rb +89 -89
- data/lib/gonebusy/models/create_user_response.rb +35 -35
- data/lib/gonebusy/models/date_recurs_by_enum.rb +12 -12
- data/lib/gonebusy/models/delete_resource_by_id_response.rb +35 -35
- data/lib/gonebusy/models/delete_schedule_by_id_response.rb +35 -35
- data/lib/gonebusy/models/delete_schedule_time_window_by_id_response.rb +35 -35
- data/lib/gonebusy/models/delete_service_by_id_response.rb +35 -35
- data/lib/gonebusy/models/entities_address_entity.rb +116 -116
- data/lib/gonebusy/models/entities_availability_response.rb +58 -58
- data/lib/gonebusy/models/entities_booking_response.rb +71 -71
- data/lib/gonebusy/models/entities_category_response.rb +98 -98
- data/lib/gonebusy/models/entities_pricing_model_response.rb +89 -89
- data/lib/gonebusy/models/entities_resource_availabilities.rb +49 -49
- data/lib/gonebusy/models/entities_resource_response.rb +107 -107
- data/lib/gonebusy/models/entities_schedule_response.rb +76 -76
- data/lib/gonebusy/models/entities_search_response.rb +54 -54
- data/lib/gonebusy/models/entities_service_response.rb +134 -130
- data/lib/gonebusy/models/entities_slots.rb +44 -45
- data/lib/gonebusy/models/entities_thing_type_response.rb +44 -44
- data/lib/gonebusy/models/entities_time_window_response.rb +134 -135
- data/lib/gonebusy/models/entities_user_response.rb +152 -152
- data/lib/gonebusy/models/frequency_enum.rb +17 -17
- data/lib/gonebusy/models/gender_enum.rb +9 -9
- data/lib/gonebusy/models/get_booking_by_id_response.rb +35 -35
- data/lib/gonebusy/models/get_bookings_response.rb +40 -40
- data/lib/gonebusy/models/get_categories_response.rb +40 -40
- data/lib/gonebusy/models/get_category_by_id_response.rb +35 -35
- data/lib/gonebusy/models/get_pricing_model_by_id_response.rb +35 -35
- data/lib/gonebusy/models/get_pricing_models_response.rb +40 -40
- data/lib/gonebusy/models/get_resource_by_id_response.rb +35 -35
- data/lib/gonebusy/models/get_resource_things_response.rb +40 -40
- data/lib/gonebusy/models/get_resources_response.rb +40 -40
- data/lib/gonebusy/models/get_schedule_by_id_response.rb +35 -35
- data/lib/gonebusy/models/get_schedules_response.rb +40 -40
- data/lib/gonebusy/models/get_service_available_slots_by_id_response.rb +35 -35
- data/lib/gonebusy/models/get_service_by_id_response.rb +35 -35
- data/lib/gonebusy/models/get_services_response.rb +40 -40
- data/lib/gonebusy/models/get_user_by_id_response.rb +35 -35
- data/lib/gonebusy/models/get_users_response.rb +40 -40
- data/lib/gonebusy/models/occurrence_enum.rb +21 -21
- data/lib/gonebusy/models/recurs_by_enum.rb +15 -15
- data/lib/gonebusy/models/search_query_response.rb +35 -35
- data/lib/gonebusy/models/update_booking_by_id_body.rb +116 -0
- data/lib/gonebusy/models/update_booking_by_id_response.rb +35 -35
- data/lib/gonebusy/models/update_pricing_model_by_id_body.rb +62 -62
- data/lib/gonebusy/models/update_pricing_model_by_id_response.rb +35 -35
- data/lib/gonebusy/models/update_resource_by_id_body.rb +71 -71
- data/lib/gonebusy/models/update_resource_by_id_response.rb +35 -35
- data/lib/gonebusy/models/update_schedule_time_window_by_id_body.rb +116 -117
- data/lib/gonebusy/models/update_schedule_time_window_by_id_response.rb +35 -35
- data/lib/gonebusy/models/update_service_by_id_body.rb +98 -98
- data/lib/gonebusy/models/update_service_by_id_response.rb +35 -35
- data/lib/gonebusy/models/update_user_by_id_body.rb +89 -89
- data/lib/gonebusy/models/update_user_by_id_response.rb +35 -35
- data/lib/gonebusy.rb +108 -104
- metadata +53 -17
@@ -0,0 +1,27 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Gonebusy
|
4
|
+
class EntitiesErrorErrorException < APIException
|
5
|
+
# description of error
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :message
|
8
|
+
|
9
|
+
# The constructor.
|
10
|
+
# @param [String] The reason for raising an exception
|
11
|
+
# @param [HttpContext] The HttpContext of the API call.
|
12
|
+
def initialize(reason, context)
|
13
|
+
super(reason, context)
|
14
|
+
begin
|
15
|
+
hash = APIHelper.json_deserialize(@context.response.raw_body)
|
16
|
+
unbox(hash)
|
17
|
+
rescue TypeError
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Populates this object by extracting properties from a hash.
|
22
|
+
# @param [Hash] The deserialized response sent by the server in the response body.
|
23
|
+
def unbox(hash)
|
24
|
+
@message = hash['message']
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
# This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
-
|
3
|
-
module Gonebusy
|
4
|
-
class EntitiesErrorException < APIException
|
5
|
-
# description of error
|
6
|
-
# @return [String]
|
7
|
-
attr_accessor :message
|
8
|
-
|
9
|
-
# The constructor.
|
10
|
-
# @param [String] The reason for raising an exception
|
11
|
-
# @param [HttpContext] The HttpContext of the API call.
|
12
|
-
def initialize(reason, context)
|
13
|
-
super(reason, context)
|
14
|
-
begin
|
15
|
-
hash = APIHelper.json_deserialize(@context.response.raw_body)
|
16
|
-
unbox(hash)
|
17
|
-
rescue TypeError
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# Populates this object by extracting properties from a hash.
|
22
|
-
# @param [Hash] The deserialized response sent by the server in the response body.
|
23
|
-
def unbox(hash)
|
24
|
-
@message = hash["message"]
|
25
|
-
end
|
26
|
-
end
|
1
|
+
# This file was automatically generated for GoneBusy Inc. by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Gonebusy
|
4
|
+
class EntitiesErrorException < APIException
|
5
|
+
# description of error
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :message
|
8
|
+
|
9
|
+
# The constructor.
|
10
|
+
# @param [String] The reason for raising an exception
|
11
|
+
# @param [HttpContext] The HttpContext of the API call.
|
12
|
+
def initialize(reason, context)
|
13
|
+
super(reason, context)
|
14
|
+
begin
|
15
|
+
hash = APIHelper.json_deserialize(@context.response.raw_body)
|
16
|
+
unbox(hash)
|
17
|
+
rescue TypeError
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Populates this object by extracting properties from a hash.
|
22
|
+
# @param [Hash] The deserialized response sent by the server in the response body.
|
23
|
+
def unbox(hash)
|
24
|
+
@message = hash["message"]
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
@@ -1,58 +1,58 @@
|
|
1
|
-
# This file was automatically generated
|
2
|
-
|
3
|
-
module Gonebusy
|
4
|
-
class GonebusyClient
|
5
|
-
# Singleton access to bookings controller
|
6
|
-
# @return [BookingsController] Returns the controller instance
|
7
|
-
def bookings
|
8
|
-
BookingsController.instance
|
9
|
-
end
|
10
|
-
|
11
|
-
# Singleton access to
|
12
|
-
# @return [
|
13
|
-
def
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
# Singleton access to
|
18
|
-
# @return [
|
19
|
-
def
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
# Singleton access to
|
24
|
-
# @return [
|
25
|
-
def
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
# Singleton access to schedules controller
|
30
|
-
# @return [SchedulesController] Returns the controller instance
|
31
|
-
def schedules
|
32
|
-
SchedulesController.instance
|
33
|
-
end
|
34
|
-
|
35
|
-
# Singleton access to
|
36
|
-
# @return [
|
37
|
-
def
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
# Singleton access to
|
42
|
-
# @return [
|
43
|
-
def
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
# Singleton access to
|
48
|
-
# @return [
|
49
|
-
def
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
# Initializer with authentication and configuration parameters
|
54
|
-
def initialize(authorization: 'Token <your API key>')
|
55
|
-
Configuration.authorization = authorization if authorization
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
1
|
+
# This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Gonebusy
|
4
|
+
class GonebusyClient
|
5
|
+
# Singleton access to bookings controller
|
6
|
+
# @return [BookingsController] Returns the controller instance
|
7
|
+
def bookings
|
8
|
+
BookingsController.instance
|
9
|
+
end
|
10
|
+
|
11
|
+
# Singleton access to categories controller
|
12
|
+
# @return [CategoriesController] Returns the controller instance
|
13
|
+
def categories
|
14
|
+
CategoriesController.instance
|
15
|
+
end
|
16
|
+
|
17
|
+
# Singleton access to pricing_models controller
|
18
|
+
# @return [PricingModelsController] Returns the controller instance
|
19
|
+
def pricing_models
|
20
|
+
PricingModelsController.instance
|
21
|
+
end
|
22
|
+
|
23
|
+
# Singleton access to resources controller
|
24
|
+
# @return [ResourcesController] Returns the controller instance
|
25
|
+
def resources
|
26
|
+
ResourcesController.instance
|
27
|
+
end
|
28
|
+
|
29
|
+
# Singleton access to schedules controller
|
30
|
+
# @return [SchedulesController] Returns the controller instance
|
31
|
+
def schedules
|
32
|
+
SchedulesController.instance
|
33
|
+
end
|
34
|
+
|
35
|
+
# Singleton access to search controller
|
36
|
+
# @return [SearchController] Returns the controller instance
|
37
|
+
def search
|
38
|
+
SearchController.instance
|
39
|
+
end
|
40
|
+
|
41
|
+
# Singleton access to services controller
|
42
|
+
# @return [ServicesController] Returns the controller instance
|
43
|
+
def services
|
44
|
+
ServicesController.instance
|
45
|
+
end
|
46
|
+
|
47
|
+
# Singleton access to users controller
|
48
|
+
# @return [UsersController] Returns the controller instance
|
49
|
+
def users
|
50
|
+
UsersController.instance
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializer with authentication and configuration parameters
|
54
|
+
def initialize(authorization: 'Token <your API key>')
|
55
|
+
Configuration.authorization = authorization if authorization
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
# This file was automatically generated
|
2
|
-
|
3
|
-
module Gonebusy
|
4
|
-
class CustomAuth
|
5
|
-
# Add custom authentication to the request.
|
6
|
-
# @param [HttpRequest] The HttpRequest object to which authentication will be added.
|
7
|
-
def self.apply(http_request)
|
8
|
-
# TODO: Add your custom authentication here
|
9
|
-
# The following properties are available to use
|
10
|
-
# Configuration.authorization
|
11
|
-
#
|
12
|
-
# Example:
|
13
|
-
# Add a header through: http_request.headers["key"] = "value"
|
14
|
-
end
|
15
|
-
end
|
1
|
+
# This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Gonebusy
|
4
|
+
class CustomAuth
|
5
|
+
# Add custom authentication to the request.
|
6
|
+
# @param [HttpRequest] The HttpRequest object to which authentication will be added.
|
7
|
+
def self.apply(http_request)
|
8
|
+
# TODO: Add your custom authentication here
|
9
|
+
# The following properties are available to use
|
10
|
+
# Configuration.authorization
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
# Add a header through: http_request.headers["key"] = "value"
|
14
|
+
end
|
15
|
+
end
|
16
16
|
end
|
@@ -1,41 +1,43 @@
|
|
1
|
-
# This file was automatically generated
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
faraday.
|
10
|
-
faraday.
|
11
|
-
faraday.
|
12
|
-
faraday.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
1
|
+
# This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
require 'faraday/http_cache'
|
3
|
+
|
4
|
+
module Gonebusy
|
5
|
+
class FaradayClient < HttpClient
|
6
|
+
# The constructor.
|
7
|
+
def initialize(timeout: nil, cache: false, max_retries: nil, retry_interval: nil)
|
8
|
+
@connection = Faraday.new do |faraday|
|
9
|
+
faraday.use Faraday::HttpCache, serializer: Marshal if cache
|
10
|
+
faraday.request :multipart
|
11
|
+
faraday.request :url_encoded
|
12
|
+
faraday.ssl[:ca_file] = Certifi.where
|
13
|
+
faraday.adapter Faraday.default_adapter
|
14
|
+
faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
|
15
|
+
faraday.options[:open_timeout] = timeout if timeout
|
16
|
+
faraday.request :retry, max: max_retries, interval: retry_interval if (max_retries && retry_interval)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Method overridden from HttpClient.
|
21
|
+
def execute_as_string(http_request)
|
22
|
+
response = @connection.send(http_request.http_method.downcase, http_request.query_url) do |request|
|
23
|
+
request.headers = http_request.headers
|
24
|
+
request.body = http_request.parameters
|
25
|
+
end
|
26
|
+
return convert_response(response)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Method overridden from HttpClient.
|
30
|
+
def execute_as_binary(http_request)
|
31
|
+
response = @connection.send(http_request.http_method.downcase, http_request.query_url) do |request|
|
32
|
+
request.headers = http_request.headers
|
33
|
+
request.body = http_request.parameters
|
34
|
+
end
|
35
|
+
return convert_response(response)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Method overridden from HttpClient.
|
39
|
+
def convert_response(response)
|
40
|
+
HttpResponse.new(response.status, response.headers, response.body)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
# This file was automatically generated
|
2
|
-
|
3
|
-
module Gonebusy
|
4
|
-
class HttpCallBack
|
5
|
-
# A controller will call this method before making an HTTP Request.
|
6
|
-
# @param [HttpRequest] The HttpRequest object which the HttpClient will execute.
|
7
|
-
def on_before_request(http_request)
|
8
|
-
raise NotImplementedError,
|
9
|
-
end
|
10
|
-
|
11
|
-
# A controller will call this method after making an HTTP Request.
|
12
|
-
# @param [HttpContext] The HttpContext of the API call.
|
13
|
-
def on_after_response(http_context)
|
14
|
-
raise NotImplementedError,
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
1
|
+
# This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Gonebusy
|
4
|
+
class HttpCallBack
|
5
|
+
# A controller will call this method before making an HTTP Request.
|
6
|
+
# @param [HttpRequest] The HttpRequest object which the HttpClient will execute.
|
7
|
+
def on_before_request(http_request)
|
8
|
+
raise NotImplementedError, 'This method needs to be implemented in a child class.'
|
9
|
+
end
|
10
|
+
|
11
|
+
# A controller will call this method after making an HTTP Request.
|
12
|
+
# @param [HttpContext] The HttpContext of the API call.
|
13
|
+
def on_after_response(http_context)
|
14
|
+
raise NotImplementedError, 'This method needs to be implemented in a child class.'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,82 +1,84 @@
|
|
1
|
-
# This file was automatically generated
|
2
|
-
|
3
|
-
module Gonebusy
|
4
|
-
class HttpClient
|
5
|
-
# Execute an HttpRequest when the response is expected to be a string.
|
6
|
-
# @param [HttpRequest] The HttpRequest to be executed.
|
7
|
-
def execute_as_string(http_request)
|
8
|
-
raise NotImplementedError,
|
9
|
-
end
|
10
|
-
|
11
|
-
# Execute an HttpRequest when the response is expected to be binary.
|
12
|
-
# @param [HttpRequest] The HttpRequest to be executed.
|
13
|
-
def execute_as_binary(http_request)
|
14
|
-
raise NotImplementedError,
|
15
|
-
end
|
16
|
-
|
17
|
-
# Converts the HTTP Response from the client to an HttpResponse object.
|
18
|
-
# @param [Dynamic] The response object received from the client.
|
19
|
-
def convert_response(response)
|
20
|
-
raise NotImplementedError,
|
21
|
-
end
|
22
|
-
|
23
|
-
# Get a GET HttpRequest object.
|
24
|
-
# @param [String] The URL to send the request to.
|
25
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
26
|
-
def get(query_url,
|
27
|
-
headers: {})
|
28
|
-
return HttpRequest.new(HttpMethodEnum::GET,
|
29
|
-
query_url,
|
30
|
-
headers: headers)
|
31
|
-
end
|
32
|
-
|
33
|
-
# Get a POST HttpRequest object.
|
34
|
-
# @param [String] The URL to send the request to.
|
35
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
36
|
-
# @param [Hash, Optional] The parameters for the HTTP Request.
|
37
|
-
def post(query_url,
|
38
|
-
headers: {},
|
39
|
-
parameters: {})
|
40
|
-
return HttpRequest.new(HttpMethodEnum::POST,
|
41
|
-
query_url,
|
42
|
-
headers: headers,
|
43
|
-
parameters: parameters)
|
44
|
-
end
|
45
|
-
|
46
|
-
# Get a PUT HttpRequest object.
|
47
|
-
# @param [String] The URL to send the request to.
|
48
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
49
|
-
# @param [Hash, Optional] The parameters for the HTTP Request.
|
50
|
-
def put(query_url,
|
51
|
-
headers: {},
|
52
|
-
parameters: {})
|
53
|
-
return HttpRequest.new(HttpMethodEnum::PUT,
|
54
|
-
query_url,
|
55
|
-
headers: headers,
|
56
|
-
parameters: parameters)
|
57
|
-
end
|
58
|
-
|
59
|
-
# Get a PATCH HttpRequest object.
|
60
|
-
# @param [String] The URL to send the request to.
|
61
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
62
|
-
# @param [Hash, Optional] The parameters for the HTTP Request.
|
63
|
-
def patch(query_url,
|
64
|
-
headers: {},
|
65
|
-
parameters: {})
|
66
|
-
return HttpRequest.new(HttpMethodEnum::PATCH,
|
67
|
-
query_url,
|
68
|
-
headers: headers,
|
69
|
-
parameters: parameters)
|
70
|
-
end
|
71
|
-
|
72
|
-
# Get a DELETE HttpRequest object.
|
73
|
-
# @param [String] The URL to send the request to.
|
74
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
75
|
-
def delete(query_url,
|
76
|
-
headers: {}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
1
|
+
# This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module Gonebusy
|
4
|
+
class HttpClient
|
5
|
+
# Execute an HttpRequest when the response is expected to be a string.
|
6
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
7
|
+
def execute_as_string(http_request)
|
8
|
+
raise NotImplementedError, 'This method needs to be implemented in a child class.'
|
9
|
+
end
|
10
|
+
|
11
|
+
# Execute an HttpRequest when the response is expected to be binary.
|
12
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
13
|
+
def execute_as_binary(http_request)
|
14
|
+
raise NotImplementedError, 'This method needs to be implemented in a child class.'
|
15
|
+
end
|
16
|
+
|
17
|
+
# Converts the HTTP Response from the client to an HttpResponse object.
|
18
|
+
# @param [Dynamic] The response object received from the client.
|
19
|
+
def convert_response(response)
|
20
|
+
raise NotImplementedError, 'This method needs to be implemented in a child class.'
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get a GET HttpRequest object.
|
24
|
+
# @param [String] The URL to send the request to.
|
25
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
26
|
+
def get(query_url,
|
27
|
+
headers: {})
|
28
|
+
return HttpRequest.new(HttpMethodEnum::GET,
|
29
|
+
query_url,
|
30
|
+
headers: headers)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get a POST HttpRequest object.
|
34
|
+
# @param [String] The URL to send the request to.
|
35
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
36
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
37
|
+
def post(query_url,
|
38
|
+
headers: {},
|
39
|
+
parameters: {})
|
40
|
+
return HttpRequest.new(HttpMethodEnum::POST,
|
41
|
+
query_url,
|
42
|
+
headers: headers,
|
43
|
+
parameters: parameters)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Get a PUT HttpRequest object.
|
47
|
+
# @param [String] The URL to send the request to.
|
48
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
49
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
50
|
+
def put(query_url,
|
51
|
+
headers: {},
|
52
|
+
parameters: {})
|
53
|
+
return HttpRequest.new(HttpMethodEnum::PUT,
|
54
|
+
query_url,
|
55
|
+
headers: headers,
|
56
|
+
parameters: parameters)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Get a PATCH HttpRequest object.
|
60
|
+
# @param [String] The URL to send the request to.
|
61
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
62
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
63
|
+
def patch(query_url,
|
64
|
+
headers: {},
|
65
|
+
parameters: {})
|
66
|
+
return HttpRequest.new(HttpMethodEnum::PATCH,
|
67
|
+
query_url,
|
68
|
+
headers: headers,
|
69
|
+
parameters: parameters)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Get a DELETE HttpRequest object.
|
73
|
+
# @param [String] The URL to send the request to.
|
74
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
75
|
+
def delete(query_url,
|
76
|
+
headers: {},
|
77
|
+
parameters: {})
|
78
|
+
return HttpRequest.new(HttpMethodEnum::DELETE,
|
79
|
+
query_url,
|
80
|
+
headers: headers,
|
81
|
+
parameters: parameters)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|