square.rb 11.0.0.20210513 → 12.0.0.20210616
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/square.rb +3 -0
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/cards_api.rb +170 -0
- data/lib/square/api/catalog_api.rb +6 -4
- data/lib/square/api/customers_api.rb +7 -9
- data/lib/square/api/disputes_api.rb +97 -86
- data/lib/square/api/gift_card_activities_api.rb +127 -0
- data/lib/square/api/gift_cards_api.rb +291 -0
- data/lib/square/api/o_auth_api.rb +8 -9
- data/lib/square/api/team_api.rb +30 -30
- data/lib/square/api/transactions_api.rb +3 -2
- data/lib/square/client.rb +25 -3
- data/lib/square/configuration.rb +23 -8
- data/lib/square/http/faraday_client.rb +5 -2
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2899ef8f7b608c506ec04abc840c1c80f24109063086e5f756049544919e7d6e
|
4
|
+
data.tar.gz: 5835b5bc55af2f9cd9618dc5d09cdc47b1d197c23cf45d8293c4f59e90521c33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3352454a34c03eeaebff9db1e805f8c12bf929deaf045c4b0a258caf917c5b4dad010bfd18741881c99057a254890d5f8ef4887f53360430915a3c746b3e7311
|
7
|
+
data.tar.gz: ff8762e1244f9a074599fbb05b2441fbc2f16c715bfc466f8ab3c49b53d88b3664eee9622d9b44e0f8b4c5209b8eeedebaaaf284495bdd620e72f698dfcefab2
|
data/lib/square.rb
CHANGED
@@ -36,6 +36,7 @@ require_relative 'square/api/v1_transactions_api.rb'
|
|
36
36
|
require_relative 'square/api/apple_pay_api.rb'
|
37
37
|
require_relative 'square/api/bank_accounts_api.rb'
|
38
38
|
require_relative 'square/api/bookings_api.rb'
|
39
|
+
require_relative 'square/api/cards_api.rb'
|
39
40
|
require_relative 'square/api/cash_drawers_api.rb'
|
40
41
|
require_relative 'square/api/catalog_api.rb'
|
41
42
|
require_relative 'square/api/customers_api.rb'
|
@@ -44,6 +45,8 @@ require_relative 'square/api/customer_segments_api.rb'
|
|
44
45
|
require_relative 'square/api/devices_api.rb'
|
45
46
|
require_relative 'square/api/disputes_api.rb'
|
46
47
|
require_relative 'square/api/employees_api.rb'
|
48
|
+
require_relative 'square/api/gift_cards_api.rb'
|
49
|
+
require_relative 'square/api/gift_card_activities_api.rb'
|
47
50
|
require_relative 'square/api/inventory_api.rb'
|
48
51
|
require_relative 'square/api/invoices_api.rb'
|
49
52
|
require_relative 'square/api/labor_api.rb'
|
data/lib/square/api/base_api.rb
CHANGED
@@ -0,0 +1,170 @@
|
|
1
|
+
module Square
|
2
|
+
# CardsApi
|
3
|
+
class CardsApi < BaseApi
|
4
|
+
def initialize(config, http_call_back: nil)
|
5
|
+
super(config, http_call_back: http_call_back)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Retrieves a list of cards owned by the account making the request.
|
9
|
+
# A max of 25 cards will be returned.
|
10
|
+
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
11
|
+
# a previous call to this endpoint. Provide this to retrieve the next set of
|
12
|
+
# results for your original query. See
|
13
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
14
|
+
# for more information.
|
15
|
+
# @param [String] customer_id Optional parameter: Limit results to cards
|
16
|
+
# associated with the customer supplied. By default, all cards owned by the
|
17
|
+
# merchant are returned.
|
18
|
+
# @param [Boolean] include_disabled Optional parameter: Includes disabled
|
19
|
+
# cards. By default, all enabled cards owned by the merchant are returned.
|
20
|
+
# @param [String] reference_id Optional parameter: Limit results to cards
|
21
|
+
# associated with the reference_id supplied.
|
22
|
+
# @param [SortOrder] sort_order Optional parameter: Sorts the returned list
|
23
|
+
# by when the card was created with the specified order. This field defaults
|
24
|
+
# to ASC.
|
25
|
+
# @return [ListCardsResponse Hash] response from the API call
|
26
|
+
def list_cards(cursor: nil,
|
27
|
+
customer_id: nil,
|
28
|
+
include_disabled: false,
|
29
|
+
reference_id: nil,
|
30
|
+
sort_order: nil)
|
31
|
+
# Prepare query url.
|
32
|
+
_query_builder = config.get_base_uri
|
33
|
+
_query_builder << '/v2/cards'
|
34
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
35
|
+
_query_builder,
|
36
|
+
'cursor' => cursor,
|
37
|
+
'customer_id' => customer_id,
|
38
|
+
'include_disabled' => include_disabled,
|
39
|
+
'reference_id' => reference_id,
|
40
|
+
'sort_order' => sort_order
|
41
|
+
)
|
42
|
+
_query_url = APIHelper.clean_url _query_builder
|
43
|
+
|
44
|
+
# Prepare headers.
|
45
|
+
_headers = {
|
46
|
+
'accept' => 'application/json'
|
47
|
+
}
|
48
|
+
|
49
|
+
# Prepare and execute HttpRequest.
|
50
|
+
_request = config.http_client.get(
|
51
|
+
_query_url,
|
52
|
+
headers: _headers
|
53
|
+
)
|
54
|
+
OAuth2.apply(config, _request)
|
55
|
+
_response = execute_request(_request)
|
56
|
+
|
57
|
+
# Return appropriate response type.
|
58
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
59
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
60
|
+
ApiResponse.new(
|
61
|
+
_response, data: decoded, errors: _errors
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Adds a card on file to an existing merchant.
|
66
|
+
# @param [CreateCardRequest] body Required parameter: An object containing
|
67
|
+
# the fields to POST for the request. See the corresponding object
|
68
|
+
# definition for field details.
|
69
|
+
# @return [CreateCardResponse Hash] response from the API call
|
70
|
+
def create_card(body:)
|
71
|
+
# Prepare query url.
|
72
|
+
_query_builder = config.get_base_uri
|
73
|
+
_query_builder << '/v2/cards'
|
74
|
+
_query_url = APIHelper.clean_url _query_builder
|
75
|
+
|
76
|
+
# Prepare headers.
|
77
|
+
_headers = {
|
78
|
+
'accept' => 'application/json',
|
79
|
+
'content-type' => 'application/json; charset=utf-8'
|
80
|
+
}
|
81
|
+
|
82
|
+
# Prepare and execute HttpRequest.
|
83
|
+
_request = config.http_client.post(
|
84
|
+
_query_url,
|
85
|
+
headers: _headers,
|
86
|
+
parameters: body.to_json
|
87
|
+
)
|
88
|
+
OAuth2.apply(config, _request)
|
89
|
+
_response = execute_request(_request)
|
90
|
+
|
91
|
+
# Return appropriate response type.
|
92
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
93
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
94
|
+
ApiResponse.new(
|
95
|
+
_response, data: decoded, errors: _errors
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Retrieves details for a specific Card.
|
100
|
+
# @param [String] card_id Required parameter: Unique ID for the desired
|
101
|
+
# Card.
|
102
|
+
# @return [RetrieveCardResponse Hash] response from the API call
|
103
|
+
def retrieve_card(card_id:)
|
104
|
+
# Prepare query url.
|
105
|
+
_query_builder = config.get_base_uri
|
106
|
+
_query_builder << '/v2/cards/{card_id}'
|
107
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
108
|
+
_query_builder,
|
109
|
+
'card_id' => { 'value' => card_id, 'encode' => true }
|
110
|
+
)
|
111
|
+
_query_url = APIHelper.clean_url _query_builder
|
112
|
+
|
113
|
+
# Prepare headers.
|
114
|
+
_headers = {
|
115
|
+
'accept' => 'application/json'
|
116
|
+
}
|
117
|
+
|
118
|
+
# Prepare and execute HttpRequest.
|
119
|
+
_request = config.http_client.get(
|
120
|
+
_query_url,
|
121
|
+
headers: _headers
|
122
|
+
)
|
123
|
+
OAuth2.apply(config, _request)
|
124
|
+
_response = execute_request(_request)
|
125
|
+
|
126
|
+
# Return appropriate response type.
|
127
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
128
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
129
|
+
ApiResponse.new(
|
130
|
+
_response, data: decoded, errors: _errors
|
131
|
+
)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Disables the card, preventing any further updates or charges.
|
135
|
+
# Disabling an already disabled card is allowed but has no effect.
|
136
|
+
# @param [String] card_id Required parameter: Unique ID for the desired
|
137
|
+
# Card.
|
138
|
+
# @return [DisableCardResponse Hash] response from the API call
|
139
|
+
def disable_card(card_id:)
|
140
|
+
# Prepare query url.
|
141
|
+
_query_builder = config.get_base_uri
|
142
|
+
_query_builder << '/v2/cards/{card_id}/disable'
|
143
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
144
|
+
_query_builder,
|
145
|
+
'card_id' => { 'value' => card_id, 'encode' => true }
|
146
|
+
)
|
147
|
+
_query_url = APIHelper.clean_url _query_builder
|
148
|
+
|
149
|
+
# Prepare headers.
|
150
|
+
_headers = {
|
151
|
+
'accept' => 'application/json'
|
152
|
+
}
|
153
|
+
|
154
|
+
# Prepare and execute HttpRequest.
|
155
|
+
_request = config.http_client.post(
|
156
|
+
_query_url,
|
157
|
+
headers: _headers
|
158
|
+
)
|
159
|
+
OAuth2.apply(config, _request)
|
160
|
+
_response = execute_request(_request)
|
161
|
+
|
162
|
+
# Return appropriate response type.
|
163
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
164
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
165
|
+
ApiResponse.new(
|
166
|
+
_response, data: decoded, errors: _errors
|
167
|
+
)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
@@ -246,10 +246,12 @@ module Square
|
|
246
246
|
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
247
247
|
# for more information.
|
248
248
|
# @param [String] types Optional parameter: An optional case-insensitive,
|
249
|
-
# comma-separated list of object types to retrieve
|
250
|
-
#
|
251
|
-
#
|
252
|
-
# `
|
249
|
+
# comma-separated list of object types to retrieve. The valid values are
|
250
|
+
# defined in the [CatalogObjectType]($m/CatalogObjectType) enum, including
|
251
|
+
# `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`, `MODIFIER`,
|
252
|
+
# `MODIFIER_LIST`, or `IMAGE`. If this is unspecified, the operation
|
253
|
+
# returns objects of all the types at the version of the Square API used to
|
254
|
+
# make the request.
|
253
255
|
# @param [Long] catalog_version Optional parameter: The specific version of
|
254
256
|
# the catalog objects to be included in the response. This allows you to
|
255
257
|
# retrieve historical versions of objects. The specified version value is
|
@@ -58,8 +58,7 @@ module Square
|
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
61
|
-
# Creates a new customer for a business
|
62
|
-
# file.
|
61
|
+
# Creates a new customer for a business.
|
63
62
|
# You must provide at least one of the following values in your request to
|
64
63
|
# this
|
65
64
|
# endpoint:
|
@@ -145,8 +144,8 @@ module Square
|
|
145
144
|
)
|
146
145
|
end
|
147
146
|
|
148
|
-
# Deletes a customer profile from a business
|
149
|
-
# file.
|
147
|
+
# Deletes a customer profile from a business. This operation also unlinks
|
148
|
+
# any associated cards on file.
|
150
149
|
# As a best practice, you should include the `version` field in the request
|
151
150
|
# to enable [optimistic
|
152
151
|
# concurrency](https://developer.squareup.com/docs/working-with-apis/optimis
|
@@ -245,11 +244,8 @@ module Square
|
|
245
244
|
# the customer profile.
|
246
245
|
# To update a customer profile that was created by merging existing
|
247
246
|
# profiles, you must use the ID of the newly created profile.
|
248
|
-
# You cannot use this endpoint to change cards on file. To
|
249
|
-
#
|
250
|
-
# the existing card and then call
|
251
|
-
# [CreateCustomerCard]($e/Customers/CreateCustomerCard) to create a new
|
252
|
-
# card.
|
247
|
+
# You cannot use this endpoint to change cards on file. To make changes, use
|
248
|
+
# the [Cards API]($e/Cards) or [Gift Cards API]($e/GiftCards).
|
253
249
|
# @param [String] customer_id Required parameter: The ID of the customer to
|
254
250
|
# update.
|
255
251
|
# @param [UpdateCustomerRequest] body Required parameter: An object
|
@@ -303,6 +299,7 @@ module Square
|
|
303
299
|
# @return [CreateCustomerCardResponse Hash] response from the API call
|
304
300
|
def create_customer_card(customer_id:,
|
305
301
|
body:)
|
302
|
+
warn 'Endpoint create_customer_card in CustomersApi is deprecated'
|
306
303
|
# Prepare query url.
|
307
304
|
_query_builder = config.get_base_uri
|
308
305
|
_query_builder << '/v2/customers/{customer_id}/cards'
|
@@ -343,6 +340,7 @@ module Square
|
|
343
340
|
# @return [DeleteCustomerCardResponse Hash] response from the API call
|
344
341
|
def delete_customer_card(customer_id:,
|
345
342
|
card_id:)
|
343
|
+
warn 'Endpoint delete_customer_card in CustomersApi is deprecated'
|
346
344
|
# Prepare query url.
|
347
345
|
_query_builder = config.get_base_uri
|
348
346
|
_query_builder << '/v2/customers/{customer_id}/cards/{card_id}'
|
@@ -131,8 +131,14 @@ module Square
|
|
131
131
|
|
132
132
|
# Returns a list of evidence associated with a dispute.
|
133
133
|
# @param [String] dispute_id Required parameter: The ID of the dispute.
|
134
|
+
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
135
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
136
|
+
# set of results for the original query. For more information, see
|
137
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
138
|
+
# .
|
134
139
|
# @return [ListDisputeEvidenceResponse Hash] response from the API call
|
135
|
-
def list_dispute_evidence(dispute_id
|
140
|
+
def list_dispute_evidence(dispute_id:,
|
141
|
+
cursor: nil)
|
136
142
|
# Prepare query url.
|
137
143
|
_query_builder = config.get_base_uri
|
138
144
|
_query_builder << '/v2/disputes/{dispute_id}/evidence'
|
@@ -140,90 +146,9 @@ module Square
|
|
140
146
|
_query_builder,
|
141
147
|
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
142
148
|
)
|
143
|
-
|
144
|
-
|
145
|
-
# Prepare headers.
|
146
|
-
_headers = {
|
147
|
-
'accept' => 'application/json'
|
148
|
-
}
|
149
|
-
|
150
|
-
# Prepare and execute HttpRequest.
|
151
|
-
_request = config.http_client.get(
|
152
|
-
_query_url,
|
153
|
-
headers: _headers
|
154
|
-
)
|
155
|
-
OAuth2.apply(config, _request)
|
156
|
-
_response = execute_request(_request)
|
157
|
-
|
158
|
-
# Return appropriate response type.
|
159
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
160
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
161
|
-
ApiResponse.new(
|
162
|
-
_response, data: decoded, errors: _errors
|
163
|
-
)
|
164
|
-
end
|
165
|
-
|
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]($e/Disputes/SubmitEvidence).
|
171
|
-
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
172
|
-
# want to remove evidence from.
|
173
|
-
# @param [String] evidence_id Required parameter: The ID of the evidence you
|
174
|
-
# want to remove.
|
175
|
-
# @return [RemoveDisputeEvidenceResponse Hash] response from the API call
|
176
|
-
def remove_dispute_evidence(dispute_id:,
|
177
|
-
evidence_id:)
|
178
|
-
# Prepare query url.
|
179
|
-
_query_builder = config.get_base_uri
|
180
|
-
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
181
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
182
|
-
_query_builder,
|
183
|
-
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
184
|
-
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
185
|
-
)
|
186
|
-
_query_url = APIHelper.clean_url _query_builder
|
187
|
-
|
188
|
-
# Prepare headers.
|
189
|
-
_headers = {
|
190
|
-
'accept' => 'application/json'
|
191
|
-
}
|
192
|
-
|
193
|
-
# Prepare and execute HttpRequest.
|
194
|
-
_request = config.http_client.delete(
|
195
|
-
_query_url,
|
196
|
-
headers: _headers
|
197
|
-
)
|
198
|
-
OAuth2.apply(config, _request)
|
199
|
-
_response = execute_request(_request)
|
200
|
-
|
201
|
-
# Return appropriate response type.
|
202
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
203
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
204
|
-
ApiResponse.new(
|
205
|
-
_response, data: decoded, errors: _errors
|
206
|
-
)
|
207
|
-
end
|
208
|
-
|
209
|
-
# Returns the specific evidence metadata associated with a specific dispute.
|
210
|
-
# You must maintain a copy of the evidence you upload if you want to
|
211
|
-
# reference it later. You cannot
|
212
|
-
# download the evidence after you upload it.
|
213
|
-
# @param [String] dispute_id Required parameter: The ID of the dispute that
|
214
|
-
# you want to retrieve evidence from.
|
215
|
-
# @param [String] evidence_id Required parameter: The ID of the evidence to
|
216
|
-
# retrieve.
|
217
|
-
# @return [RetrieveDisputeEvidenceResponse Hash] response from the API call
|
218
|
-
def retrieve_dispute_evidence(dispute_id:,
|
219
|
-
evidence_id:)
|
220
|
-
# Prepare query url.
|
221
|
-
_query_builder = config.get_base_uri
|
222
|
-
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
223
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
149
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
224
150
|
_query_builder,
|
225
|
-
'
|
226
|
-
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
151
|
+
'cursor' => cursor
|
227
152
|
)
|
228
153
|
_query_url = APIHelper.clean_url _query_builder
|
229
154
|
|
@@ -263,7 +188,7 @@ module Square
|
|
263
188
|
image_file: nil)
|
264
189
|
# Prepare query url.
|
265
190
|
_query_builder = config.get_base_uri
|
266
|
-
_query_builder << '/v2/disputes/{dispute_id}/
|
191
|
+
_query_builder << '/v2/disputes/{dispute_id}/evidence-files'
|
267
192
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
268
193
|
_query_builder,
|
269
194
|
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
@@ -324,7 +249,7 @@ module Square
|
|
324
249
|
body:)
|
325
250
|
# Prepare query url.
|
326
251
|
_query_builder = config.get_base_uri
|
327
|
-
_query_builder << '/v2/disputes/{dispute_id}/
|
252
|
+
_query_builder << '/v2/disputes/{dispute_id}/evidence-text'
|
328
253
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
329
254
|
_query_builder,
|
330
255
|
'dispute_id' => { 'value' => dispute_id, 'encode' => true }
|
@@ -354,6 +279,92 @@ module Square
|
|
354
279
|
)
|
355
280
|
end
|
356
281
|
|
282
|
+
# Removes specified evidence from a dispute.
|
283
|
+
# Square does not send the bank any evidence that is removed. Also, you
|
284
|
+
# cannot remove evidence after
|
285
|
+
# submitting it to the bank using
|
286
|
+
# [SubmitEvidence]($e/Disputes/SubmitEvidence).
|
287
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
288
|
+
# want to remove evidence from.
|
289
|
+
# @param [String] evidence_id Required parameter: The ID of the evidence you
|
290
|
+
# want to remove.
|
291
|
+
# @return [DeleteDisputeEvidenceResponse Hash] response from the API call
|
292
|
+
def delete_dispute_evidence(dispute_id:,
|
293
|
+
evidence_id:)
|
294
|
+
# Prepare query url.
|
295
|
+
_query_builder = config.get_base_uri
|
296
|
+
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
297
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
298
|
+
_query_builder,
|
299
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
300
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
301
|
+
)
|
302
|
+
_query_url = APIHelper.clean_url _query_builder
|
303
|
+
|
304
|
+
# Prepare headers.
|
305
|
+
_headers = {
|
306
|
+
'accept' => 'application/json'
|
307
|
+
}
|
308
|
+
|
309
|
+
# Prepare and execute HttpRequest.
|
310
|
+
_request = config.http_client.delete(
|
311
|
+
_query_url,
|
312
|
+
headers: _headers
|
313
|
+
)
|
314
|
+
OAuth2.apply(config, _request)
|
315
|
+
_response = execute_request(_request)
|
316
|
+
|
317
|
+
# Return appropriate response type.
|
318
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
319
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
320
|
+
ApiResponse.new(
|
321
|
+
_response, data: decoded, errors: _errors
|
322
|
+
)
|
323
|
+
end
|
324
|
+
|
325
|
+
# Returns the evidence metadata specified by the evidence ID in the request
|
326
|
+
# URL path
|
327
|
+
# You must maintain a copy of the evidence you upload if you want to
|
328
|
+
# reference it later. You cannot
|
329
|
+
# download the evidence after you upload it.
|
330
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute that
|
331
|
+
# you want to retrieve evidence from.
|
332
|
+
# @param [String] evidence_id Required parameter: The ID of the evidence to
|
333
|
+
# retrieve.
|
334
|
+
# @return [RetrieveDisputeEvidenceResponse Hash] response from the API call
|
335
|
+
def retrieve_dispute_evidence(dispute_id:,
|
336
|
+
evidence_id:)
|
337
|
+
# Prepare query url.
|
338
|
+
_query_builder = config.get_base_uri
|
339
|
+
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
340
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
341
|
+
_query_builder,
|
342
|
+
'dispute_id' => { 'value' => dispute_id, 'encode' => true },
|
343
|
+
'evidence_id' => { 'value' => evidence_id, 'encode' => true }
|
344
|
+
)
|
345
|
+
_query_url = APIHelper.clean_url _query_builder
|
346
|
+
|
347
|
+
# Prepare headers.
|
348
|
+
_headers = {
|
349
|
+
'accept' => 'application/json'
|
350
|
+
}
|
351
|
+
|
352
|
+
# Prepare and execute HttpRequest.
|
353
|
+
_request = config.http_client.get(
|
354
|
+
_query_url,
|
355
|
+
headers: _headers
|
356
|
+
)
|
357
|
+
OAuth2.apply(config, _request)
|
358
|
+
_response = execute_request(_request)
|
359
|
+
|
360
|
+
# Return appropriate response type.
|
361
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
362
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
363
|
+
ApiResponse.new(
|
364
|
+
_response, data: decoded, errors: _errors
|
365
|
+
)
|
366
|
+
end
|
367
|
+
|
357
368
|
# Submits evidence to the cardholder's bank.
|
358
369
|
# Before submitting evidence, Square compiles all available evidence. This
|
359
370
|
# includes evidence uploaded
|