square.rb 8.0.0.20201216 → 26.1.0.20230119

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +79 -221
  4. data/lib/square/api/apple_pay_api.rb +15 -8
  5. data/lib/square/api/bank_accounts_api.rb +5 -5
  6. data/lib/square/api/base_api.rb +27 -9
  7. data/lib/square/api/booking_custom_attributes_api.rb +555 -0
  8. data/lib/square/api/bookings_api.rb +107 -15
  9. data/lib/square/api/cards_api.rb +171 -0
  10. data/lib/square/api/cash_drawers_api.rb +2 -2
  11. data/lib/square/api/catalog_api.rb +167 -73
  12. data/lib/square/api/checkout_api.rb +205 -3
  13. data/lib/square/api/customer_custom_attributes_api.rb +561 -0
  14. data/lib/square/api/customer_groups_api.rb +17 -8
  15. data/lib/square/api/customer_segments_api.rb +15 -6
  16. data/lib/square/api/customers_api.rb +67 -33
  17. data/lib/square/api/devices_api.rb +3 -2
  18. data/lib/square/api/disputes_api.rb +109 -105
  19. data/lib/square/api/gift_card_activities_api.rb +132 -0
  20. data/lib/square/api/gift_cards_api.rb +298 -0
  21. data/lib/square/api/inventory_api.rb +263 -24
  22. data/lib/square/api/invoices_api.rb +21 -21
  23. data/lib/square/api/labor_api.rb +70 -68
  24. data/lib/square/api/location_custom_attributes_api.rb +584 -0
  25. data/lib/square/api/locations_api.rb +21 -14
  26. data/lib/square/api/loyalty_api.rb +333 -50
  27. data/lib/square/api/merchants_api.rb +11 -9
  28. data/lib/square/api/mobile_authorization_api.rb +4 -4
  29. data/lib/square/api/o_auth_api.rb +78 -25
  30. data/lib/square/api/order_custom_attributes_api.rb +601 -0
  31. data/lib/square/api/orders_api.rb +84 -45
  32. data/lib/square/api/payments_api.rb +72 -24
  33. data/lib/square/api/payouts_api.rb +173 -0
  34. data/lib/square/api/refunds_api.rb +18 -7
  35. data/lib/square/api/sites_api.rb +43 -0
  36. data/lib/square/api/snippets_api.rb +146 -0
  37. data/lib/square/api/subscriptions_api.rb +190 -15
  38. data/lib/square/api/team_api.rb +46 -46
  39. data/lib/square/api/terminal_api.rb +172 -22
  40. data/lib/square/api/transactions_api.rb +15 -191
  41. data/lib/square/api/v1_transactions_api.rb +52 -124
  42. data/lib/square/api/vendors_api.rb +257 -0
  43. data/lib/square/api/webhook_subscriptions_api.rb +327 -0
  44. data/lib/square/api_helper.rb +217 -57
  45. data/lib/square/client.rb +90 -18
  46. data/lib/square/configuration.rb +64 -20
  47. data/lib/square/exceptions/validation_exception.rb +13 -0
  48. data/lib/square/http/api_response.rb +7 -9
  49. data/lib/square/http/faraday_client.rb +40 -9
  50. data/lib/square/http/http_client.rb +31 -12
  51. data/lib/square/http/http_request.rb +6 -2
  52. data/lib/square/utilities/date_time_helper.rb +151 -0
  53. data/lib/square/utilities/file_wrapper.rb +1 -2
  54. data/lib/square.rb +56 -44
  55. data/test/api/test_locations_api.rb +2 -5
  56. data/test/test_helper.rb +2 -2
  57. metadata +83 -15
  58. data/lib/square/api/v1_employees_api.rb +0 -751
  59. data/lib/square/api/v1_items_api.rb +0 -1766
@@ -13,17 +13,26 @@ module Square
13
13
  # profiles can take closer to one minute or longer, especially during
14
14
  # network incidents and outages.
15
15
  # @param [String] cursor Optional parameter: A pagination cursor returned by
16
- # a previous call to this endpoint. Provide this to retrieve the next set of
17
- # results for your original query. See the [Pagination
18
- # guide](https://developer.squareup.com/docs/working-with-apis/pagination)
19
- # for more information.
16
+ # a previous call to this endpoint. Provide this cursor to retrieve the next
17
+ # set of results for your original query. For more information, see
18
+ # [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
19
+ # atterns/pagination).
20
+ # @param [Integer] limit Optional parameter: The maximum number of results
21
+ # to return in a single page. This limit is advisory. The response might
22
+ # contain more or fewer results. If the specified limit is less than 1 or
23
+ # greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400
24
+ # VALUE_TOO_HIGH` error. The default value is 100. For more information,
25
+ # see
26
+ # [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
27
+ # atterns/pagination).
20
28
  # @param [CustomerSortField] sort_field Optional parameter: Indicates how
21
- # Customers should be sorted. Default: `DEFAULT`.
29
+ # customers should be sorted. The default value is `DEFAULT`.
22
30
  # @param [SortOrder] sort_order Optional parameter: Indicates whether
23
- # Customers should be sorted in ascending (`ASC`) or descending (`DESC`)
24
- # order. Default: `ASC`.
31
+ # customers should be sorted in ascending (`ASC`) or descending (`DESC`)
32
+ # order. The default value is `ASC`.
25
33
  # @return [ListCustomersResponse Hash] response from the API call
26
34
  def list_customers(cursor: nil,
35
+ limit: nil,
27
36
  sort_field: nil,
28
37
  sort_order: nil)
29
38
  # Prepare query url.
@@ -32,6 +41,7 @@ module Square
32
41
  _query_builder = APIHelper.append_url_with_query_parameters(
33
42
  _query_builder,
34
43
  'cursor' => cursor,
44
+ 'limit' => limit,
35
45
  'sort_field' => sort_field,
36
46
  'sort_order' => sort_order
37
47
  )
@@ -58,10 +68,9 @@ module Square
58
68
  )
59
69
  end
60
70
 
61
- # Creates a new customer for a business, which can have associated cards on
62
- # file.
63
- # You must provide __at least one__ of the following values in your request
64
- # to this
71
+ # Creates a new customer for a business.
72
+ # You must provide at least one of the following values in your request to
73
+ # this
65
74
  # endpoint:
66
75
  # - `given_name`
67
76
  # - `family_name`
@@ -81,7 +90,7 @@ module Square
81
90
  # Prepare headers.
82
91
  _headers = {
83
92
  'accept' => 'application/json',
84
- 'content-type' => 'application/json; charset=utf-8'
93
+ 'Content-Type' => 'application/json'
85
94
  }
86
95
 
87
96
  # Prepare and execute HttpRequest.
@@ -101,8 +110,8 @@ module Square
101
110
  )
102
111
  end
103
112
 
104
- # Searches the customer profiles associated with a Square account using a
105
- # supported query filter.
113
+ # Searches the customer profiles associated with a Square account using one
114
+ # or more supported query filters.
106
115
  # Calling `SearchCustomers` without any explicit query filter returns all
107
116
  # customer profiles ordered alphabetically based on `given_name` and
108
117
  # `family_name`.
@@ -125,7 +134,7 @@ module Square
125
134
  # Prepare headers.
126
135
  _headers = {
127
136
  'accept' => 'application/json',
128
- 'content-type' => 'application/json; charset=utf-8'
137
+ 'Content-Type' => 'application/json'
129
138
  }
130
139
 
131
140
  # Prepare and execute HttpRequest.
@@ -145,15 +154,29 @@ module Square
145
154
  )
146
155
  end
147
156
 
148
- # Deletes a customer from a business, along with any linked cards on file.
149
- # When two profiles
150
- # are merged into a single profile, that profile is assigned a new
151
- # `customer_id`. You must use the
152
- # new `customer_id` to delete merged profiles.
157
+ # Deletes a customer profile from a business. This operation also unlinks
158
+ # any associated cards on file.
159
+ # As a best practice, include the `version` field in the request to enable
160
+ # [optimistic
161
+ # concurrency](https://developer.squareup.com/docs/build-basics/common-api-p
162
+ # atterns/optimistic-concurrency) control.
163
+ # If included, the value must be set to the current version of the customer
164
+ # profile.
165
+ # To delete a customer profile that was created by merging existing
166
+ # profiles, you must use the ID of the newly created profile.
153
167
  # @param [String] customer_id Required parameter: The ID of the customer to
154
168
  # delete.
169
+ # @param [Integer] version Optional parameter: The current version of the
170
+ # customer profile. As a best practice, you should include this parameter
171
+ # to enable [optimistic
172
+ # concurrency](https://developer.squareup.com/docs/build-basics/common-api-p
173
+ # atterns/optimistic-concurrency) control. For more information, see
174
+ # [Delete a customer
175
+ # profile](https://developer.squareup.com/docs/customers-api/use-the-api/kee
176
+ # p-records#delete-customer-profile).
155
177
  # @return [DeleteCustomerResponse Hash] response from the API call
156
- def delete_customer(customer_id:)
178
+ def delete_customer(customer_id:,
179
+ version: nil)
157
180
  # Prepare query url.
158
181
  _query_builder = config.get_base_uri
159
182
  _query_builder << '/v2/customers/{customer_id}'
@@ -161,6 +184,10 @@ module Square
161
184
  _query_builder,
162
185
  'customer_id' => { 'value' => customer_id, 'encode' => true }
163
186
  )
187
+ _query_builder = APIHelper.append_url_with_query_parameters(
188
+ _query_builder,
189
+ 'version' => version
190
+ )
164
191
  _query_url = APIHelper.clean_url _query_builder
165
192
 
166
193
  # Prepare headers.
@@ -219,16 +246,21 @@ module Square
219
246
  )
220
247
  end
221
248
 
222
- # Updates the details of an existing customer. When two profiles are merged
223
- # into a single profile, that profile is assigned a new `customer_id`. You
224
- # must use
225
- # the new `customer_id` to update merged profiles.
226
- # You cannot edit a customer's cards on file with this endpoint. To make
227
- # changes
228
- # to a card on file, you must delete the existing card on file with the
229
- # [DeleteCustomerCard](#endpoint-Customers-deletecustomercard) endpoint,
230
- # then create a new one with the
231
- # [CreateCustomerCard](#endpoint-Customers-createcustomercard) endpoint.
249
+ # Updates a customer profile. This endpoint supports sparse updates, so only
250
+ # new or changed fields are required in the request.
251
+ # To add or update a field, specify the new value. To remove a field,
252
+ # specify `null` and include the `X-Clear-Null` header set to `true`
253
+ # (recommended) or specify an empty string (string fields only).
254
+ # As a best practice, include the `version` field in the request to enable
255
+ # [optimistic
256
+ # concurrency](https://developer.squareup.com/docs/build-basics/common-api-p
257
+ # atterns/optimistic-concurrency) control.
258
+ # If included, the value must be set to the current version of the customer
259
+ # profile.
260
+ # To update a customer profile that was created by merging existing
261
+ # profiles, you must use the ID of the newly created profile.
262
+ # You cannot use this endpoint to change cards on file. To make changes, use
263
+ # the [Cards API]($e/Cards) or [Gift Cards API]($e/GiftCards).
232
264
  # @param [String] customer_id Required parameter: The ID of the customer to
233
265
  # update.
234
266
  # @param [UpdateCustomerRequest] body Required parameter: An object
@@ -249,7 +281,7 @@ module Square
249
281
  # Prepare headers.
250
282
  _headers = {
251
283
  'accept' => 'application/json',
252
- 'content-type' => 'application/json; charset=utf-8'
284
+ 'Content-Type' => 'application/json'
253
285
  }
254
286
 
255
287
  # Prepare and execute HttpRequest.
@@ -282,6 +314,7 @@ module Square
282
314
  # @return [CreateCustomerCardResponse Hash] response from the API call
283
315
  def create_customer_card(customer_id:,
284
316
  body:)
317
+ warn 'Endpoint create_customer_card in CustomersApi is deprecated'
285
318
  # Prepare query url.
286
319
  _query_builder = config.get_base_uri
287
320
  _query_builder << '/v2/customers/{customer_id}/cards'
@@ -294,7 +327,7 @@ module Square
294
327
  # Prepare headers.
295
328
  _headers = {
296
329
  'accept' => 'application/json',
297
- 'content-type' => 'application/json; charset=utf-8'
330
+ 'Content-Type' => 'application/json'
298
331
  }
299
332
 
300
333
  # Prepare and execute HttpRequest.
@@ -322,6 +355,7 @@ module Square
322
355
  # @return [DeleteCustomerCardResponse Hash] response from the API call
323
356
  def delete_customer_card(customer_id:,
324
357
  card_id:)
358
+ warn 'Endpoint delete_customer_card in CustomersApi is deprecated'
325
359
  # Prepare query url.
326
360
  _query_builder = config.get_base_uri
327
361
  _query_builder << '/v2/customers/{customer_id}/cards/{card_id}'
@@ -9,7 +9,8 @@ module Square
9
9
  # @param [String] cursor Optional parameter: A pagination cursor returned by
10
10
  # a previous call to this endpoint. Provide this to retrieve the next set of
11
11
  # results for your original query. See [Paginating
12
- # results](#paginatingresults) for more information.
12
+ # results](https://developer.squareup.com/docs/working-with-apis/pagination)
13
+ # for more information.
13
14
  # @param [String] location_id Optional parameter: If specified, only returns
14
15
  # DeviceCodes of the specified location. Returns DeviceCodes of all
15
16
  # locations if empty.
@@ -73,7 +74,7 @@ module Square
73
74
  # Prepare headers.
74
75
  _headers = {
75
76
  'accept' => 'application/json',
76
- 'content-type' => 'application/json; charset=utf-8'
77
+ 'Content-Type' => 'application/json'
77
78
  }
78
79
 
79
80
  # Prepare and execute HttpRequest.
@@ -11,13 +11,12 @@ module Square
11
11
  # set of results for the original query. For more information, see
12
12
  # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
13
13
  # .
14
- # @param [DisputeState] states Optional parameter: The dispute states to
15
- # filter the result. If not specified, the endpoint returns all open
16
- # disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`).
14
+ # @param [DisputeState] states Optional parameter: The dispute states used
15
+ # to filter the result. If not specified, the endpoint returns all
16
+ # disputes.
17
17
  # @param [String] location_id Optional parameter: The ID of the location for
18
18
  # which to return a list of disputes. If not specified, the endpoint returns
19
- # all open disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or
20
- # `LOST`) associated with all locations.
19
+ # disputes associated with all locations.
21
20
  # @return [ListDisputesResponse Hash] response from the API call
22
21
  def list_disputes(cursor: nil,
23
22
  states: nil,
@@ -131,8 +130,14 @@ module Square
131
130
 
132
131
  # Returns a list of evidence associated with a dispute.
133
132
  # @param [String] dispute_id Required parameter: The ID of the dispute.
133
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
134
+ # a previous call to this endpoint. Provide this cursor to retrieve the next
135
+ # set of results for the original query. For more information, see
136
+ # [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
137
+ # atterns/pagination).
134
138
  # @return [ListDisputeEvidenceResponse Hash] response from the API call
135
- def list_dispute_evidence(dispute_id:)
139
+ def list_dispute_evidence(dispute_id:,
140
+ cursor: nil)
136
141
  # Prepare query url.
137
142
  _query_builder = config.get_base_uri
138
143
  _query_builder << '/v2/disputes/{dispute_id}/evidence'
@@ -140,6 +145,10 @@ module Square
140
145
  _query_builder,
141
146
  'dispute_id' => { 'value' => dispute_id, 'encode' => true }
142
147
  )
148
+ _query_builder = APIHelper.append_url_with_query_parameters(
149
+ _query_builder,
150
+ 'cursor' => cursor
151
+ )
143
152
  _query_url = APIHelper.clean_url _query_builder
144
153
 
145
154
  # Prepare headers.
@@ -163,38 +172,59 @@ module Square
163
172
  )
164
173
  end
165
174
 
166
- # Removes specified evidence from a dispute.
167
- # Square does not send the bank any evidence that is removed. Also, you
168
- # cannot remove evidence after
169
- # submitting it to the bank using
170
- # [SubmitEvidence](https://developer.squareup.com/docs/reference/square/disp
171
- # utes-api/submit-evidence).
172
- # @param [String] dispute_id Required parameter: The ID of the dispute you
173
- # want to remove evidence from.
174
- # @param [String] evidence_id Required parameter: The ID of the evidence you
175
- # want to remove.
176
- # @return [RemoveDisputeEvidenceResponse Hash] response from the API call
177
- def remove_dispute_evidence(dispute_id:,
178
- evidence_id:)
175
+ # Uploads a file to use as evidence in a dispute challenge. The endpoint
176
+ # accepts HTTP
177
+ # multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF
178
+ # formats.
179
+ # @param [String] dispute_id Required parameter: The ID of the dispute for
180
+ # which you want to upload evidence.
181
+ # @param [CreateDisputeEvidenceFileRequest] request Optional parameter:
182
+ # Defines the parameters for a `CreateDisputeEvidenceFile` request.
183
+ # @param [File | UploadIO] image_file Optional parameter: Example:
184
+ # @return [CreateDisputeEvidenceFileResponse Hash] response from the API call
185
+ def create_dispute_evidence_file(dispute_id:,
186
+ request: nil,
187
+ image_file: nil)
179
188
  # Prepare query url.
180
189
  _query_builder = config.get_base_uri
181
- _query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
190
+ _query_builder << '/v2/disputes/{dispute_id}/evidence-files'
182
191
  _query_builder = APIHelper.append_url_with_template_parameters(
183
192
  _query_builder,
184
- 'dispute_id' => { 'value' => dispute_id, 'encode' => true },
185
- 'evidence_id' => { 'value' => evidence_id, 'encode' => true }
193
+ 'dispute_id' => { 'value' => dispute_id, 'encode' => true }
186
194
  )
187
195
  _query_url = APIHelper.clean_url _query_builder
188
196
 
197
+ if image_file.is_a? FileWrapper
198
+ image_file_wrapper = image_file.file
199
+ image_file_content_type = image_file.content_type
200
+ else
201
+ image_file_wrapper = image_file
202
+ image_file_content_type = 'image/jpeg'
203
+ end
204
+
189
205
  # Prepare headers.
190
206
  _headers = {
191
207
  'accept' => 'application/json'
192
208
  }
193
209
 
210
+ # Prepare form parameters.
211
+ _parameters = {
212
+ 'request' => Faraday::UploadIO.new(
213
+ StringIO.new(request.to_json),
214
+ 'application/json'
215
+ ),
216
+ 'image_file' => Faraday::UploadIO.new(
217
+ image_file_wrapper,
218
+ image_file_content_type
219
+ )
220
+ }
221
+ _parameters = APIHelper.form_encode_parameters(_parameters)
222
+
194
223
  # Prepare and execute HttpRequest.
195
- _request = config.http_client.delete(
224
+ _request = config.http_client.post(
196
225
  _query_url,
197
- headers: _headers
226
+ headers: _headers,
227
+ parameters: _parameters
198
228
  )
199
229
  OAuth2.apply(config, _request)
200
230
  _response = execute_request(_request)
@@ -207,36 +237,35 @@ module Square
207
237
  )
208
238
  end
209
239
 
210
- # Returns the specific evidence metadata associated with a specific dispute.
211
- # You must maintain a copy of the evidence you upload if you want to
212
- # reference it later. You cannot
213
- # download the evidence after you upload it.
214
- # @param [String] dispute_id Required parameter: The ID of the dispute that
215
- # you want to retrieve evidence from.
216
- # @param [String] evidence_id Required parameter: The ID of the evidence to
217
- # retrieve.
218
- # @return [RetrieveDisputeEvidenceResponse Hash] response from the API call
219
- def retrieve_dispute_evidence(dispute_id:,
220
- evidence_id:)
240
+ # Uploads text to use as evidence for a dispute challenge.
241
+ # @param [String] dispute_id Required parameter: The ID of the dispute for
242
+ # which you want to upload evidence.
243
+ # @param [CreateDisputeEvidenceTextRequest] body Required parameter: An
244
+ # object containing the fields to POST for the request. See the
245
+ # corresponding object definition for field details.
246
+ # @return [CreateDisputeEvidenceTextResponse Hash] response from the API call
247
+ def create_dispute_evidence_text(dispute_id:,
248
+ body:)
221
249
  # Prepare query url.
222
250
  _query_builder = config.get_base_uri
223
- _query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
251
+ _query_builder << '/v2/disputes/{dispute_id}/evidence-text'
224
252
  _query_builder = APIHelper.append_url_with_template_parameters(
225
253
  _query_builder,
226
- 'dispute_id' => { 'value' => dispute_id, 'encode' => true },
227
- 'evidence_id' => { 'value' => evidence_id, 'encode' => true }
254
+ 'dispute_id' => { 'value' => dispute_id, 'encode' => true }
228
255
  )
229
256
  _query_url = APIHelper.clean_url _query_builder
230
257
 
231
258
  # Prepare headers.
232
259
  _headers = {
233
- 'accept' => 'application/json'
260
+ 'accept' => 'application/json',
261
+ 'Content-Type' => 'application/json'
234
262
  }
235
263
 
236
264
  # Prepare and execute HttpRequest.
237
- _request = config.http_client.get(
265
+ _request = config.http_client.post(
238
266
  _query_url,
239
- headers: _headers
267
+ headers: _headers,
268
+ parameters: body.to_json
240
269
  )
241
270
  OAuth2.apply(config, _request)
242
271
  _response = execute_request(_request)
@@ -249,59 +278,34 @@ module Square
249
278
  )
250
279
  end
251
280
 
252
- # Uploads a file to use as evidence in a dispute challenge. The endpoint
253
- # accepts HTTP
254
- # multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF
255
- # formats.
256
- # @param [String] dispute_id Required parameter: The ID of the dispute you
257
- # want to upload evidence for.
258
- # @param [CreateDisputeEvidenceFileRequest] request Optional parameter:
259
- # Defines the parameters for a `CreateDisputeEvidenceFile` request.
260
- # @param [File | UploadIO] image_file Optional parameter: Example:
261
- # @return [CreateDisputeEvidenceFileResponse Hash] response from the API call
262
- def create_dispute_evidence_file(dispute_id:,
263
- request: nil,
264
- image_file: nil)
281
+ # Removes specified evidence from a dispute.
282
+ # Square does not send the bank any evidence that is removed.
283
+ # @param [String] dispute_id Required parameter: The ID of the dispute from
284
+ # which you want to remove evidence.
285
+ # @param [String] evidence_id Required parameter: The ID of the evidence you
286
+ # want to remove.
287
+ # @return [DeleteDisputeEvidenceResponse Hash] response from the API call
288
+ def delete_dispute_evidence(dispute_id:,
289
+ evidence_id:)
265
290
  # Prepare query url.
266
291
  _query_builder = config.get_base_uri
267
- _query_builder << '/v2/disputes/{dispute_id}/evidence_file'
292
+ _query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
268
293
  _query_builder = APIHelper.append_url_with_template_parameters(
269
294
  _query_builder,
270
- 'dispute_id' => { 'value' => dispute_id, 'encode' => true }
295
+ 'dispute_id' => { 'value' => dispute_id, 'encode' => true },
296
+ 'evidence_id' => { 'value' => evidence_id, 'encode' => true }
271
297
  )
272
298
  _query_url = APIHelper.clean_url _query_builder
273
299
 
274
- if image_file.is_a? FileWrapper
275
- image_file_wrapper = image_file.file
276
- image_file_content_type = image_file.content_type
277
- else
278
- image_file_wrapper = image_file
279
- image_file_content_type = 'image/jpeg'
280
- end
281
-
282
300
  # Prepare headers.
283
301
  _headers = {
284
302
  'accept' => 'application/json'
285
303
  }
286
304
 
287
- # Prepare form parameters.
288
- _parameters = {
289
- 'request' => Faraday::UploadIO.new(
290
- StringIO.new(request.to_json),
291
- 'application/json'
292
- ),
293
- 'image_file' => Faraday::UploadIO.new(
294
- image_file_wrapper,
295
- image_file_content_type
296
- )
297
- }
298
- _parameters = APIHelper.form_encode_parameters(_parameters)
299
-
300
305
  # Prepare and execute HttpRequest.
301
- _request = config.http_client.post(
306
+ _request = config.http_client.delete(
302
307
  _query_url,
303
- headers: _headers,
304
- parameters: _parameters
308
+ headers: _headers
305
309
  )
306
310
  OAuth2.apply(config, _request)
307
311
  _response = execute_request(_request)
@@ -314,35 +318,35 @@ module Square
314
318
  )
315
319
  end
316
320
 
317
- # Uploads text to use as evidence for a dispute challenge.
318
- # @param [String] dispute_id Required parameter: The ID of the dispute you
319
- # want to upload evidence for.
320
- # @param [CreateDisputeEvidenceTextRequest] body Required parameter: An
321
- # object containing the fields to POST for the request. See the
322
- # corresponding object definition for field details.
323
- # @return [CreateDisputeEvidenceTextResponse Hash] response from the API call
324
- def create_dispute_evidence_text(dispute_id:,
325
- body:)
321
+ # Returns the metadata for the evidence specified in the request URL path.
322
+ # You must maintain a copy of any evidence uploaded if you want to reference
323
+ # it later. Evidence cannot be downloaded after you upload it.
324
+ # @param [String] dispute_id Required parameter: The ID of the dispute from
325
+ # which you want to retrieve evidence metadata.
326
+ # @param [String] evidence_id Required parameter: The ID of the evidence to
327
+ # retrieve.
328
+ # @return [RetrieveDisputeEvidenceResponse Hash] response from the API call
329
+ def retrieve_dispute_evidence(dispute_id:,
330
+ evidence_id:)
326
331
  # Prepare query url.
327
332
  _query_builder = config.get_base_uri
328
- _query_builder << '/v2/disputes/{dispute_id}/evidence_text'
333
+ _query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
329
334
  _query_builder = APIHelper.append_url_with_template_parameters(
330
335
  _query_builder,
331
- 'dispute_id' => { 'value' => dispute_id, 'encode' => true }
336
+ 'dispute_id' => { 'value' => dispute_id, 'encode' => true },
337
+ 'evidence_id' => { 'value' => evidence_id, 'encode' => true }
332
338
  )
333
339
  _query_url = APIHelper.clean_url _query_builder
334
340
 
335
341
  # Prepare headers.
336
342
  _headers = {
337
- 'accept' => 'application/json',
338
- 'content-type' => 'application/json; charset=utf-8'
343
+ 'accept' => 'application/json'
339
344
  }
340
345
 
341
346
  # Prepare and execute HttpRequest.
342
- _request = config.http_client.post(
347
+ _request = config.http_client.get(
343
348
  _query_url,
344
- headers: _headers,
345
- parameters: body.to_json
349
+ headers: _headers
346
350
  )
347
351
  OAuth2.apply(config, _request)
348
352
  _response = execute_request(_request)
@@ -356,16 +360,16 @@ module Square
356
360
  end
357
361
 
358
362
  # Submits evidence to the cardholder's bank.
359
- # Before submitting evidence, Square compiles all available evidence. This
360
- # includes evidence uploaded
363
+ # The evidence submitted by this endpoint includes evidence uploaded
361
364
  # using the
362
- # [CreateDisputeEvidenceFile](https://developer.squareup.com/docs/reference/
363
- # square/disputes-api/create-dispute-evidence-file) and
364
- # [CreateDisputeEvidenceText](https://developer.squareup.com/docs/reference/
365
- # square/disputes-api/create-dispute-evidence-text) endpoints and
366
- # evidence automatically provided by Square, when available.
367
- # @param [String] dispute_id Required parameter: The ID of the dispute that
368
- # you want to submit evidence for.
365
+ # [CreateDisputeEvidenceFile]($e/Disputes/CreateDisputeEvidenceFile) and
366
+ # [CreateDisputeEvidenceText]($e/Disputes/CreateDisputeEvidenceText)
367
+ # endpoints and
368
+ # evidence automatically provided by Square, when available. Evidence cannot
369
+ # be removed from
370
+ # a dispute after submission.
371
+ # @param [String] dispute_id Required parameter: The ID of the dispute for
372
+ # which you want to submit evidence.
369
373
  # @return [SubmitEvidenceResponse Hash] response from the API call
370
374
  def submit_evidence(dispute_id:)
371
375
  # Prepare query url.