square.rb 6.4.0.20200923 → 6.5.0.20201028

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -30
  3. data/lib/square.rb +61 -61
  4. data/lib/square/api/apple_pay_api.rb +3 -1
  5. data/lib/square/api/bank_accounts_api.rb +12 -15
  6. data/lib/square/api/base_api.rb +1 -1
  7. data/lib/square/api/cash_drawers_api.rb +11 -5
  8. data/lib/square/api/catalog_api.rb +47 -25
  9. data/lib/square/api/checkout_api.rb +4 -2
  10. data/lib/square/api/customer_groups_api.rb +18 -8
  11. data/lib/square/api/customer_segments_api.rb +7 -3
  12. data/lib/square/api/customers_api.rb +47 -27
  13. data/lib/square/api/devices_api.rb +17 -6
  14. data/lib/square/api/disputes_api.rb +37 -19
  15. data/lib/square/api/employees_api.rb +7 -3
  16. data/lib/square/api/inventory_api.rb +25 -11
  17. data/lib/square/api/invoices_api.rb +29 -13
  18. data/lib/square/api/labor_api.rb +57 -25
  19. data/lib/square/api/locations_api.rb +16 -13
  20. data/lib/square/api/loyalty_api.rb +59 -65
  21. data/lib/square/api/merchants_api.rb +7 -3
  22. data/lib/square/api/mobile_authorization_api.rb +3 -1
  23. data/lib/square/api/o_auth_api.rb +10 -4
  24. data/lib/square/api/orders_api.rb +55 -8
  25. data/lib/square/api/payments_api.rb +68 -55
  26. data/lib/square/api/refunds_api.rb +12 -6
  27. data/lib/square/api/subscriptions_api.rb +22 -10
  28. data/lib/square/api/team_api.rb +32 -16
  29. data/lib/square/api/terminal_api.rb +156 -7
  30. data/lib/square/api/transactions_api.rb +32 -18
  31. data/lib/square/api/v1_employees_api.rb +59 -27
  32. data/lib/square/api/v1_items_api.rb +195 -115
  33. data/lib/square/api/v1_locations_api.rb +6 -2
  34. data/lib/square/api/v1_transactions_api.rb +49 -27
  35. data/lib/square/api_helper.rb +14 -9
  36. data/lib/square/client.rb +2 -2
  37. data/lib/square/configuration.rb +1 -1
  38. data/lib/square/http/api_response.rb +2 -0
  39. data/lib/square/http/faraday_client.rb +1 -0
  40. data/spec/user_journey_spec.rb +2 -5
  41. data/test/api/test_locations_api.rb +1 -1
  42. metadata +3 -3
@@ -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,7 +6,7 @@ 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
9
+ # The maximum results per page is 100.
10
10
  # @param [String] begin_time Optional parameter: Timestamp for the beginning
11
11
  # of the requested reporting period, in RFC 3339 format. Default: The
12
12
  # current time minus one year.
@@ -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,10 +112,12 @@ 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`.
120
+ # Retrieves a specific refund using the `refund_id`.
117
121
  # @param [String] refund_id Required parameter: Unique ID for the desired
118
122
  # `PaymentRefund`.
119
123
  # @return [GetPaymentRefundResponse Hash] response from the API call
@@ -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
@@ -40,7 +40,9 @@ module Square
40
40
  # Return appropriate response type.
41
41
  decoded = APIHelper.json_deserialize(_response.raw_body)
42
42
  _errors = APIHelper.map_response(decoded, ['errors'])
43
- ApiResponse.new(_response, data: decoded, errors: _errors)
43
+ ApiResponse.new(
44
+ _response, data: decoded, errors: _errors
45
+ )
44
46
  end
45
47
 
46
48
  # Searches for subscriptions.
@@ -88,7 +90,9 @@ module Square
88
90
  # Return appropriate response type.
89
91
  decoded = APIHelper.json_deserialize(_response.raw_body)
90
92
  _errors = APIHelper.map_response(decoded, ['errors'])
91
- ApiResponse.new(_response, data: decoded, errors: _errors)
93
+ ApiResponse.new(
94
+ _response, data: decoded, errors: _errors
95
+ )
92
96
  end
93
97
 
94
98
  # Retrieves a subscription.
@@ -101,7 +105,7 @@ module Square
101
105
  _query_builder << '/v2/subscriptions/{subscription_id}'
102
106
  _query_builder = APIHelper.append_url_with_template_parameters(
103
107
  _query_builder,
104
- 'subscription_id' => subscription_id
108
+ 'subscription_id' => { 'value' => subscription_id, 'encode' => true }
105
109
  )
106
110
  _query_url = APIHelper.clean_url _query_builder
107
111
 
@@ -121,7 +125,9 @@ module Square
121
125
  # Return appropriate response type.
122
126
  decoded = APIHelper.json_deserialize(_response.raw_body)
123
127
  _errors = APIHelper.map_response(decoded, ['errors'])
124
- ApiResponse.new(_response, data: decoded, errors: _errors)
128
+ ApiResponse.new(
129
+ _response, data: decoded, errors: _errors
130
+ )
125
131
  end
126
132
 
127
133
  # Updates a subscription. You can set, modify, and clear the
@@ -139,7 +145,7 @@ module Square
139
145
  _query_builder << '/v2/subscriptions/{subscription_id}'
140
146
  _query_builder = APIHelper.append_url_with_template_parameters(
141
147
  _query_builder,
142
- 'subscription_id' => subscription_id
148
+ 'subscription_id' => { 'value' => subscription_id, 'encode' => true }
143
149
  )
144
150
  _query_url = APIHelper.clean_url _query_builder
145
151
 
@@ -161,7 +167,9 @@ module Square
161
167
  # Return appropriate response type.
162
168
  decoded = APIHelper.json_deserialize(_response.raw_body)
163
169
  _errors = APIHelper.map_response(decoded, ['errors'])
164
- ApiResponse.new(_response, data: decoded, errors: _errors)
170
+ ApiResponse.new(
171
+ _response, data: decoded, errors: _errors
172
+ )
165
173
  end
166
174
 
167
175
  # Sets the `canceled_date` field to the end of the active billing period.
@@ -175,7 +183,7 @@ module Square
175
183
  _query_builder << '/v2/subscriptions/{subscription_id}/cancel'
176
184
  _query_builder = APIHelper.append_url_with_template_parameters(
177
185
  _query_builder,
178
- 'subscription_id' => subscription_id
186
+ 'subscription_id' => { 'value' => subscription_id, 'encode' => true }
179
187
  )
180
188
  _query_url = APIHelper.clean_url _query_builder
181
189
 
@@ -195,7 +203,9 @@ module Square
195
203
  # Return appropriate response type.
196
204
  decoded = APIHelper.json_deserialize(_response.raw_body)
197
205
  _errors = APIHelper.map_response(decoded, ['errors'])
198
- ApiResponse.new(_response, data: decoded, errors: _errors)
206
+ ApiResponse.new(
207
+ _response, data: decoded, errors: _errors
208
+ )
199
209
  end
200
210
 
201
211
  # Lists all events for a specific subscription.
@@ -220,7 +230,7 @@ module Square
220
230
  _query_builder << '/v2/subscriptions/{subscription_id}/events'
221
231
  _query_builder = APIHelper.append_url_with_template_parameters(
222
232
  _query_builder,
223
- 'subscription_id' => subscription_id
233
+ 'subscription_id' => { 'value' => subscription_id, 'encode' => true }
224
234
  )
225
235
  _query_builder = APIHelper.append_url_with_query_parameters(
226
236
  _query_builder,
@@ -245,7 +255,9 @@ module Square
245
255
  # Return appropriate response type.
246
256
  decoded = APIHelper.json_deserialize(_response.raw_body)
247
257
  _errors = APIHelper.map_response(decoded, ['errors'])
248
- ApiResponse.new(_response, data: decoded, errors: _errors)
258
+ ApiResponse.new(
259
+ _response, data: decoded, errors: _errors
260
+ )
249
261
  end
250
262
  end
251
263
  end