square.rb 6.4.0.20200923 → 9.0.0.20210226

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +43 -31
  4. data/lib/square.rb +60 -61
  5. data/lib/square/api/apple_pay_api.rb +5 -3
  6. data/lib/square/api/bank_accounts_api.rb +16 -19
  7. data/lib/square/api/base_api.rb +1 -1
  8. data/lib/square/api/bookings_api.rb +308 -0
  9. data/lib/square/api/cash_drawers_api.rb +13 -6
  10. data/lib/square/api/catalog_api.rb +71 -35
  11. data/lib/square/api/checkout_api.rb +4 -2
  12. data/lib/square/api/customer_groups_api.rb +18 -8
  13. data/lib/square/api/customer_segments_api.rb +9 -5
  14. data/lib/square/api/customers_api.rb +47 -27
  15. data/lib/square/api/devices_api.rb +17 -6
  16. data/lib/square/api/disputes_api.rb +70 -54
  17. data/lib/square/api/employees_api.rb +7 -3
  18. data/lib/square/api/inventory_api.rb +27 -13
  19. data/lib/square/api/invoices_api.rb +44 -25
  20. data/lib/square/api/labor_api.rb +57 -25
  21. data/lib/square/api/locations_api.rb +16 -13
  22. data/lib/square/api/loyalty_api.rb +60 -66
  23. data/lib/square/api/merchants_api.rb +7 -3
  24. data/lib/square/api/mobile_authorization_api.rb +5 -3
  25. data/lib/square/api/o_auth_api.rb +11 -8
  26. data/lib/square/api/orders_api.rb +55 -8
  27. data/lib/square/api/payments_api.rb +68 -55
  28. data/lib/square/api/refunds_api.rb +32 -26
  29. data/lib/square/api/subscriptions_api.rb +26 -14
  30. data/lib/square/api/team_api.rb +46 -30
  31. data/lib/square/api/terminal_api.rb +156 -7
  32. data/lib/square/api/transactions_api.rb +32 -18
  33. data/lib/square/api/v1_employees_api.rb +27 -389
  34. data/lib/square/api/v1_transactions_api.rb +42 -101
  35. data/lib/square/api_helper.rb +14 -9
  36. data/lib/square/client.rb +10 -14
  37. data/lib/square/configuration.rb +21 -6
  38. data/lib/square/http/api_response.rb +2 -0
  39. data/lib/square/http/faraday_client.rb +9 -2
  40. data/spec/user_journey_spec.rb +2 -5
  41. data/test/api/test_locations_api.rb +1 -1
  42. metadata +5 -6
  43. data/lib/square/api/v1_items_api.rb +0 -1686
  44. data/lib/square/api/v1_locations_api.rb +0 -65
@@ -44,7 +44,7 @@ module Square
44
44
  _query_builder << '/oauth2/clients/{client_id}/access-token/renew'
45
45
  _query_builder = APIHelper.append_url_with_template_parameters(
46
46
  _query_builder,
47
- 'client_id' => client_id
47
+ 'client_id' => { 'value' => client_id, 'encode' => true }
48
48
  )
49
49
  _query_url = APIHelper.clean_url _query_builder
50
50
 
@@ -66,7 +66,9 @@ module Square
66
66
  # Return appropriate response type.
67
67
  decoded = APIHelper.json_deserialize(_response.raw_body)
68
68
  _errors = APIHelper.map_response(decoded, ['errors'])
69
- ApiResponse.new(_response, data: decoded, errors: _errors)
69
+ ApiResponse.new(
70
+ _response, data: decoded, errors: _errors
71
+ )
70
72
  end
71
73
 
72
74
  # Revokes an access token generated with the OAuth flow.
@@ -83,7 +85,7 @@ module Square
83
85
  # ```
84
86
  # Replace `APPLICATION_SECRET` with the application secret on the
85
87
  # Credentials
86
- # page in the [application dashboard](https://connect.squareup.com/apps).
88
+ # page in the [Developer Dashboard](https://developer.squareup.com/apps).
87
89
  # @param [RevokeTokenRequest] body Required parameter: An object containing
88
90
  # the fields to POST for the request. See the corresponding object
89
91
  # definition for field details.
@@ -115,16 +117,15 @@ module Square
115
117
  # Return appropriate response type.
116
118
  decoded = APIHelper.json_deserialize(_response.raw_body)
117
119
  _errors = APIHelper.map_response(decoded, ['errors'])
118
- ApiResponse.new(_response, data: decoded, errors: _errors)
120
+ ApiResponse.new(
121
+ _response, data: decoded, errors: _errors
122
+ )
119
123
  end
120
124
 
121
125
  # Returns an OAuth access token.
122
126
  # The endpoint supports distinct methods of obtaining OAuth access tokens.
123
127
  # Applications specify a method by adding the `grant_type` parameter
124
128
  # in the request and also provide relevant information.
125
- # For more information, see [OAuth access token
126
- # management](https://developer.squareup.com/docs/authz/oauth/how-it-works#o
127
- # auth-access-token-management).
128
129
  # __Note:__ Regardless of the method application specified,
129
130
  # the endpoint always returns two items; an OAuth access token and
130
131
  # a refresh token in the response.
@@ -157,7 +158,9 @@ module Square
157
158
  # Return appropriate response type.
158
159
  decoded = APIHelper.json_deserialize(_response.raw_body)
159
160
  _errors = APIHelper.map_response(decoded, ['errors'])
160
- ApiResponse.new(_response, data: decoded, errors: _errors)
161
+ ApiResponse.new(
162
+ _response, data: decoded, errors: _errors
163
+ )
161
164
  end
162
165
  end
163
166
  end
@@ -41,7 +41,9 @@ module Square
41
41
  # Return appropriate response type.
42
42
  decoded = APIHelper.json_deserialize(_response.raw_body)
43
43
  _errors = APIHelper.map_response(decoded, ['errors'])
44
- ApiResponse.new(_response, data: decoded, errors: _errors)
44
+ ApiResponse.new(
45
+ _response, data: decoded, errors: _errors
46
+ )
45
47
  end
46
48
 
47
49
  # Retrieves a set of [Order](#type-order)s by their IDs.
@@ -75,7 +77,9 @@ module Square
75
77
  # Return appropriate response type.
76
78
  decoded = APIHelper.json_deserialize(_response.raw_body)
77
79
  _errors = APIHelper.map_response(decoded, ['errors'])
78
- ApiResponse.new(_response, data: decoded, errors: _errors)
80
+ ApiResponse.new(
81
+ _response, data: decoded, errors: _errors
82
+ )
79
83
  end
80
84
 
81
85
  # Calculates an [Order](#type-order).
@@ -107,7 +111,9 @@ module Square
107
111
  # Return appropriate response type.
108
112
  decoded = APIHelper.json_deserialize(_response.raw_body)
109
113
  _errors = APIHelper.map_response(decoded, ['errors'])
110
- ApiResponse.new(_response, data: decoded, errors: _errors)
114
+ ApiResponse.new(
115
+ _response, data: decoded, errors: _errors
116
+ )
111
117
  end
112
118
 
113
119
  # Search all orders for one or more locations. Orders include all sales,
@@ -154,7 +160,44 @@ module Square
154
160
  # Return appropriate response type.
155
161
  decoded = APIHelper.json_deserialize(_response.raw_body)
156
162
  _errors = APIHelper.map_response(decoded, ['errors'])
157
- ApiResponse.new(_response, data: decoded, errors: _errors)
163
+ ApiResponse.new(
164
+ _response, data: decoded, errors: _errors
165
+ )
166
+ end
167
+
168
+ # Retrieves an [Order](#type-order) by ID.
169
+ # @param [String] order_id Required parameter: The ID of the order to
170
+ # retrieve.
171
+ # @return [RetrieveOrderResponse Hash] response from the API call
172
+ def retrieve_order(order_id:)
173
+ # Prepare query url.
174
+ _query_builder = config.get_base_uri
175
+ _query_builder << '/v2/orders/{order_id}'
176
+ _query_builder = APIHelper.append_url_with_template_parameters(
177
+ _query_builder,
178
+ 'order_id' => { 'value' => order_id, 'encode' => true }
179
+ )
180
+ _query_url = APIHelper.clean_url _query_builder
181
+
182
+ # Prepare headers.
183
+ _headers = {
184
+ 'accept' => 'application/json'
185
+ }
186
+
187
+ # Prepare and execute HttpRequest.
188
+ _request = config.http_client.get(
189
+ _query_url,
190
+ headers: _headers
191
+ )
192
+ OAuth2.apply(config, _request)
193
+ _response = execute_request(_request)
194
+
195
+ # Return appropriate response type.
196
+ decoded = APIHelper.json_deserialize(_response.raw_body)
197
+ _errors = APIHelper.map_response(decoded, ['errors'])
198
+ ApiResponse.new(
199
+ _response, data: decoded, errors: _errors
200
+ )
158
201
  end
159
202
 
160
203
  # Updates an open [Order](#type-order) by adding, replacing, or deleting
@@ -187,7 +230,7 @@ module Square
187
230
  _query_builder << '/v2/orders/{order_id}'
188
231
  _query_builder = APIHelper.append_url_with_template_parameters(
189
232
  _query_builder,
190
- 'order_id' => order_id
233
+ 'order_id' => { 'value' => order_id, 'encode' => true }
191
234
  )
192
235
  _query_url = APIHelper.clean_url _query_builder
193
236
 
@@ -209,7 +252,9 @@ module Square
209
252
  # Return appropriate response type.
210
253
  decoded = APIHelper.json_deserialize(_response.raw_body)
211
254
  _errors = APIHelper.map_response(decoded, ['errors'])
212
- ApiResponse.new(_response, data: decoded, errors: _errors)
255
+ ApiResponse.new(
256
+ _response, data: decoded, errors: _errors
257
+ )
213
258
  end
214
259
 
215
260
  # Pay for an [order](#type-order) using one or more approved
@@ -244,7 +289,7 @@ module Square
244
289
  _query_builder << '/v2/orders/{order_id}/pay'
245
290
  _query_builder = APIHelper.append_url_with_template_parameters(
246
291
  _query_builder,
247
- 'order_id' => order_id
292
+ 'order_id' => { 'value' => order_id, 'encode' => true }
248
293
  )
249
294
  _query_url = APIHelper.clean_url _query_builder
250
295
 
@@ -266,7 +311,9 @@ module Square
266
311
  # Return appropriate response type.
267
312
  decoded = APIHelper.json_deserialize(_response.raw_body)
268
313
  _errors = APIHelper.map_response(decoded, ['errors'])
269
- ApiResponse.new(_response, data: decoded, errors: _errors)
314
+ ApiResponse.new(
315
+ _response, data: decoded, errors: _errors
316
+ )
270
317
  end
271
318
  end
272
319
  end
@@ -6,34 +6,35 @@ module Square
6
6
  end
7
7
 
8
8
  # Retrieves a list of payments taken by the account making the request.
9
- # Max results per page: 100
10
- # @param [String] begin_time Optional parameter: Timestamp for the beginning
11
- # of the reporting period, in RFC 3339 format. Inclusive. Default: The
12
- # current time minus one year.
13
- # @param [String] end_time Optional parameter: Timestamp for the end of the
14
- # requested reporting period, in RFC 3339 format. Default: The current
15
- # time.
9
+ # The maximum results per page is 100.
10
+ # @param [String] begin_time Optional parameter: The timestamp for the
11
+ # beginning of the reporting period, in RFC 3339 format. Inclusive. Default:
12
+ # The current time minus one year.
13
+ # @param [String] end_time Optional parameter: The timestamp for the end of
14
+ # the reporting period, in RFC 3339 format. Default: The current time.
16
15
  # @param [String] sort_order Optional parameter: The order in which results
17
- # are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest
16
+ # are listed: - `ASC` - Oldest to newest. - `DESC` - Newest to oldest
18
17
  # (default).
19
18
  # @param [String] cursor Optional parameter: A pagination cursor returned by
20
- # a previous call to this endpoint. Provide this to retrieve the next set of
21
- # results for the original query. See
19
+ # a previous call to this endpoint. Provide this cursor to retrieve the next
20
+ # set of results for the original query. For more information, see
22
21
  # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
23
- # for more information.
22
+ # .
24
23
  # @param [String] location_id Optional parameter: Limit results to the
25
24
  # location supplied. By default, results are returned for the default (main)
26
- # location associated with the merchant.
25
+ # location associated with the seller.
27
26
  # @param [Long] total Optional parameter: The exact amount in the
28
- # total_money for a `Payment`.
29
- # @param [String] last_4 Optional parameter: The last 4 digits of `Payment`
30
- # card.
31
- # @param [String] card_brand Optional parameter: The brand of `Payment`
32
- # card. For example, `VISA`
33
- # @param [Integer] limit Optional parameter: Maximum number of results to be
34
- # returned in a single page. It is possible to receive fewer results than
35
- # the specified limit on a given page. If the supplied value is greater
36
- # than 100, at most 100 results will be returned. Default: `100`
27
+ # `total_money` for a payment.
28
+ # @param [String] last_4 Optional parameter: The last four digits of a
29
+ # payment card.
30
+ # @param [String] card_brand Optional parameter: The brand of the payment
31
+ # card (for example, VISA).
32
+ # @param [Integer] limit Optional parameter: The maximum number of results
33
+ # to be returned in a single page. It is possible to receive fewer results
34
+ # than the specified limit on a given page. The default value of 100 is
35
+ # also the maximum allowed value. If the provided value is greater than
36
+ # 100, it is ignored and the default value is used instead. Default:
37
+ # `100`
37
38
  # @return [ListPaymentsResponse Hash] response from the API call
38
39
  def list_payments(begin_time: nil,
39
40
  end_time: nil,
@@ -77,17 +78,19 @@ module Square
77
78
  # Return appropriate response type.
78
79
  decoded = APIHelper.json_deserialize(_response.raw_body)
79
80
  _errors = APIHelper.map_response(decoded, ['errors'])
80
- ApiResponse.new(_response, data: decoded, errors: _errors)
81
+ ApiResponse.new(
82
+ _response, data: decoded, errors: _errors
83
+ )
81
84
  end
82
85
 
83
- # Charges a payment source, for example, a card
84
- # represented by customer's card on file or a card nonce. In addition
85
- # to the payment source, the request must also include the
86
+ # Charges a payment source (for example, a card
87
+ # represented by customer's card on file or a card nonce). In addition
88
+ # to the payment source, the request must include the
86
89
  # amount to accept for the payment.
87
- # There are several optional parameters that you can include in the request.
88
- # For example, tip money, whether to autocomplete the payment, or a
90
+ # There are several optional parameters that you can include in the request
91
+ # (for example, tip money, whether to autocomplete the payment, or a
89
92
  # reference ID
90
- # to correlate this payment with another system.
93
+ # to correlate this payment with another system).
91
94
  # The `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required
92
95
  # to enable application fees.
93
96
  # @param [CreatePaymentRequest] body Required parameter: An object
@@ -118,24 +121,26 @@ module Square
118
121
  # Return appropriate response type.
119
122
  decoded = APIHelper.json_deserialize(_response.raw_body)
120
123
  _errors = APIHelper.map_response(decoded, ['errors'])
121
- ApiResponse.new(_response, data: decoded, errors: _errors)
124
+ ApiResponse.new(
125
+ _response, data: decoded, errors: _errors
126
+ )
122
127
  end
123
128
 
124
129
  # Cancels (voids) a payment identified by the idempotency key that is
125
130
  # specified in the
126
131
  # request.
127
- # Use this method when status of a CreatePayment request is unknown. For
128
- # example, after you send a
129
- # CreatePayment request a network error occurs and you don't get a response.
130
- # In this case, you can
132
+ # Use this method when the status of a `CreatePayment` request is unknown
133
+ # (for example, after you send a
134
+ # `CreatePayment` request, a network error occurs and you do not get a
135
+ # response). In this case, you can
131
136
  # direct Square to cancel the payment using this endpoint. In the request,
132
137
  # you provide the same
133
- # idempotency key that you provided in your CreatePayment request you want
134
- # to cancel. After
135
- # cancelling the payment, you can submit your CreatePayment request again.
138
+ # idempotency key that you provided in your `CreatePayment` request that you
139
+ # want to cancel. After
140
+ # canceling the payment, you can submit your `CreatePayment` request again.
136
141
  # Note that if no payment with the specified idempotency key is found, no
137
- # action is taken, the end
138
- # point returns successfully.
142
+ # action is taken and the endpoint
143
+ # returns successfully.
139
144
  # @param [CancelPaymentByIdempotencyKeyRequest] body Required parameter: An
140
145
  # object containing the fields to POST for the request. See the
141
146
  # corresponding object definition for field details.
@@ -164,12 +169,14 @@ module Square
164
169
  # Return appropriate response type.
165
170
  decoded = APIHelper.json_deserialize(_response.raw_body)
166
171
  _errors = APIHelper.map_response(decoded, ['errors'])
167
- ApiResponse.new(_response, data: decoded, errors: _errors)
172
+ ApiResponse.new(
173
+ _response, data: decoded, errors: _errors
174
+ )
168
175
  end
169
176
 
170
- # Retrieves details for a specific Payment.
171
- # @param [String] payment_id Required parameter: Unique ID for the desired
172
- # `Payment`.
177
+ # Retrieves details for a specific payment.
178
+ # @param [String] payment_id Required parameter: A unique ID for the desired
179
+ # payment.
173
180
  # @return [GetPaymentResponse Hash] response from the API call
174
181
  def get_payment(payment_id:)
175
182
  # Prepare query url.
@@ -177,7 +184,7 @@ module Square
177
184
  _query_builder << '/v2/payments/{payment_id}'
178
185
  _query_builder = APIHelper.append_url_with_template_parameters(
179
186
  _query_builder,
180
- 'payment_id' => payment_id
187
+ 'payment_id' => { 'value' => payment_id, 'encode' => true }
181
188
  )
182
189
  _query_url = APIHelper.clean_url _query_builder
183
190
 
@@ -197,14 +204,16 @@ module Square
197
204
  # Return appropriate response type.
198
205
  decoded = APIHelper.json_deserialize(_response.raw_body)
199
206
  _errors = APIHelper.map_response(decoded, ['errors'])
200
- ApiResponse.new(_response, data: decoded, errors: _errors)
207
+ ApiResponse.new(
208
+ _response, data: decoded, errors: _errors
209
+ )
201
210
  end
202
211
 
203
- # Cancels (voids) a payment. If you set `autocomplete` to false when
212
+ # Cancels (voids) a payment. If you set `autocomplete` to `false` when
204
213
  # creating a payment,
205
214
  # you can cancel the payment using this endpoint.
206
- # @param [String] payment_id Required parameter: `payment_id` identifying
207
- # the payment to be canceled.
215
+ # @param [String] payment_id Required parameter: The `payment_id`
216
+ # identifying the payment to be canceled.
208
217
  # @return [CancelPaymentResponse Hash] response from the API call
209
218
  def cancel_payment(payment_id:)
210
219
  # Prepare query url.
@@ -212,7 +221,7 @@ module Square
212
221
  _query_builder << '/v2/payments/{payment_id}/cancel'
213
222
  _query_builder = APIHelper.append_url_with_template_parameters(
214
223
  _query_builder,
215
- 'payment_id' => payment_id
224
+ 'payment_id' => { 'value' => payment_id, 'encode' => true }
216
225
  )
217
226
  _query_url = APIHelper.clean_url _query_builder
218
227
 
@@ -232,17 +241,19 @@ module Square
232
241
  # Return appropriate response type.
233
242
  decoded = APIHelper.json_deserialize(_response.raw_body)
234
243
  _errors = APIHelper.map_response(decoded, ['errors'])
235
- ApiResponse.new(_response, data: decoded, errors: _errors)
244
+ ApiResponse.new(
245
+ _response, data: decoded, errors: _errors
246
+ )
236
247
  end
237
248
 
238
249
  # Completes (captures) a payment.
239
250
  # By default, payments are set to complete immediately after they are
240
251
  # created.
241
- # If you set autocomplete to false when creating a payment, you can complete
242
- # (capture)
252
+ # If you set `autocomplete` to `false` when creating a payment, you can
253
+ # complete (capture)
243
254
  # the payment using this endpoint.
244
- # @param [String] payment_id Required parameter: Unique ID identifying the
245
- # payment to be completed.
255
+ # @param [String] payment_id Required parameter: The unique ID identifying
256
+ # the payment to be completed.
246
257
  # @return [CompletePaymentResponse Hash] response from the API call
247
258
  def complete_payment(payment_id:)
248
259
  # Prepare query url.
@@ -250,7 +261,7 @@ module Square
250
261
  _query_builder << '/v2/payments/{payment_id}/complete'
251
262
  _query_builder = APIHelper.append_url_with_template_parameters(
252
263
  _query_builder,
253
- 'payment_id' => payment_id
264
+ 'payment_id' => { 'value' => payment_id, 'encode' => true }
254
265
  )
255
266
  _query_url = APIHelper.clean_url _query_builder
256
267
 
@@ -270,7 +281,9 @@ module Square
270
281
  # Return appropriate response type.
271
282
  decoded = APIHelper.json_deserialize(_response.raw_body)
272
283
  _errors = APIHelper.map_response(decoded, ['errors'])
273
- ApiResponse.new(_response, data: decoded, errors: _errors)
284
+ ApiResponse.new(
285
+ _response, data: decoded, errors: _errors
286
+ )
274
287
  end
275
288
  end
276
289
  end
@@ -6,36 +6,36 @@ module Square
6
6
  end
7
7
 
8
8
  # Retrieves a list of refunds for the account making the request.
9
- # Max results per page: 100
10
- # @param [String] begin_time Optional parameter: Timestamp for the beginning
11
- # of the requested reporting period, in RFC 3339 format. Default: The
12
- # current time minus one year.
13
- # @param [String] end_time Optional parameter: Timestamp for the end of the
14
- # requested reporting period, in RFC 3339 format. Default: The current
9
+ # The maximum results per page is 100.
10
+ # @param [String] begin_time Optional parameter: The timestamp for the
11
+ # beginning of the requested reporting period, in RFC 3339 format. Default:
12
+ # The current time minus one year.
13
+ # @param [String] end_time Optional parameter: The timestamp for the end of
14
+ # the requested reporting period, in RFC 3339 format. Default: The current
15
15
  # time.
16
16
  # @param [String] sort_order Optional parameter: The order in which results
17
- # are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest
17
+ # are listed: - `ASC` - Oldest to newest. - `DESC` - Newest to oldest
18
18
  # (default).
19
19
  # @param [String] cursor Optional parameter: A pagination cursor returned by
20
- # a previous call to this endpoint. Provide this to retrieve the next set of
21
- # results for the original query. See
20
+ # a previous call to this endpoint. Provide this cursor to retrieve the next
21
+ # set of results for the original query. For more information, see
22
22
  # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
23
- # for more information.
23
+ # .
24
24
  # @param [String] location_id Optional parameter: Limit results to the
25
25
  # location supplied. By default, results are returned for all locations
26
- # associated with the merchant.
26
+ # associated with the seller.
27
27
  # @param [String] status Optional parameter: If provided, only refunds with
28
28
  # the given status are returned. For a list of refund status values, see
29
- # [PaymentRefund](#type-paymentrefund). Default: If omitted refunds are
30
- # returned regardless of status.
29
+ # [PaymentRefund](#type-paymentrefund). Default: If omitted, refunds are
30
+ # returned regardless of their status.
31
31
  # @param [String] source_type Optional parameter: If provided, only refunds
32
32
  # with the given source type are returned. - `CARD` - List refunds only for
33
- # payments where card was specified as payment source. Default: If omitted
34
- # refunds are returned regardless of source type.
35
- # @param [Integer] limit Optional parameter: Maximum number of results to be
36
- # returned in a single page. It is possible to receive fewer results than
37
- # the specified limit on a given page. If the supplied value is greater
38
- # than 100, at most 100 results will be returned. Default: `100`
33
+ # payments where `CARD` was specified as the payment source. Default: If
34
+ # omitted, refunds are returned regardless of the source type.
35
+ # @param [Integer] limit Optional parameter: The maximum number of results
36
+ # to be returned in a single page. It is possible to receive fewer results
37
+ # than the specified limit on a given page. If the supplied value is
38
+ # greater than 100, no more than 100 results are returned. Default: 100
39
39
  # @return [ListPaymentRefundsResponse Hash] response from the API call
40
40
  def list_payment_refunds(begin_time: nil,
41
41
  end_time: nil,
@@ -77,7 +77,9 @@ module Square
77
77
  # Return appropriate response type.
78
78
  decoded = APIHelper.json_deserialize(_response.raw_body)
79
79
  _errors = APIHelper.map_response(decoded, ['errors'])
80
- ApiResponse.new(_response, data: decoded, errors: _errors)
80
+ ApiResponse.new(
81
+ _response, data: decoded, errors: _errors
82
+ )
81
83
  end
82
84
 
83
85
  # Refunds a payment. You can refund the entire payment amount or a
@@ -110,12 +112,14 @@ module Square
110
112
  # Return appropriate response type.
111
113
  decoded = APIHelper.json_deserialize(_response.raw_body)
112
114
  _errors = APIHelper.map_response(decoded, ['errors'])
113
- ApiResponse.new(_response, data: decoded, errors: _errors)
115
+ ApiResponse.new(
116
+ _response, data: decoded, errors: _errors
117
+ )
114
118
  end
115
119
 
116
- # Retrieves a specific `Refund` using the `refund_id`.
117
- # @param [String] refund_id Required parameter: Unique ID for the desired
118
- # `PaymentRefund`.
120
+ # Retrieves a specific refund using the `refund_id`.
121
+ # @param [String] refund_id Required parameter: The unique ID for the
122
+ # desired `PaymentRefund`.
119
123
  # @return [GetPaymentRefundResponse Hash] response from the API call
120
124
  def get_payment_refund(refund_id:)
121
125
  # Prepare query url.
@@ -123,7 +127,7 @@ module Square
123
127
  _query_builder << '/v2/refunds/{refund_id}'
124
128
  _query_builder = APIHelper.append_url_with_template_parameters(
125
129
  _query_builder,
126
- 'refund_id' => refund_id
130
+ 'refund_id' => { 'value' => refund_id, 'encode' => true }
127
131
  )
128
132
  _query_url = APIHelper.clean_url _query_builder
129
133
 
@@ -143,7 +147,9 @@ module Square
143
147
  # Return appropriate response type.
144
148
  decoded = APIHelper.json_deserialize(_response.raw_body)
145
149
  _errors = APIHelper.map_response(decoded, ['errors'])
146
- ApiResponse.new(_response, data: decoded, errors: _errors)
150
+ ApiResponse.new(
151
+ _response, data: decoded, errors: _errors
152
+ )
147
153
  end
148
154
  end
149
155
  end