square.rb 18.1.0.20220316 → 19.0.0.20220420
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/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/locations_api.rb +3 -4
- data/lib/square/api/orders_api.rb +2 -2
- data/lib/square/api/payouts_api.rb +173 -0
- data/lib/square/api/subscriptions_api.rb +0 -3
- data/lib/square/api/terminal_api.rb +14 -6
- data/lib/square/client.rb +8 -2
- data/lib/square/configuration.rb +1 -1
- data/lib/square/http/faraday_client.rb +15 -5
- data/lib/square/http/http_client.rb +31 -12
- data/lib/square/http/http_request.rb +6 -2
- data/lib/square.rb +1 -0
- metadata +46 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 431d8365d32b12be40203cfb143d88518f74cee228a0b36755cdc5fc8b782200
|
4
|
+
data.tar.gz: 5349f02eb93bf190d16d17ea0f13d3c434fdcb75a37825e1cdcb6406744c7385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65afbe4492802c447ee9aa509cc282720a88e7e34f398609818e4cc60b2262d05584bdb736793d44f4a2d49299f350a4c8241666ebe452634e2ac73097424633
|
7
|
+
data.tar.gz: a0a524485adeb61c20502b6956df68fc908c0e9e52459421be2382ad962ccd17a0e4f128d1bf7ed341a2f9bed95c31da735512ddd73327d7ba739c52ae38d1f9
|
data/lib/square/api/base_api.rb
CHANGED
@@ -38,7 +38,7 @@ module Square
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def get_user_agent
|
41
|
-
user_agent = 'Square-Ruby-SDK/
|
41
|
+
user_agent = 'Square-Ruby-SDK/19.0.0.20220420 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
|
42
42
|
user_agent['{engine}'] = RUBY_ENGINE
|
43
43
|
user_agent['{engine-version}'] = RUBY_ENGINE_VERSION
|
44
44
|
user_agent['{os-info}'] = RUBY_PLATFORM
|
@@ -40,12 +40,11 @@ module Square
|
|
40
40
|
# Creating new locations allows for separate configuration of receipt
|
41
41
|
# layouts, item prices,
|
42
42
|
# and sales reports. Developers can use locations to separate sales activity
|
43
|
-
#
|
43
|
+
# through applications
|
44
44
|
# that integrate with Square from sales activity elsewhere in a seller's
|
45
45
|
# account.
|
46
|
-
# Locations created programmatically with the Locations API
|
47
|
-
#
|
48
|
-
# are visible to the seller for their own management, so ensure that
|
46
|
+
# Locations created programmatically with the Locations API last forever and
|
47
|
+
# are visible to the seller for their own management. Therefore, ensure that
|
49
48
|
# each location has a sensible and unique name.
|
50
49
|
# @param [CreateLocationRequest] body Required parameter: An object
|
51
50
|
# containing the fields to POST for the request. See the corresponding
|
@@ -311,8 +311,8 @@ module Square
|
|
311
311
|
# the
|
312
312
|
# `payment_ids` is canceled.
|
313
313
|
# - Be approved with [delayed
|
314
|
-
# capture](https://developer.squareup.com/docs/payments-api/take-payments
|
315
|
-
#
|
314
|
+
# capture](https://developer.squareup.com/docs/payments-api/take-payments/ca
|
315
|
+
# rd-payments/delayed-capture).
|
316
316
|
# Using a delayed capture payment with `PayOrder` completes the approved
|
317
317
|
# payment.
|
318
318
|
# @param [String] order_id Required parameter: The ID of the order being
|
@@ -0,0 +1,173 @@
|
|
1
|
+
module Square
|
2
|
+
# PayoutsApi
|
3
|
+
class PayoutsApi < BaseApi
|
4
|
+
def initialize(config, http_call_back: nil)
|
5
|
+
super(config, http_call_back: http_call_back)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Retrieves a list of all payouts for the default location.
|
9
|
+
# You can filter payouts by location ID, status, time range, and order them
|
10
|
+
# in ascending or descending order.
|
11
|
+
# To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
|
12
|
+
# @param [String] location_id Optional parameter: The ID of the location for
|
13
|
+
# which to list the payouts. By default, payouts are returned for the
|
14
|
+
# default (main) location associated with the seller.
|
15
|
+
# @param [PayoutStatus] status Optional parameter: If provided, only payouts
|
16
|
+
# with the given status are returned.
|
17
|
+
# @param [String] begin_time Optional parameter: The timestamp for the
|
18
|
+
# beginning of the payout creation time, in RFC 3339 format. Inclusive.
|
19
|
+
# Default: The current time minus one year.
|
20
|
+
# @param [String] end_time Optional parameter: The timestamp for the end of
|
21
|
+
# the payout creation time, in RFC 3339 format. Default: The current time.
|
22
|
+
# @param [SortOrder] sort_order Optional parameter: The order in which
|
23
|
+
# payouts are listed.
|
24
|
+
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
25
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
26
|
+
# set of results for the original query. For more information, see
|
27
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
28
|
+
# . If request parameters change between requests, subsequent results may
|
29
|
+
# contain duplicates or missing records.
|
30
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
31
|
+
# to be returned in a single page. It is possible to receive fewer results
|
32
|
+
# than the specified limit on a given page. The default value of 100 is also
|
33
|
+
# the maximum allowed value. If the provided value is greater than 100, it
|
34
|
+
# is ignored and the default value is used instead. Default: `100`
|
35
|
+
# @return [ListPayoutsResponse Hash] response from the API call
|
36
|
+
def list_payouts(location_id: nil,
|
37
|
+
status: nil,
|
38
|
+
begin_time: nil,
|
39
|
+
end_time: nil,
|
40
|
+
sort_order: nil,
|
41
|
+
cursor: nil,
|
42
|
+
limit: nil)
|
43
|
+
# Prepare query url.
|
44
|
+
_query_builder = config.get_base_uri
|
45
|
+
_query_builder << '/v2/payouts'
|
46
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
47
|
+
_query_builder,
|
48
|
+
'location_id' => location_id,
|
49
|
+
'status' => status,
|
50
|
+
'begin_time' => begin_time,
|
51
|
+
'end_time' => end_time,
|
52
|
+
'sort_order' => sort_order,
|
53
|
+
'cursor' => cursor,
|
54
|
+
'limit' => limit
|
55
|
+
)
|
56
|
+
_query_url = APIHelper.clean_url _query_builder
|
57
|
+
|
58
|
+
# Prepare headers.
|
59
|
+
_headers = {
|
60
|
+
'accept' => 'application/json'
|
61
|
+
}
|
62
|
+
|
63
|
+
# Prepare and execute HttpRequest.
|
64
|
+
_request = config.http_client.get(
|
65
|
+
_query_url,
|
66
|
+
headers: _headers
|
67
|
+
)
|
68
|
+
OAuth2.apply(config, _request)
|
69
|
+
_response = execute_request(_request)
|
70
|
+
|
71
|
+
# Return appropriate response type.
|
72
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
73
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
74
|
+
ApiResponse.new(
|
75
|
+
_response, data: decoded, errors: _errors
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Retrieves details of a specific payout identified by a payout ID.
|
80
|
+
# To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
|
81
|
+
# @param [String] payout_id Required parameter: The ID of the payout to
|
82
|
+
# retrieve the information for.
|
83
|
+
# @return [GetPayoutResponse Hash] response from the API call
|
84
|
+
def get_payout(payout_id:)
|
85
|
+
# Prepare query url.
|
86
|
+
_query_builder = config.get_base_uri
|
87
|
+
_query_builder << '/v2/payouts/{payout_id}'
|
88
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
89
|
+
_query_builder,
|
90
|
+
'payout_id' => { 'value' => payout_id, 'encode' => true }
|
91
|
+
)
|
92
|
+
_query_url = APIHelper.clean_url _query_builder
|
93
|
+
|
94
|
+
# Prepare headers.
|
95
|
+
_headers = {
|
96
|
+
'accept' => 'application/json'
|
97
|
+
}
|
98
|
+
|
99
|
+
# Prepare and execute HttpRequest.
|
100
|
+
_request = config.http_client.get(
|
101
|
+
_query_url,
|
102
|
+
headers: _headers
|
103
|
+
)
|
104
|
+
OAuth2.apply(config, _request)
|
105
|
+
_response = execute_request(_request)
|
106
|
+
|
107
|
+
# Return appropriate response type.
|
108
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
109
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
110
|
+
ApiResponse.new(
|
111
|
+
_response, data: decoded, errors: _errors
|
112
|
+
)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Retrieves a list of all payout entries for a specific payout.
|
116
|
+
# To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
|
117
|
+
# @param [String] payout_id Required parameter: The ID of the payout to
|
118
|
+
# retrieve the information for.
|
119
|
+
# @param [SortOrder] sort_order Optional parameter: The order in which
|
120
|
+
# payout entries are listed.
|
121
|
+
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
122
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
123
|
+
# set of results for the original query. For more information, see
|
124
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
125
|
+
# . If request parameters change between requests, subsequent results may
|
126
|
+
# contain duplicates or missing records.
|
127
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
128
|
+
# to be returned in a single page. It is possible to receive fewer results
|
129
|
+
# than the specified limit on a given page. The default value of 100 is also
|
130
|
+
# the maximum allowed value. If the provided value is greater than 100, it
|
131
|
+
# is ignored and the default value is used instead. Default: `100`
|
132
|
+
# @return [ListPayoutEntriesResponse Hash] response from the API call
|
133
|
+
def list_payout_entries(payout_id:,
|
134
|
+
sort_order: nil,
|
135
|
+
cursor: nil,
|
136
|
+
limit: nil)
|
137
|
+
# Prepare query url.
|
138
|
+
_query_builder = config.get_base_uri
|
139
|
+
_query_builder << '/v2/payouts/{payout_id}/payout-entries'
|
140
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
141
|
+
_query_builder,
|
142
|
+
'payout_id' => { 'value' => payout_id, 'encode' => true }
|
143
|
+
)
|
144
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
145
|
+
_query_builder,
|
146
|
+
'sort_order' => sort_order,
|
147
|
+
'cursor' => cursor,
|
148
|
+
'limit' => limit
|
149
|
+
)
|
150
|
+
_query_url = APIHelper.clean_url _query_builder
|
151
|
+
|
152
|
+
# Prepare headers.
|
153
|
+
_headers = {
|
154
|
+
'accept' => 'application/json'
|
155
|
+
}
|
156
|
+
|
157
|
+
# Prepare and execute HttpRequest.
|
158
|
+
_request = config.http_client.get(
|
159
|
+
_query_url,
|
160
|
+
headers: _headers
|
161
|
+
)
|
162
|
+
OAuth2.apply(config, _request)
|
163
|
+
_response = execute_request(_request)
|
164
|
+
|
165
|
+
# Return appropriate response type.
|
166
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
167
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
168
|
+
ApiResponse.new(
|
169
|
+
_response, data: decoded, errors: _errors
|
170
|
+
)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -260,9 +260,6 @@ module Square
|
|
260
260
|
end
|
261
261
|
|
262
262
|
# Lists all events for a specific subscription.
|
263
|
-
# In the current implementation, only `START_SUBSCRIPTION` and
|
264
|
-
# `STOP_SUBSCRIPTION` (when the subscription was canceled) events are
|
265
|
-
# returned.
|
266
263
|
# @param [String] subscription_id Required parameter: The ID of the
|
267
264
|
# subscription to retrieve the events for.
|
268
265
|
# @param [String] cursor Optional parameter: When the total number of
|
@@ -41,8 +41,10 @@ module Square
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
|
-
#
|
45
|
-
#
|
44
|
+
# Returns a filtered list of Terminal checkout requests created by the
|
45
|
+
# application making the request. Only Terminal checkout requests created
|
46
|
+
# for the merchant scoped to the OAuth token are returned. Terminal checkout
|
47
|
+
# requests are available for 30 days.
|
46
48
|
# @param [SearchTerminalCheckoutsRequest] body Required parameter: An object
|
47
49
|
# containing the fields to POST for the request. See the corresponding
|
48
50
|
# object definition for field details.
|
@@ -76,7 +78,8 @@ module Square
|
|
76
78
|
)
|
77
79
|
end
|
78
80
|
|
79
|
-
# Retrieves a Terminal checkout request by `checkout_id`.
|
81
|
+
# Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout
|
82
|
+
# requests are available for 30 days.
|
80
83
|
# @param [String] checkout_id Required parameter: The unique ID for the
|
81
84
|
# desired `TerminalCheckout`.
|
82
85
|
# @return [GetTerminalCheckoutResponse Hash] response from the API call
|
@@ -148,7 +151,10 @@ module Square
|
|
148
151
|
end
|
149
152
|
|
150
153
|
# Creates a request to refund an Interac payment completed on a Square
|
151
|
-
# Terminal.
|
154
|
+
# Terminal. Refunds for Interac payments on a Square Terminal are supported
|
155
|
+
# only for Interac debit cards in Canada. Other refunds for Terminal
|
156
|
+
# payments should use the Refunds API. For more information, see [Refunds
|
157
|
+
# API]($e/Refunds).
|
152
158
|
# @param [CreateTerminalRefundRequest] body Required parameter: An object
|
153
159
|
# containing the fields to POST for the request. See the corresponding
|
154
160
|
# object definition for field details.
|
@@ -183,7 +189,8 @@ module Square
|
|
183
189
|
end
|
184
190
|
|
185
191
|
# Retrieves a filtered list of Interac Terminal refund requests created by
|
186
|
-
# the seller making the request.
|
192
|
+
# the seller making the request. Terminal refund requests are available for
|
193
|
+
# 30 days.
|
187
194
|
# @param [SearchTerminalRefundsRequest] body Required parameter: An object
|
188
195
|
# containing the fields to POST for the request. See the corresponding
|
189
196
|
# object definition for field details.
|
@@ -217,7 +224,8 @@ module Square
|
|
217
224
|
)
|
218
225
|
end
|
219
226
|
|
220
|
-
# Retrieves an Interac Terminal refund object by ID.
|
227
|
+
# Retrieves an Interac Terminal refund object by ID. Terminal refund objects
|
228
|
+
# are available for 30 days.
|
221
229
|
# @param [String] terminal_refund_id Required parameter: The unique ID for
|
222
230
|
# the desired `TerminalRefund`.
|
223
231
|
# @return [GetTerminalRefundResponse Hash] response from the API call
|
data/lib/square/client.rb
CHANGED
@@ -4,7 +4,7 @@ module Square
|
|
4
4
|
attr_reader :config
|
5
5
|
|
6
6
|
def sdk_version
|
7
|
-
'
|
7
|
+
'19.0.0.20220420'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -177,6 +177,12 @@ module Square
|
|
177
177
|
@payments ||= PaymentsApi.new config
|
178
178
|
end
|
179
179
|
|
180
|
+
# Access to payouts controller.
|
181
|
+
# @return [PayoutsApi] Returns the controller instance.
|
182
|
+
def payouts
|
183
|
+
@payouts ||= PayoutsApi.new config
|
184
|
+
end
|
185
|
+
|
180
186
|
# Access to refunds controller.
|
181
187
|
# @return [RefundsApi] Returns the controller instance.
|
182
188
|
def refunds
|
@@ -224,7 +230,7 @@ module Square
|
|
224
230
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
225
231
|
retry_methods: %i[get put], environment: 'production',
|
226
232
|
custom_url: 'https://connect.squareup.com',
|
227
|
-
square_version: '2022-
|
233
|
+
square_version: '2022-04-20', access_token: '',
|
228
234
|
user_agent_detail: '', additional_headers: {}, config: nil)
|
229
235
|
@config = if config.nil?
|
230
236
|
Configuration.new(connection: connection, timeout: timeout,
|
data/lib/square/configuration.rb
CHANGED
@@ -20,7 +20,7 @@ module Square
|
|
20
20
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
21
21
|
retry_methods: %i[get put], environment: 'production',
|
22
22
|
custom_url: 'https://connect.squareup.com',
|
23
|
-
square_version: '2022-
|
23
|
+
square_version: '2022-04-20', access_token: '',
|
24
24
|
user_agent_detail: '', additional_headers: {})
|
25
25
|
# The Faraday connection object passed by the SDK user for making requests
|
26
26
|
@connection = connection
|
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'faraday/http_cache'
|
2
|
-
require '
|
2
|
+
require 'faraday/retry'
|
3
|
+
require 'faraday/multipart'
|
4
|
+
require 'faraday/follow_redirects'
|
5
|
+
require 'faraday/gzip'
|
3
6
|
|
4
7
|
module Square
|
5
8
|
# An implementation of HttpClient.
|
@@ -27,8 +30,8 @@ module Square
|
|
27
30
|
cache: false, verify: true)
|
28
31
|
Faraday.new do |faraday|
|
29
32
|
faraday.use Faraday::HttpCache, serializer: Marshal if cache
|
30
|
-
faraday.use
|
31
|
-
faraday.
|
33
|
+
faraday.use Faraday::FollowRedirects::Middleware
|
34
|
+
faraday.request :gzip
|
32
35
|
faraday.request :multipart
|
33
36
|
faraday.request :url_encoded
|
34
37
|
faraday.ssl[:ca_file] = Certifi.where
|
@@ -36,7 +39,10 @@ module Square
|
|
36
39
|
faraday.request :retry, max: max_retries, interval: retry_interval,
|
37
40
|
backoff_factor: backoff_factor,
|
38
41
|
retry_statuses: retry_statuses,
|
39
|
-
methods: retry_methods
|
42
|
+
methods: retry_methods,
|
43
|
+
retry_if: proc { |env, _exc|
|
44
|
+
env.request.context['forced_retry'] ||= false
|
45
|
+
}
|
40
46
|
faraday.adapter Faraday.default_adapter
|
41
47
|
faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
|
42
48
|
faraday.options[:timeout] = timeout if timeout.positive?
|
@@ -49,7 +55,9 @@ module Square
|
|
49
55
|
http_request.http_method.downcase,
|
50
56
|
http_request.query_url
|
51
57
|
) do |request|
|
52
|
-
request.headers = http_request.headers
|
58
|
+
request.headers = http_request.headers.map { |k, v| [k.to_s, v.to_s] }
|
59
|
+
request.options.context ||= {}
|
60
|
+
request.options.context.merge!(http_request.context)
|
53
61
|
unless http_request.http_method == HttpMethodEnum::GET &&
|
54
62
|
http_request.parameters.empty?
|
55
63
|
request.body = http_request.parameters
|
@@ -65,6 +73,8 @@ module Square
|
|
65
73
|
http_request.query_url
|
66
74
|
) do |request|
|
67
75
|
request.headers = http_request.headers
|
76
|
+
request.options.context ||= {}
|
77
|
+
request.options.context.merge!(http_request.context)
|
68
78
|
unless http_request.http_method == HttpMethodEnum::GET &&
|
69
79
|
http_request.parameters.empty?
|
70
80
|
request.body = http_request.parameters
|
@@ -28,72 +28,91 @@ module Square
|
|
28
28
|
# Get a GET HttpRequest object.
|
29
29
|
# @param [String] The URL to send the request to.
|
30
30
|
# @param [Hash, Optional] The headers for the HTTP Request.
|
31
|
+
# @param [Hash, Optional] The context for the HTTP Request.
|
31
32
|
def get(query_url,
|
32
|
-
headers: {}
|
33
|
+
headers: {},
|
34
|
+
context: {})
|
33
35
|
HttpRequest.new(HttpMethodEnum::GET,
|
34
36
|
query_url,
|
35
|
-
headers: headers
|
37
|
+
headers: headers,
|
38
|
+
context: context)
|
36
39
|
end
|
37
40
|
|
38
41
|
# Get a HEAD HttpRequest object.
|
39
42
|
# @param [String] The URL to send the request to.
|
40
43
|
# @param [Hash, Optional] The headers for the HTTP Request.
|
44
|
+
# @param [Hash, Optional] The context for the HTTP Request.
|
41
45
|
def head(query_url,
|
42
|
-
headers: {}
|
46
|
+
headers: {},
|
47
|
+
context: {})
|
43
48
|
HttpRequest.new(HttpMethodEnum::HEAD,
|
44
49
|
query_url,
|
45
|
-
headers: headers
|
50
|
+
headers: headers,
|
51
|
+
context: context)
|
46
52
|
end
|
47
53
|
|
48
54
|
# Get a POST HttpRequest object.
|
49
55
|
# @param [String] The URL to send the request to.
|
50
56
|
# @param [Hash, Optional] The headers for the HTTP Request.
|
51
57
|
# @param [Hash, Optional] The parameters for the HTTP Request.
|
58
|
+
# @param [Hash, Optional] The context for the HTTP Request.
|
52
59
|
def post(query_url,
|
53
60
|
headers: {},
|
54
|
-
parameters: {}
|
61
|
+
parameters: {},
|
62
|
+
context: {})
|
55
63
|
HttpRequest.new(HttpMethodEnum::POST,
|
56
64
|
query_url,
|
57
65
|
headers: headers,
|
58
|
-
parameters: parameters
|
66
|
+
parameters: parameters,
|
67
|
+
context: context)
|
59
68
|
end
|
60
69
|
|
61
70
|
# Get a PUT HttpRequest object.
|
62
71
|
# @param [String] The URL to send the request to.
|
63
72
|
# @param [Hash, Optional] The headers for the HTTP Request.
|
64
73
|
# @param [Hash, Optional] The parameters for the HTTP Request.
|
74
|
+
# @param [Hash, Optional] The context for the HTTP Request.
|
65
75
|
def put(query_url,
|
66
76
|
headers: {},
|
67
|
-
parameters: {}
|
77
|
+
parameters: {},
|
78
|
+
context: {})
|
68
79
|
HttpRequest.new(HttpMethodEnum::PUT,
|
69
80
|
query_url,
|
70
81
|
headers: headers,
|
71
|
-
parameters: parameters
|
82
|
+
parameters: parameters,
|
83
|
+
context: context)
|
72
84
|
end
|
73
85
|
|
74
86
|
# Get a PATCH HttpRequest object.
|
75
87
|
# @param [String] The URL to send the request to.
|
76
88
|
# @param [Hash, Optional] The headers for the HTTP Request.
|
77
89
|
# @param [Hash, Optional] The parameters for the HTTP Request.
|
90
|
+
# @param [Hash, Optional] The context for the HTTP Request.
|
78
91
|
def patch(query_url,
|
79
92
|
headers: {},
|
80
|
-
parameters: {}
|
93
|
+
parameters: {},
|
94
|
+
context: {})
|
81
95
|
HttpRequest.new(HttpMethodEnum::PATCH,
|
82
96
|
query_url,
|
83
97
|
headers: headers,
|
84
|
-
parameters: parameters
|
98
|
+
parameters: parameters,
|
99
|
+
context: context)
|
85
100
|
end
|
86
101
|
|
87
102
|
# Get a DELETE HttpRequest object.
|
88
103
|
# @param [String] The URL to send the request to.
|
89
104
|
# @param [Hash, Optional] The headers for the HTTP Request.
|
105
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
106
|
+
# @param [Hash, Optional] The context for the HTTP Request.
|
90
107
|
def delete(query_url,
|
91
108
|
headers: {},
|
92
|
-
parameters: {}
|
109
|
+
parameters: {},
|
110
|
+
context: {})
|
93
111
|
HttpRequest.new(HttpMethodEnum::DELETE,
|
94
112
|
query_url,
|
95
113
|
headers: headers,
|
96
|
-
parameters: parameters
|
114
|
+
parameters: parameters,
|
115
|
+
context: context)
|
97
116
|
end
|
98
117
|
end
|
99
118
|
end
|
@@ -2,21 +2,25 @@ module Square
|
|
2
2
|
# Represents a single Http Request.
|
3
3
|
class HttpRequest
|
4
4
|
attr_accessor :http_method, :query_url, :headers,
|
5
|
-
:parameters, :username, :password
|
5
|
+
:parameters, :username, :password,
|
6
|
+
:context
|
6
7
|
|
7
8
|
# The constructor.
|
8
9
|
# @param [HttpMethodEnum] The HTTP method.
|
9
10
|
# @param [String] The URL to send the request to.
|
10
11
|
# @param [Hash, Optional] The headers for the HTTP Request.
|
11
12
|
# @param [Hash, Optional] The parameters for the HTTP Request.
|
13
|
+
# @param [Hash, Optional] The context for the HTTP Request.
|
12
14
|
def initialize(http_method,
|
13
15
|
query_url,
|
14
16
|
headers: {},
|
15
|
-
parameters: {}
|
17
|
+
parameters: {},
|
18
|
+
context: {})
|
16
19
|
@http_method = http_method
|
17
20
|
@query_url = query_url
|
18
21
|
@headers = headers
|
19
22
|
@parameters = parameters
|
23
|
+
@context = context
|
20
24
|
end
|
21
25
|
|
22
26
|
# Add a header to the HttpRequest.
|
data/lib/square.rb
CHANGED
@@ -57,6 +57,7 @@ require_relative 'square/api/loyalty_api'
|
|
57
57
|
require_relative 'square/api/merchants_api'
|
58
58
|
require_relative 'square/api/orders_api'
|
59
59
|
require_relative 'square/api/payments_api'
|
60
|
+
require_relative 'square/api/payouts_api'
|
60
61
|
require_relative 'square/api/refunds_api'
|
61
62
|
require_relative 'square/api/sites_api'
|
62
63
|
require_relative 'square/api/snippets_api'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: square.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 19.0.0.20220420
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Square Developer Platform
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -30,22 +30,58 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday-follow_redirects
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
35
46
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
47
|
+
version: '0.2'
|
37
48
|
type: :runtime
|
38
49
|
prerelease: false
|
39
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday-multipart
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
40
58
|
requirements:
|
41
59
|
- - "~>"
|
42
60
|
- !ruby/object:Gem::Version
|
43
61
|
version: '1.0'
|
44
|
-
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday-gzip
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
45
81
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
82
|
+
version: '0.1'
|
47
83
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
84
|
+
name: faraday-retry
|
49
85
|
requirement: !ruby/object:Gem::Requirement
|
50
86
|
requirements:
|
51
87
|
- - "~>"
|
@@ -162,6 +198,7 @@ files:
|
|
162
198
|
- lib/square/api/o_auth_api.rb
|
163
199
|
- lib/square/api/orders_api.rb
|
164
200
|
- lib/square/api/payments_api.rb
|
201
|
+
- lib/square/api/payouts_api.rb
|
165
202
|
- lib/square/api/refunds_api.rb
|
166
203
|
- lib/square/api/sites_api.rb
|
167
204
|
- lib/square/api/snippets_api.rb
|
@@ -209,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
246
|
requirements:
|
210
247
|
- - ">="
|
211
248
|
- !ruby/object:Gem::Version
|
212
|
-
version: '2.
|
249
|
+
version: '2.6'
|
213
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
251
|
requirements:
|
215
252
|
- - ">="
|