square.rb 3.20190814.0 → 3.20190925.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/square.rb +53 -52
- data/lib/square/api/apple_pay_api.rb +55 -55
- data/lib/square/api/base_api.rb +48 -45
- data/lib/square/api/catalog_api.rb +461 -461
- data/lib/square/api/checkout_api.rb +54 -54
- data/lib/square/api/customers_api.rb +335 -335
- data/lib/square/api/employees_api.rb +91 -91
- data/lib/square/api/inventory_api.rb +300 -300
- data/lib/square/api/labor_api.rb +558 -558
- data/lib/square/api/locations_api.rb +117 -45
- data/lib/square/api/merchants_api.rb +46 -0
- data/lib/square/api/mobile_authorization_api.rb +56 -56
- data/lib/square/api/o_auth_api.rb +168 -168
- data/lib/square/api/orders_api.rb +271 -269
- data/lib/square/api/payments_api.rb +282 -282
- data/lib/square/api/refunds_api.rb +149 -149
- data/lib/square/api/reporting_api.rb +145 -143
- data/lib/square/api/transactions_api.rb +379 -379
- data/lib/square/api/v1_employees_api.rb +720 -720
- data/lib/square/api/v1_items_api.rb +1651 -1651
- data/lib/square/api/v1_locations_api.rb +67 -67
- data/lib/square/api/v1_transactions_api.rb +574 -574
- data/lib/square/api_helper.rb +281 -281
- data/lib/square/client.rb +155 -139
- data/lib/square/configuration.rb +98 -88
- data/lib/square/exceptions/api_exception.rb +20 -20
- data/lib/square/http/api_response.rb +50 -50
- data/lib/square/http/auth/o_auth2.rb +17 -17
- data/lib/square/http/faraday_client.rb +64 -64
- data/lib/square/http/http_call_back.rb +24 -24
- data/lib/square/http/http_client.rb +104 -104
- data/lib/square/http/http_method_enum.rb +13 -13
- data/lib/square/http/http_request.rb +50 -50
- data/lib/square/http/http_response.rb +29 -29
- data/test/api/test_labor_api.rb +74 -0
- metadata +4 -3
- data/lib/square/api/v1_locations_api.rbe +0 -67
@@ -1,20 +1,20 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# Class for exceptions when there is a network error, status code error, etc.
|
8
|
-
class APIException < StandardError
|
9
|
-
attr_reader :response, :response_code
|
10
|
-
|
11
|
-
# The constructor.
|
12
|
-
# @param [String] The reason for raising an exception.
|
13
|
-
# @param [HttpResponse] The HttpReponse of the API call.
|
14
|
-
def initialize(reason, response)
|
15
|
-
super(reason)
|
16
|
-
@response = response
|
17
|
-
@response_code = response.status_code
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
8
|
+
class APIException < StandardError
|
9
|
+
attr_reader :response, :response_code
|
10
|
+
|
11
|
+
# The constructor.
|
12
|
+
# @param [String] The reason for raising an exception.
|
13
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
14
|
+
def initialize(reason, response)
|
15
|
+
super(reason)
|
16
|
+
@response = response
|
17
|
+
@response_code = response.status_code
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,50 +1,50 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# Http response received.
|
8
|
-
class ApiResponse
|
9
|
-
attr_reader(:status_code, :reason_phrase, :headers, :raw_body, :request,
|
10
|
-
:data, :errors, :body, :cursor)
|
11
|
-
|
12
|
-
# The constructor
|
13
|
-
# @param [HttpResponse] The original, raw response from the api.
|
14
|
-
# @param [Object] The data field specified for the response.
|
15
|
-
# @param [Array<String>] Any errors returned by the server.
|
16
|
-
def initialize(http_response,
|
17
|
-
data: nil,
|
18
|
-
errors: nil)
|
19
|
-
@status_code = http_response.status_code
|
20
|
-
@reason_phrase = http_response.reason_phrase
|
21
|
-
@headers = http_response.headers
|
22
|
-
@raw_body = http_response.raw_body
|
23
|
-
@request = http_response.request
|
24
|
-
@errors = errors
|
25
|
-
|
26
|
-
if data.is_a? Hash
|
27
|
-
if data.keys.any?
|
28
|
-
@body = Struct.new(*data.keys) do
|
29
|
-
define_method(:to_s) { http_response.raw_body }
|
30
|
-
end.new(*data.values)
|
31
|
-
|
32
|
-
@cursor = data.fetch(:cursor, nil)
|
33
|
-
data.reject! { |k| k == :cursor || k == :errors }
|
34
|
-
@data = Struct.new(*data.keys).new(*data.values) if data.keys.any?
|
35
|
-
end
|
36
|
-
else
|
37
|
-
@data = data
|
38
|
-
@body = data
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def success?
|
43
|
-
status_code >= 200 && status_code < 300
|
44
|
-
end
|
45
|
-
|
46
|
-
def error?
|
47
|
-
status_code >= 400 && status_code < 600
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# Http response received.
|
8
|
+
class ApiResponse
|
9
|
+
attr_reader(:status_code, :reason_phrase, :headers, :raw_body, :request,
|
10
|
+
:data, :errors, :body, :cursor)
|
11
|
+
|
12
|
+
# The constructor
|
13
|
+
# @param [HttpResponse] The original, raw response from the api.
|
14
|
+
# @param [Object] The data field specified for the response.
|
15
|
+
# @param [Array<String>] Any errors returned by the server.
|
16
|
+
def initialize(http_response,
|
17
|
+
data: nil,
|
18
|
+
errors: nil)
|
19
|
+
@status_code = http_response.status_code
|
20
|
+
@reason_phrase = http_response.reason_phrase
|
21
|
+
@headers = http_response.headers
|
22
|
+
@raw_body = http_response.raw_body
|
23
|
+
@request = http_response.request
|
24
|
+
@errors = errors
|
25
|
+
|
26
|
+
if data.is_a? Hash
|
27
|
+
if data.keys.any?
|
28
|
+
@body = Struct.new(*data.keys) do
|
29
|
+
define_method(:to_s) { http_response.raw_body }
|
30
|
+
end.new(*data.values)
|
31
|
+
|
32
|
+
@cursor = data.fetch(:cursor, nil)
|
33
|
+
data.reject! { |k| k == :cursor || k == :errors }
|
34
|
+
@data = Struct.new(*data.keys).new(*data.values) if data.keys.any?
|
35
|
+
end
|
36
|
+
else
|
37
|
+
@data = data
|
38
|
+
@body = data
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def success?
|
43
|
+
status_code >= 200 && status_code < 300
|
44
|
+
end
|
45
|
+
|
46
|
+
def error?
|
47
|
+
status_code >= 400 && status_code < 600
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# Utility class for OAuth 2 authorization and token management.
|
8
|
-
class OAuth2
|
9
|
-
# Add OAuth2 authentication to the http request.
|
10
|
-
# @param [HttpRequest] The HttpRequest object to which authentication will
|
11
|
-
# be added.
|
12
|
-
def self.apply(config, http_request)
|
13
|
-
token = config.access_token
|
14
|
-
http_request.headers['Authorization'] = "Bearer #{token}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# Utility class for OAuth 2 authorization and token management.
|
8
|
+
class OAuth2
|
9
|
+
# Add OAuth2 authentication to the http request.
|
10
|
+
# @param [HttpRequest] The HttpRequest object to which authentication will
|
11
|
+
# be added.
|
12
|
+
def self.apply(config, http_request)
|
13
|
+
token = config.access_token
|
14
|
+
http_request.headers['Authorization'] = "Bearer #{token}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,64 +1,64 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
require 'faraday/http_cache'
|
7
|
-
require 'faraday_middleware'
|
8
|
-
|
9
|
-
module Square
|
10
|
-
# An implementation of HttpClient.
|
11
|
-
class FaradayClient < HttpClient
|
12
|
-
# The constructor.
|
13
|
-
def initialize(timeout:, max_retries:, retry_interval:,
|
14
|
-
backoff_factor:, cache: false, verify: true)
|
15
|
-
@connection = Faraday.new do |faraday|
|
16
|
-
faraday.use Faraday::HttpCache, serializer: Marshal if cache
|
17
|
-
faraday.use FaradayMiddleware::FollowRedirects
|
18
|
-
faraday.request :multipart
|
19
|
-
faraday.request :url_encoded
|
20
|
-
faraday.ssl[:ca_file] = Certifi.where
|
21
|
-
faraday.ssl[:verify] = verify
|
22
|
-
faraday.request :retry, max: max_retries, interval: retry_interval,
|
23
|
-
backoff_factor: backoff_factor
|
24
|
-
faraday.adapter Faraday.default_adapter
|
25
|
-
faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
|
26
|
-
faraday.options[:timeout] = timeout if timeout > 0
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# Method overridden from HttpClient.
|
31
|
-
def execute_as_string(http_request)
|
32
|
-
response = @connection.send(
|
33
|
-
http_request.http_method.downcase,
|
34
|
-
http_request.query_url
|
35
|
-
) do |request|
|
36
|
-
request.headers = http_request.headers
|
37
|
-
unless http_request.parameters.empty?
|
38
|
-
request.body = http_request.parameters
|
39
|
-
end
|
40
|
-
end
|
41
|
-
convert_response(response, http_request)
|
42
|
-
end
|
43
|
-
|
44
|
-
# Method overridden from HttpClient.
|
45
|
-
def execute_as_binary(http_request)
|
46
|
-
response = @connection.send(
|
47
|
-
http_request.http_method.downcase,
|
48
|
-
http_request.query_url
|
49
|
-
) do |request|
|
50
|
-
request.headers = http_request.headers
|
51
|
-
unless http_request.parameters.empty?
|
52
|
-
request.body = http_request.parameters
|
53
|
-
end
|
54
|
-
end
|
55
|
-
convert_response(response, http_request)
|
56
|
-
end
|
57
|
-
|
58
|
-
# Method overridden from HttpClient.
|
59
|
-
def convert_response(response, http_request)
|
60
|
-
HttpResponse.new(response.status, response.reason_phrase,
|
61
|
-
response.headers, response.body, http_request)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'faraday/http_cache'
|
7
|
+
require 'faraday_middleware'
|
8
|
+
|
9
|
+
module Square
|
10
|
+
# An implementation of HttpClient.
|
11
|
+
class FaradayClient < HttpClient
|
12
|
+
# The constructor.
|
13
|
+
def initialize(timeout:, max_retries:, retry_interval:,
|
14
|
+
backoff_factor:, cache: false, verify: true)
|
15
|
+
@connection = Faraday.new do |faraday|
|
16
|
+
faraday.use Faraday::HttpCache, serializer: Marshal if cache
|
17
|
+
faraday.use FaradayMiddleware::FollowRedirects
|
18
|
+
faraday.request :multipart
|
19
|
+
faraday.request :url_encoded
|
20
|
+
faraday.ssl[:ca_file] = Certifi.where
|
21
|
+
faraday.ssl[:verify] = verify
|
22
|
+
faraday.request :retry, max: max_retries, interval: retry_interval,
|
23
|
+
backoff_factor: backoff_factor
|
24
|
+
faraday.adapter Faraday.default_adapter
|
25
|
+
faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
|
26
|
+
faraday.options[:timeout] = timeout if timeout > 0
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Method overridden from HttpClient.
|
31
|
+
def execute_as_string(http_request)
|
32
|
+
response = @connection.send(
|
33
|
+
http_request.http_method.downcase,
|
34
|
+
http_request.query_url
|
35
|
+
) do |request|
|
36
|
+
request.headers = http_request.headers
|
37
|
+
unless http_request.parameters.empty?
|
38
|
+
request.body = http_request.parameters
|
39
|
+
end
|
40
|
+
end
|
41
|
+
convert_response(response, http_request)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Method overridden from HttpClient.
|
45
|
+
def execute_as_binary(http_request)
|
46
|
+
response = @connection.send(
|
47
|
+
http_request.http_method.downcase,
|
48
|
+
http_request.query_url
|
49
|
+
) do |request|
|
50
|
+
request.headers = http_request.headers
|
51
|
+
unless http_request.parameters.empty?
|
52
|
+
request.body = http_request.parameters
|
53
|
+
end
|
54
|
+
end
|
55
|
+
convert_response(response, http_request)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Method overridden from HttpClient.
|
59
|
+
def convert_response(response, http_request)
|
60
|
+
HttpResponse.new(response.status, response.reason_phrase,
|
61
|
+
response.headers, response.body, http_request)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# HttpCallBack allows defining callables for pre and post API calls.
|
8
|
-
class HttpCallBack
|
9
|
-
# A controller will call this method before making an HTTP Request.
|
10
|
-
# @param [HttpRequest] The HttpRequest object which the HttpClient
|
11
|
-
# will execute.
|
12
|
-
def on_before_request(_http_request)
|
13
|
-
raise NotImplementedError, 'This method needs
|
14
|
-
to be implemented in a child class.'
|
15
|
-
end
|
16
|
-
|
17
|
-
# A controller will call this method after making an HTTP Request.
|
18
|
-
# @param [HttpResponse] The HttpReponse of the API call.
|
19
|
-
def on_after_response(_http_response)
|
20
|
-
raise NotImplementedError, 'This method needs
|
21
|
-
to be implemented in a child class.'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
8
|
+
class HttpCallBack
|
9
|
+
# A controller will call this method before making an HTTP Request.
|
10
|
+
# @param [HttpRequest] The HttpRequest object which the HttpClient
|
11
|
+
# will execute.
|
12
|
+
def on_before_request(_http_request)
|
13
|
+
raise NotImplementedError, 'This method needs
|
14
|
+
to be implemented in a child class.'
|
15
|
+
end
|
16
|
+
|
17
|
+
# A controller will call this method after making an HTTP Request.
|
18
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
19
|
+
def on_after_response(_http_response)
|
20
|
+
raise NotImplementedError, 'This method needs
|
21
|
+
to be implemented in a child class.'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,104 +1,104 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# An interface for the methods that an HTTP Client must implement.
|
8
|
-
#
|
9
|
-
# This class should not be instantiated but should be used as a base class
|
10
|
-
# for HTTP Client classes.
|
11
|
-
class HttpClient
|
12
|
-
# Execute an HttpRequest when the response is expected to be a string.
|
13
|
-
# @param [HttpRequest] The HttpRequest to be executed.
|
14
|
-
def execute_as_string(_http_request)
|
15
|
-
raise NotImplementedError, 'This method needs
|
16
|
-
to be implemented in a child class.'
|
17
|
-
end
|
18
|
-
|
19
|
-
# Execute an HttpRequest when the response is expected to be binary.
|
20
|
-
# @param [HttpRequest] The HttpRequest to be executed.
|
21
|
-
def execute_as_binary(_http_request)
|
22
|
-
raise NotImplementedError, 'This method needs
|
23
|
-
to be implemented in a child class.'
|
24
|
-
end
|
25
|
-
|
26
|
-
# Converts the HTTP Response from the client to an HttpResponse object.
|
27
|
-
# @param [Dynamic] The response object received from the client.
|
28
|
-
def convert_response(_response)
|
29
|
-
raise NotImplementedError, 'This method needs
|
30
|
-
to be implemented in a child class.'
|
31
|
-
end
|
32
|
-
|
33
|
-
# Get a GET HttpRequest object.
|
34
|
-
# @param [String] The URL to send the request to.
|
35
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
36
|
-
def get(query_url,
|
37
|
-
headers: {})
|
38
|
-
HttpRequest.new(HttpMethodEnum::GET,
|
39
|
-
query_url,
|
40
|
-
headers: headers)
|
41
|
-
end
|
42
|
-
|
43
|
-
# Get a HEAD HttpRequest object.
|
44
|
-
# @param [String] The URL to send the request to.
|
45
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
46
|
-
def head(query_url,
|
47
|
-
headers: {})
|
48
|
-
HttpRequest.new(HttpMethodEnum::HEAD,
|
49
|
-
query_url,
|
50
|
-
headers: headers)
|
51
|
-
end
|
52
|
-
|
53
|
-
# Get a POST HttpRequest object.
|
54
|
-
# @param [String] The URL to send the request to.
|
55
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
56
|
-
# @param [Hash, Optional] The parameters for the HTTP Request.
|
57
|
-
def post(query_url,
|
58
|
-
headers: {},
|
59
|
-
parameters: {})
|
60
|
-
HttpRequest.new(HttpMethodEnum::POST,
|
61
|
-
query_url,
|
62
|
-
headers: headers,
|
63
|
-
parameters: parameters)
|
64
|
-
end
|
65
|
-
|
66
|
-
# Get a PUT HttpRequest object.
|
67
|
-
# @param [String] The URL to send the request to.
|
68
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
69
|
-
# @param [Hash, Optional] The parameters for the HTTP Request.
|
70
|
-
def put(query_url,
|
71
|
-
headers: {},
|
72
|
-
parameters: {})
|
73
|
-
HttpRequest.new(HttpMethodEnum::PUT,
|
74
|
-
query_url,
|
75
|
-
headers: headers,
|
76
|
-
parameters: parameters)
|
77
|
-
end
|
78
|
-
|
79
|
-
# Get a PATCH HttpRequest object.
|
80
|
-
# @param [String] The URL to send the request to.
|
81
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
82
|
-
# @param [Hash, Optional] The parameters for the HTTP Request.
|
83
|
-
def patch(query_url,
|
84
|
-
headers: {},
|
85
|
-
parameters: {})
|
86
|
-
HttpRequest.new(HttpMethodEnum::PATCH,
|
87
|
-
query_url,
|
88
|
-
headers: headers,
|
89
|
-
parameters: parameters)
|
90
|
-
end
|
91
|
-
|
92
|
-
# Get a DELETE HttpRequest object.
|
93
|
-
# @param [String] The URL to send the request to.
|
94
|
-
# @param [Hash, Optional] The headers for the HTTP Request.
|
95
|
-
def delete(query_url,
|
96
|
-
headers: {},
|
97
|
-
parameters: {})
|
98
|
-
HttpRequest.new(HttpMethodEnum::DELETE,
|
99
|
-
query_url,
|
100
|
-
headers: headers,
|
101
|
-
parameters: parameters)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# An interface for the methods that an HTTP Client must implement.
|
8
|
+
#
|
9
|
+
# This class should not be instantiated but should be used as a base class
|
10
|
+
# for HTTP Client classes.
|
11
|
+
class HttpClient
|
12
|
+
# Execute an HttpRequest when the response is expected to be a string.
|
13
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
14
|
+
def execute_as_string(_http_request)
|
15
|
+
raise NotImplementedError, 'This method needs
|
16
|
+
to be implemented in a child class.'
|
17
|
+
end
|
18
|
+
|
19
|
+
# Execute an HttpRequest when the response is expected to be binary.
|
20
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
21
|
+
def execute_as_binary(_http_request)
|
22
|
+
raise NotImplementedError, 'This method needs
|
23
|
+
to be implemented in a child class.'
|
24
|
+
end
|
25
|
+
|
26
|
+
# Converts the HTTP Response from the client to an HttpResponse object.
|
27
|
+
# @param [Dynamic] The response object received from the client.
|
28
|
+
def convert_response(_response)
|
29
|
+
raise NotImplementedError, 'This method needs
|
30
|
+
to be implemented in a child class.'
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get a GET HttpRequest object.
|
34
|
+
# @param [String] The URL to send the request to.
|
35
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
36
|
+
def get(query_url,
|
37
|
+
headers: {})
|
38
|
+
HttpRequest.new(HttpMethodEnum::GET,
|
39
|
+
query_url,
|
40
|
+
headers: headers)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Get a HEAD HttpRequest object.
|
44
|
+
# @param [String] The URL to send the request to.
|
45
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
46
|
+
def head(query_url,
|
47
|
+
headers: {})
|
48
|
+
HttpRequest.new(HttpMethodEnum::HEAD,
|
49
|
+
query_url,
|
50
|
+
headers: headers)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Get a POST HttpRequest object.
|
54
|
+
# @param [String] The URL to send the request to.
|
55
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
56
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
57
|
+
def post(query_url,
|
58
|
+
headers: {},
|
59
|
+
parameters: {})
|
60
|
+
HttpRequest.new(HttpMethodEnum::POST,
|
61
|
+
query_url,
|
62
|
+
headers: headers,
|
63
|
+
parameters: parameters)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Get a PUT HttpRequest object.
|
67
|
+
# @param [String] The URL to send the request to.
|
68
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
69
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
70
|
+
def put(query_url,
|
71
|
+
headers: {},
|
72
|
+
parameters: {})
|
73
|
+
HttpRequest.new(HttpMethodEnum::PUT,
|
74
|
+
query_url,
|
75
|
+
headers: headers,
|
76
|
+
parameters: parameters)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Get a PATCH HttpRequest object.
|
80
|
+
# @param [String] The URL to send the request to.
|
81
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
82
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
83
|
+
def patch(query_url,
|
84
|
+
headers: {},
|
85
|
+
parameters: {})
|
86
|
+
HttpRequest.new(HttpMethodEnum::PATCH,
|
87
|
+
query_url,
|
88
|
+
headers: headers,
|
89
|
+
parameters: parameters)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Get a DELETE HttpRequest object.
|
93
|
+
# @param [String] The URL to send the request to.
|
94
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
95
|
+
def delete(query_url,
|
96
|
+
headers: {},
|
97
|
+
parameters: {})
|
98
|
+
HttpRequest.new(HttpMethodEnum::DELETE,
|
99
|
+
query_url,
|
100
|
+
headers: headers,
|
101
|
+
parameters: parameters)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|