square.rb 9.0.0.20210226 → 11.0.0.20210513
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 +9 -3
- data/lib/square.rb +2 -0
- data/lib/square/api/apple_pay_api.rb +8 -7
- data/lib/square/api/bank_accounts_api.rb +5 -5
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/bookings_api.rb +3 -5
- data/lib/square/api/cash_drawers_api.rb +2 -2
- data/lib/square/api/catalog_api.rb +34 -37
- data/lib/square/api/checkout_api.rb +2 -2
- data/lib/square/api/customer_groups_api.rb +4 -4
- data/lib/square/api/customer_segments_api.rb +4 -4
- data/lib/square/api/customers_api.rb +45 -24
- data/lib/square/api/devices_api.rb +2 -1
- data/lib/square/api/disputes_api.rb +4 -6
- data/lib/square/api/inventory_api.rb +16 -16
- data/lib/square/api/invoices_api.rb +14 -14
- data/lib/square/api/locations_api.rb +1 -2
- data/lib/square/api/loyalty_api.rb +66 -14
- data/lib/square/api/merchants_api.rb +1 -1
- data/lib/square/api/orders_api.rb +35 -33
- data/lib/square/api/payments_api.rb +60 -18
- data/lib/square/api/refunds_api.rb +10 -2
- data/lib/square/api/sites_api.rb +42 -0
- data/lib/square/api/snippets_api.rb +146 -0
- data/lib/square/api/subscriptions_api.rb +36 -1
- data/lib/square/api/team_api.rb +10 -10
- data/lib/square/api/terminal_api.rb +15 -14
- data/lib/square/api/transactions_api.rb +29 -18
- data/lib/square/api/v1_employees_api.rb +2 -1
- data/lib/square/api/v1_transactions_api.rb +9 -0
- data/lib/square/api_helper.rb +5 -5
- data/lib/square/client.rb +14 -2
- data/lib/square/configuration.rb +1 -1
- data/test/api/test_locations_api.rb +1 -1
- metadata +4 -2
@@ -12,24 +12,29 @@ module Square
|
|
12
12
|
# Point of Sale applications.
|
13
13
|
# Refunds with a `status` of `PENDING` are not currently included in this
|
14
14
|
# endpoint's response.
|
15
|
-
# Max results per
|
15
|
+
# Max results per
|
16
|
+
# [page](https://developer.squareup.com/docs/working-with-apis/pagination):
|
17
|
+
# 50
|
16
18
|
# @param [String] location_id Required parameter: The ID of the location to
|
17
19
|
# list refunds for.
|
18
20
|
# @param [String] begin_time Optional parameter: The beginning of the
|
19
21
|
# requested reporting period, in RFC 3339 format. See [Date
|
20
|
-
# ranges](
|
21
|
-
#
|
22
|
+
# ranges](https://developer.squareup.com/docs/build-basics/working-with-date
|
23
|
+
# s) for details on date inclusivity/exclusivity. Default value: The
|
24
|
+
# current time minus one year.
|
22
25
|
# @param [String] end_time Optional parameter: The end of the requested
|
23
|
-
# reporting period, in RFC 3339 format. See [Date
|
24
|
-
#
|
25
|
-
#
|
26
|
+
# reporting period, in RFC 3339 format. See [Date
|
27
|
+
# ranges](https://developer.squareup.com/docs/build-basics/working-with-date
|
28
|
+
# s) for details on date inclusivity/exclusivity. Default value: The
|
29
|
+
# current time.
|
26
30
|
# @param [SortOrder] sort_order Optional parameter: The order in which
|
27
31
|
# results are listed in the response (`ASC` for oldest first, `DESC` for
|
28
32
|
# newest first). Default value: `DESC`
|
29
33
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
30
34
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
31
35
|
# results for your original query. See [Paginating
|
32
|
-
# results](
|
36
|
+
# results](https://developer.squareup.com/docs/working-with-apis/pagination)
|
37
|
+
# for more information.
|
33
38
|
# @return [ListRefundsResponse Hash] response from the API call
|
34
39
|
def list_refunds(location_id:,
|
35
40
|
begin_time: nil,
|
@@ -78,24 +83,29 @@ module Square
|
|
78
83
|
# Transactions include payment information from sales and exchanges and
|
79
84
|
# refund
|
80
85
|
# information from returns and exchanges.
|
81
|
-
# Max results per
|
86
|
+
# Max results per
|
87
|
+
# [page](https://developer.squareup.com/docs/working-with-apis/pagination):
|
88
|
+
# 50
|
82
89
|
# @param [String] location_id Required parameter: The ID of the location to
|
83
90
|
# list transactions for.
|
84
91
|
# @param [String] begin_time Optional parameter: The beginning of the
|
85
92
|
# requested reporting period, in RFC 3339 format. See [Date
|
86
|
-
# ranges](
|
87
|
-
#
|
93
|
+
# ranges](https://developer.squareup.com/docs/build-basics/working-with-date
|
94
|
+
# s) for details on date inclusivity/exclusivity. Default value: The
|
95
|
+
# current time minus one year.
|
88
96
|
# @param [String] end_time Optional parameter: The end of the requested
|
89
|
-
# reporting period, in RFC 3339 format. See [Date
|
90
|
-
#
|
91
|
-
#
|
97
|
+
# reporting period, in RFC 3339 format. See [Date
|
98
|
+
# ranges](https://developer.squareup.com/docs/build-basics/working-with-date
|
99
|
+
# s) for details on date inclusivity/exclusivity. Default value: The
|
100
|
+
# current time.
|
92
101
|
# @param [SortOrder] sort_order Optional parameter: The order in which
|
93
102
|
# results are listed in the response (`ASC` for oldest first, `DESC` for
|
94
103
|
# newest first). Default value: `DESC`
|
95
104
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
96
105
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
97
106
|
# results for your original query. See [Paginating
|
98
|
-
# results](
|
107
|
+
# results](https://developer.squareup.com/docs/working-with-apis/pagination)
|
108
|
+
# for more information.
|
99
109
|
# @return [ListTransactionsResponse Hash] response from the API call
|
100
110
|
def list_transactions(location_id:,
|
101
111
|
begin_time: nil,
|
@@ -156,9 +166,9 @@ module Square
|
|
156
166
|
# When this response is returned, the amount of Square's processing fee
|
157
167
|
# might not yet be
|
158
168
|
# calculated. To obtain the processing fee, wait about ten seconds and call
|
159
|
-
# [RetrieveTransaction](
|
169
|
+
# [RetrieveTransaction]($e/Transactions/RetrieveTransaction). See the
|
160
170
|
# `processing_fee_money`
|
161
|
-
# field of each [Tender included](
|
171
|
+
# field of each [Tender included]($m/Tender) in the transaction.
|
162
172
|
# @param [String] location_id Required parameter: The ID of the location to
|
163
173
|
# associate the created transaction with.
|
164
174
|
# @param [ChargeRequest] body Required parameter: An object containing the
|
@@ -241,7 +251,7 @@ module Square
|
|
241
251
|
end
|
242
252
|
|
243
253
|
# Captures a transaction that was created with the
|
244
|
-
# [Charge](
|
254
|
+
# [Charge]($e/Transactions/Charge)
|
245
255
|
# endpoint with a `delay_capture` value of `true`.
|
246
256
|
# See [Delayed capture
|
247
257
|
# transactions](https://developer.squareup.com/docs/payments/transactions/ov
|
@@ -337,7 +347,8 @@ module Square
|
|
337
347
|
)
|
338
348
|
end
|
339
349
|
|
340
|
-
# Cancels a transaction that was created with the
|
350
|
+
# Cancels a transaction that was created with the
|
351
|
+
# [Charge]($e/Transactions/Charge)
|
341
352
|
# endpoint with a `delay_capture` value of `true`.
|
342
353
|
# See [Delayed capture
|
343
354
|
# transactions](https://developer.squareup.com/docs/payments/transactions/ov
|
@@ -247,7 +247,8 @@ module Square
|
|
247
247
|
# employee with that role. For example, an employee with a "Shift Manager"
|
248
248
|
# role might be able to issue refunds in Square Point of Sale, whereas an
|
249
249
|
# employee with a "Clerk" role might not.
|
250
|
-
# Roles are assigned with the
|
250
|
+
# Roles are assigned with the
|
251
|
+
# [V1UpdateEmployee]($e/V1Employees/UpdateEmployeeRole)
|
251
252
|
# endpoint. An employee can have only one role at a time.
|
252
253
|
# If an employee has no role, they have none of the permissions associated
|
253
254
|
# with roles. All employees can accept payments with Square Point of Sale.
|
@@ -20,6 +20,7 @@ module Square
|
|
20
20
|
order: nil,
|
21
21
|
limit: nil,
|
22
22
|
batch_token: nil)
|
23
|
+
warn 'Endpoint list_orders in V1TransactionsApi is deprecated'
|
23
24
|
# Prepare query url.
|
24
25
|
_query_builder = config.get_base_uri
|
25
26
|
_query_builder << '/v1/{location_id}/orders'
|
@@ -66,6 +67,7 @@ module Square
|
|
66
67
|
# @return [V1Order Hash] response from the API call
|
67
68
|
def retrieve_order(location_id:,
|
68
69
|
order_id:)
|
70
|
+
warn 'Endpoint retrieve_order in V1TransactionsApi is deprecated'
|
69
71
|
# Prepare query url.
|
70
72
|
_query_builder = config.get_base_uri
|
71
73
|
_query_builder << '/v1/{location_id}/orders/{order_id}'
|
@@ -111,6 +113,7 @@ module Square
|
|
111
113
|
def update_order(location_id:,
|
112
114
|
order_id:,
|
113
115
|
body:)
|
116
|
+
warn 'Endpoint update_order in V1TransactionsApi is deprecated'
|
114
117
|
# Prepare query url.
|
115
118
|
_query_builder = config.get_base_uri
|
116
119
|
_query_builder << '/v1/{location_id}/orders/{order_id}'
|
@@ -184,6 +187,7 @@ module Square
|
|
184
187
|
limit: nil,
|
185
188
|
batch_token: nil,
|
186
189
|
include_partial: false)
|
190
|
+
warn 'Endpoint list_payments in V1TransactionsApi is deprecated'
|
187
191
|
# Prepare query url.
|
188
192
|
_query_builder = config.get_base_uri
|
189
193
|
_query_builder << '/v1/{location_id}/payments'
|
@@ -233,6 +237,7 @@ module Square
|
|
233
237
|
# @return [V1Payment Hash] response from the API call
|
234
238
|
def retrieve_payment(location_id:,
|
235
239
|
payment_id:)
|
240
|
+
warn 'Endpoint retrieve_payment in V1TransactionsApi is deprecated'
|
236
241
|
# Prepare query url.
|
237
242
|
_query_builder = config.get_base_uri
|
238
243
|
_query_builder << '/v1/{location_id}/payments/{payment_id}'
|
@@ -294,6 +299,7 @@ module Square
|
|
294
299
|
end_time: nil,
|
295
300
|
limit: nil,
|
296
301
|
batch_token: nil)
|
302
|
+
warn 'Endpoint list_refunds in V1TransactionsApi is deprecated'
|
297
303
|
# Prepare query url.
|
298
304
|
_query_builder = config.get_base_uri
|
299
305
|
_query_builder << '/v1/{location_id}/refunds'
|
@@ -350,6 +356,7 @@ module Square
|
|
350
356
|
# @return [V1Refund Hash] response from the API call
|
351
357
|
def create_refund(location_id:,
|
352
358
|
body:)
|
359
|
+
warn 'Endpoint create_refund in V1TransactionsApi is deprecated'
|
353
360
|
# Prepare query url.
|
354
361
|
_query_builder = config.get_base_uri
|
355
362
|
_query_builder << '/v1/{location_id}/refunds'
|
@@ -417,6 +424,7 @@ module Square
|
|
417
424
|
limit: nil,
|
418
425
|
status: nil,
|
419
426
|
batch_token: nil)
|
427
|
+
warn 'Endpoint list_settlements in V1TransactionsApi is deprecated'
|
420
428
|
# Prepare query url.
|
421
429
|
_query_builder = config.get_base_uri
|
422
430
|
_query_builder << '/v1/{location_id}/settlements'
|
@@ -479,6 +487,7 @@ module Square
|
|
479
487
|
# @return [V1Settlement Hash] response from the API call
|
480
488
|
def retrieve_settlement(location_id:,
|
481
489
|
settlement_id:)
|
490
|
+
warn 'Endpoint retrieve_settlement in V1TransactionsApi is deprecated'
|
482
491
|
# Prepare query url.
|
483
492
|
_query_builder = config.get_base_uri
|
484
493
|
_query_builder << '/v1/{location_id}/settlements/{settlement_id}'
|
data/lib/square/api_helper.rb
CHANGED
@@ -63,9 +63,7 @@ module Square
|
|
63
63
|
# Appends the given set of parameters to the given query string.
|
64
64
|
# @param [String] The query string builder to add the query parameters to.
|
65
65
|
# @param [Hash] The parameters to append.
|
66
|
-
|
67
|
-
def self.append_url_with_query_parameters(query_builder, parameters,
|
68
|
-
array_serialization: 'indexed')
|
66
|
+
def self.append_url_with_query_parameters(query_builder, parameters)
|
69
67
|
# Perform parameter validation.
|
70
68
|
unless query_builder.instance_of? String
|
71
69
|
raise ArgumentError, 'Given value for parameter \"query_builder\"
|
@@ -75,6 +73,8 @@ module Square
|
|
75
73
|
# Return if there are no parameters to replace.
|
76
74
|
return query_builder if parameters.nil?
|
77
75
|
|
76
|
+
array_serialization = 'indexed'
|
77
|
+
|
78
78
|
parameters.each do |key, value|
|
79
79
|
seperator = query_builder.include?('?') ? '&' : '?'
|
80
80
|
unless value.nil?
|
@@ -151,8 +151,8 @@ module Square
|
|
151
151
|
# Form encodes a hash of parameters.
|
152
152
|
# @param [Hash] The hash of parameters to encode.
|
153
153
|
# @return [Hash] A hash with the same parameters form encoded.
|
154
|
-
def self.form_encode_parameters(form_parameters
|
155
|
-
|
154
|
+
def self.form_encode_parameters(form_parameters)
|
155
|
+
array_serialization = 'indexed'
|
156
156
|
encoded = {}
|
157
157
|
form_parameters.each do |key, value|
|
158
158
|
encoded.merge!(APIHelper.form_encode(value, key, formatting:
|
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
|
+
'11.0.0.20210513'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -167,6 +167,18 @@ module Square
|
|
167
167
|
@refunds ||= RefundsApi.new config
|
168
168
|
end
|
169
169
|
|
170
|
+
# Access to sites controller.
|
171
|
+
# @return [SitesApi] Returns the controller instance.
|
172
|
+
def sites
|
173
|
+
@sites ||= SitesApi.new config
|
174
|
+
end
|
175
|
+
|
176
|
+
# Access to snippets controller.
|
177
|
+
# @return [SnippetsApi] Returns the controller instance.
|
178
|
+
def snippets
|
179
|
+
@snippets ||= SnippetsApi.new config
|
180
|
+
end
|
181
|
+
|
170
182
|
# Access to subscriptions controller.
|
171
183
|
# @return [SubscriptionsApi] Returns the controller instance.
|
172
184
|
def subscriptions
|
@@ -188,7 +200,7 @@ module Square
|
|
188
200
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
189
201
|
backoff_factor: 1, environment: 'production',
|
190
202
|
custom_url: 'https://connect.squareup.com',
|
191
|
-
square_version: '2021-
|
203
|
+
square_version: '2021-05-13', access_token: 'TODO: Replace',
|
192
204
|
additional_headers: {}, config: nil)
|
193
205
|
@config = if config.nil?
|
194
206
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
data/lib/square/configuration.rb
CHANGED
@@ -24,7 +24,7 @@ module Square
|
|
24
24
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
25
25
|
backoff_factor: 1, environment: 'production',
|
26
26
|
custom_url: 'https://connect.squareup.com',
|
27
|
-
square_version: '2021-
|
27
|
+
square_version: '2021-05-13', access_token: 'TODO: Replace',
|
28
28
|
additional_headers: {})
|
29
29
|
# The value to use for connection timeout
|
30
30
|
@timeout = timeout
|
@@ -10,7 +10,7 @@ class LocationsApiTests < ApiTestBase
|
|
10
10
|
# Provides information of all locations of a business.
|
11
11
|
#
|
12
12
|
#Many Square API endpoints require a `location_id` parameter.
|
13
|
-
#The `id` field of the [`Location`](
|
13
|
+
#The `id` field of the [`Location`]($m/Location) objects returned by this
|
14
14
|
#endpoint correspond to that `location_id` parameter.
|
15
15
|
def test_list_locations()
|
16
16
|
|
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: 11.0.0.20210513
|
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: 2021-
|
11
|
+
date: 2021-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -160,6 +160,8 @@ files:
|
|
160
160
|
- lib/square/api/orders_api.rb
|
161
161
|
- lib/square/api/payments_api.rb
|
162
162
|
- lib/square/api/refunds_api.rb
|
163
|
+
- lib/square/api/sites_api.rb
|
164
|
+
- lib/square/api/snippets_api.rb
|
163
165
|
- lib/square/api/subscriptions_api.rb
|
164
166
|
- lib/square/api/team_api.rb
|
165
167
|
- lib/square/api/terminal_api.rb
|