square.rb 17.0.0.20211215 → 17.1.0.20220120

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28048e0ca738b0ca2de7579b8dc077c0307266afa1ff42c1ee6808eb64c79f43
4
- data.tar.gz: 7ba3afdb67a42eb41864d5fe5839b8b74f525eebac2b6348e51aee92c9399328
3
+ metadata.gz: 407147246777f8a4eda2d4848cad5edb62be5801c25b6361f0dfb21d58663fd9
4
+ data.tar.gz: 735c7e92297b1d4a79ebd856dbe39cc304051536622f0277ddd9489811652cb6
5
5
  SHA512:
6
- metadata.gz: 2bf8bcf75bf6558596e20c1f9d3c82d579aa20f4964047c94bc43592b2e1b0f28445d1f788ba30e1272095380a07a5350fc4c2f8082097b12ef29eb424b33bfd
7
- data.tar.gz: 4b09ca82e2b15e60b7ae1a7c217bf445cfb8dd0f6ceb60d6e835d08a5ef08657054d15cc58124d85a1be2f30a8d67630a55caaf58c0942cb92de81ec426cfe6d
6
+ metadata.gz: 90ccb1516f8ff8998787d63a168c8c8688b9a12691d85cac3a2b6af35ce52af93bbc013e11336d5319cc252ec75ce7f790165ea5c38c69367f092e5ef62b365d
7
+ data.tar.gz: 05a3eb69caf678ad7f071b66a27c3ed4375ac96470ba09e51df9db6eba1401b80bd461c7fd6cb7bde91f30bb7ee5d11b9f7f293a59d40c70ab5ed52b25b9d180
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2021 Square, Inc.
1
+ Copyright 2022 Square, Inc.
2
2
  Licensed under the Apache License, Version 2.0 (the "License");
3
3
  you may not use this file except in compliance with the License.
4
4
  You may obtain a copy of the License at
@@ -38,7 +38,16 @@ module Square
38
38
  end
39
39
 
40
40
  def get_user_agent
41
- user_agent = 'Square-Ruby-SDK/17.0.0.20211215'
41
+ user_agent = 'Square-Ruby-SDK/17.1.0.20220120 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
42
+ user_agent['{engine}'] = RUBY_ENGINE
43
+ user_agent['{engine-version}'] = RUBY_ENGINE_VERSION
44
+ user_agent['{os-info}'] = RUBY_PLATFORM
45
+ user_agent['{api-version}'] = config.square_version
46
+ if config.user_agent_detail.nil? || config.user_agent_detail.empty?
47
+ user_agent = user_agent.gsub('{detail}', '')
48
+ else
49
+ user_agent['{detail}'] = ERB::Util.url_encode(config.user_agent_detail.to_s)
50
+ end
42
51
  user_agent
43
52
  end
44
53
  end
@@ -6,6 +6,10 @@ module Square
6
6
  end
7
7
 
8
8
  # Retrieve a collection of bookings.
9
+ # To call this endpoint with buyer-level permissions, set
10
+ # `APPOINTMENTS_READ` for the OAuth scope.
11
+ # To call this endpoint with seller-level permissions, set
12
+ # `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
9
13
  # @param [Integer] limit Optional parameter: The maximum number of results
10
14
  # per page to return in a paged response.
11
15
  # @param [String] cursor Optional parameter: The pagination cursor from the
@@ -66,6 +70,10 @@ module Square
66
70
  end
67
71
 
68
72
  # Creates a booking.
73
+ # To call this endpoint with buyer-level permissions, set
74
+ # `APPOINTMENTS_WRITE` for the OAuth scope.
75
+ # To call this endpoint with seller-level permissions, set
76
+ # `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
69
77
  # @param [CreateBookingRequest] body Required parameter: An object
70
78
  # containing the fields to POST for the request. See the corresponding
71
79
  # object definition for field details.
@@ -100,6 +108,10 @@ module Square
100
108
  end
101
109
 
102
110
  # Searches for availabilities for booking.
111
+ # To call this endpoint with buyer-level permissions, set
112
+ # `APPOINTMENTS_READ` for the OAuth scope.
113
+ # To call this endpoint with seller-level permissions, set
114
+ # `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
103
115
  # @param [SearchAvailabilityRequest] body Required parameter: An object
104
116
  # containing the fields to POST for the request. See the corresponding
105
117
  # object definition for field details.
@@ -167,9 +179,10 @@ module Square
167
179
  # include only bookable team members in the returned result (`true`) or not
168
180
  # (`false`).
169
181
  # @param [Integer] limit Optional parameter: The maximum number of results
170
- # to return.
171
- # @param [String] cursor Optional parameter: The cursor for paginating
172
- # through the results.
182
+ # to return in a paged response.
183
+ # @param [String] cursor Optional parameter: The pagination cursor from the
184
+ # preceding response to return the next page of the results. Do not set this
185
+ # when retrieving the first page of the results.
173
186
  # @param [String] location_id Optional parameter: Indicates whether to
174
187
  # include only team members enabled at the given location in the returned
175
188
  # result.
@@ -247,6 +260,10 @@ module Square
247
260
  end
248
261
 
249
262
  # Retrieves a booking.
263
+ # To call this endpoint with buyer-level permissions, set
264
+ # `APPOINTMENTS_READ` for the OAuth scope.
265
+ # To call this endpoint with seller-level permissions, set
266
+ # `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
250
267
  # @param [String] booking_id Required parameter: The ID of the
251
268
  # [Booking]($m/Booking) object representing the to-be-retrieved booking.
252
269
  # @return [RetrieveBookingResponse Hash] response from the API call
@@ -282,6 +299,10 @@ module Square
282
299
  end
283
300
 
284
301
  # Updates a booking.
302
+ # To call this endpoint with buyer-level permissions, set
303
+ # `APPOINTMENTS_WRITE` for the OAuth scope.
304
+ # To call this endpoint with seller-level permissions, set
305
+ # `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
285
306
  # @param [String] booking_id Required parameter: The ID of the
286
307
  # [Booking]($m/Booking) object representing the to-be-updated booking.
287
308
  # @param [UpdateBookingRequest] body Required parameter: An object
@@ -323,6 +344,10 @@ module Square
323
344
  end
324
345
 
325
346
  # Cancels an existing booking.
347
+ # To call this endpoint with buyer-level permissions, set
348
+ # `APPOINTMENTS_WRITE` for the OAuth scope.
349
+ # To call this endpoint with seller-level permissions, set
350
+ # `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
326
351
  # @param [String] booking_id Required parameter: The ID of the
327
352
  # [Booking]($m/Booking) object representing the to-be-cancelled booking.
328
353
  # @param [CancelBookingRequest] body Required parameter: An object
@@ -5,7 +5,8 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Provides details about all of the seller's locations,
8
+ # Provides details about all of the seller's
9
+ # [locations](https://developer.squareup.com/docs/locations-api),
9
10
  # including those with an inactive status.
10
11
  # @return [ListLocationsResponse Hash] response from the API call
11
12
  def list_locations
@@ -117,7 +118,7 @@ module Square
117
118
  )
118
119
  end
119
120
 
120
- # Updates a location.
121
+ # Updates a [location](https://developer.squareup.com/docs/locations-api).
121
122
  # @param [String] location_id Required parameter: The ID of the location to
122
123
  # update.
123
124
  # @param [UpdateLocationRequest] body Required parameter: An object
@@ -124,12 +124,6 @@ module Square
124
124
  # [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) to compute the
125
125
  # points
126
126
  # that you provide to this endpoint.
127
- # __Note:__ The country of the seller's Square account determines whether
128
- # tax is included in the purchase amount when accruing points for
129
- # spend-based and visit-based programs.
130
- # For more information, see [Availability of Square
131
- # Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyalty-
132
- # market-availability).
133
127
  # @param [String] account_id Required parameter: The [loyalty
134
128
  # account]($m/LoyaltyAccount) ID to which to add the points.
135
129
  # @param [AccumulateLoyaltyPointsRequest] body Required parameter: An object
@@ -336,8 +330,8 @@ module Square
336
330
  end
337
331
 
338
332
  # Calculates the points a purchase earns.
339
- # - If you are using the Orders API to manage orders, you provide `order_id`
340
- # in the request. The
333
+ # - If you are using the Orders API to manage orders, you provide the
334
+ # `order_id` in the request. The
341
335
  # endpoint calculates the points by reading the order.
342
336
  # - If you are not using the Orders API to manage orders, you provide the
343
337
  # purchase amount in
@@ -345,12 +339,9 @@ module Square
345
339
  # An application might call this endpoint to show the points that a buyer
346
340
  # can earn with the
347
341
  # specific purchase.
348
- # __Note:__ The country of the seller's Square account determines whether
349
- # tax is included in the purchase amount when accruing points for
350
- # spend-based and visit-based programs.
351
- # For more information, see [Availability of Square
352
- # Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyalty-
353
- # market-availability).
342
+ # For spend-based and visit-based programs, the `tax_mode` setting of the
343
+ # accrual rule indicates how taxes should be treated for loyalty points
344
+ # accrual.
354
345
  # @param [String] program_id Required parameter: The [loyalty
355
346
  # program]($m/LoyaltyProgram) ID, which defines the rules for accruing
356
347
  # points.
@@ -31,10 +31,13 @@ module Square
31
31
  # the given status are returned. For a list of refund status values, see
32
32
  # [PaymentRefund]($m/PaymentRefund). Default: If omitted, refunds are
33
33
  # returned regardless of their status.
34
- # @param [String] source_type Optional parameter: If provided, only refunds
35
- # with the given source type are returned. - `CARD` - List refunds only for
36
- # payments where `CARD` was specified as the payment source. Default: If
37
- # omitted, refunds are returned regardless of the source type.
34
+ # @param [String] source_type Optional parameter: If provided, only returns
35
+ # refunds whose payments have the indicated source type. Current values
36
+ # include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`. For
37
+ # information about these payment source types, see [Take
38
+ # Payments](https://developer.squareup.com/docs/payments-api/take-payments).
39
+ # Default: If omitted, refunds are returned regardless of the source
40
+ # type.
38
41
  # @param [Integer] limit Optional parameter: The maximum number of results
39
42
  # to be returned in a single page. It is possible to receive fewer results
40
43
  # than the specified limit on a given page. If the supplied value is
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
- '17.0.0.20211215'
7
+ '17.1.0.20220120'
8
8
  end
9
9
 
10
10
  def square_version
@@ -218,7 +218,7 @@ module Square
218
218
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
219
219
  retry_methods: %i[get put], environment: 'production',
220
220
  custom_url: 'https://connect.squareup.com',
221
- square_version: '2021-12-15', access_token: '',
221
+ square_version: '2022-01-20', access_token: '',
222
222
  user_agent_detail: '', additional_headers: {}, config: nil)
223
223
  @config = if config.nil?
224
224
  Configuration.new(http_client_instance: http_client_instance,
@@ -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: '2021-12-15', access_token: '',
23
+ square_version: '2022-01-20', access_token: '',
24
24
  user_agent_detail: '', additional_headers: {})
25
25
  # The Http Client passed from the sdk user for making requests
26
26
  @http_client_instance = http_client_instance
@@ -61,6 +61,9 @@ module Square
61
61
 
62
62
  # The Http Client to use for making requests.
63
63
  @http_client = create_http_client
64
+
65
+ # User agent detail, to be appended with user-agent header.
66
+ @user_agent_detail = get_user_agent(user_agent_detail)
64
67
  end
65
68
 
66
69
  def clone_with(http_client_instance: nil, timeout: nil, max_retries: nil,
@@ -103,6 +106,12 @@ module Square
103
106
  http_client_instance: http_client_instance)
104
107
  end
105
108
 
109
+ def get_user_agent(user_agent_detail)
110
+ raise ArgumentError, 'The length of user-agent detail should not exceed 128 characters.' unless user_agent_detail.length < 128
111
+
112
+ user_agent_detail
113
+ end
114
+
106
115
  # All the environments the SDK can run in.
107
116
  ENVIRONMENTS = {
108
117
  'production' => {
@@ -7,7 +7,7 @@ class LocationsApiTests < ApiTestBase
7
7
  @controller = LocationsApi.new CONFIG, http_call_back: @response_catcher
8
8
  end
9
9
 
10
- # Provides details about all of the seller's locations,
10
+ # Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
11
11
  #including those with an inactive status.
12
12
  def test_list_locations()
13
13
 
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: 17.0.0.20211215
4
+ version: 17.1.0.20220120
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-12-15 00:00:00.000000000 Z
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging