square.rb 10.0.0.20210421 → 13.0.0.20210721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/lib/square.rb +6 -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 +8 -5
- 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/inventory_api.rb +244 -5
- data/lib/square/api/loyalty_api.rb +24 -8
- data/lib/square/api/o_auth_api.rb +8 -9
- data/lib/square/api/orders_api.rb +27 -27
- data/lib/square/api/sites_api.rb +42 -0
- data/lib/square/api/snippets_api.rb +146 -0
- data/lib/square/api/team_api.rb +30 -30
- data/lib/square/api/transactions_api.rb +3 -2
- data/lib/square/api/v1_transactions_api.rb +9 -0
- data/lib/square/api_helper.rb +0 -12
- data/lib/square/client.rb +37 -3
- data/lib/square/configuration.rb +23 -8
- data/lib/square/http/faraday_client.rb +5 -2
- data/lib/square/utilities/date_time_helper.rb +151 -0
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f0db97e9e88ea1a9f5f7f9db716b8f2ce36473400c34f57ec01622e2b0b584b
|
4
|
+
data.tar.gz: 999b75d8c4ded30c3895d6cecf97d18883a6018ec9b79a53b85f1bed20f56de4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a74a9814e8d3d9edb5f9a36439c85f41c593f91941a3938c869b602b8fa65f2cf1ce6b115f43ed65c6a76ec6d36c8e237a5f855e3d12dbe90f6c906c9c7390d
|
7
|
+
data.tar.gz: a9d2ecd07e5616d2341b095519414007ab0e4bfc5159a90e3fb7e4b9d6337add73859641da52ccda4ee4bffb8ea39a59a37f487638c931f75c0ab1c77bb4dbce
|
data/README.md
CHANGED
@@ -73,9 +73,13 @@ gem 'square.rb'
|
|
73
73
|
### Financials
|
74
74
|
* [Bank Accounts]
|
75
75
|
|
76
|
+
### Online
|
77
|
+
* [Sites]
|
78
|
+
* [Snippets]
|
79
|
+
|
76
80
|
### Authorization APIs
|
77
81
|
* [Mobile Authorization]
|
78
|
-
* [
|
82
|
+
* [OAuth]
|
79
83
|
|
80
84
|
### Deprecated APIs
|
81
85
|
* [V1 Employees]
|
@@ -322,8 +326,10 @@ You can also use the Square API to create applications or services that work wit
|
|
322
326
|
[Refunds]: doc/api/refunds.md
|
323
327
|
[Subscriptions]: doc/api/subscriptions.md
|
324
328
|
[Mobile Authorization]: doc/api/mobile-authorization.md
|
325
|
-
[
|
329
|
+
[OAuth]: doc/api/o-auth.md
|
326
330
|
[V1 Employees]: doc/api/v1-employees.md
|
327
331
|
[V1 Transactions]: doc/api/v1-transactions.md
|
328
332
|
[V1 Items]: doc/api/v1-items.md
|
329
333
|
[Transactions]: doc/api/transactions.md
|
334
|
+
[Sites]: doc/api/sites.md
|
335
|
+
[Snippets]: doc/api/snippets.md
|
data/lib/square.rb
CHANGED
@@ -9,6 +9,7 @@ require_relative 'square/client.rb'
|
|
9
9
|
|
10
10
|
# Utilities
|
11
11
|
require_relative 'square/utilities/file_wrapper.rb'
|
12
|
+
require_relative 'square/utilities/date_time_helper.rb'
|
12
13
|
|
13
14
|
# Http
|
14
15
|
require_relative 'square/http/api_response.rb'
|
@@ -36,6 +37,7 @@ require_relative 'square/api/v1_transactions_api.rb'
|
|
36
37
|
require_relative 'square/api/apple_pay_api.rb'
|
37
38
|
require_relative 'square/api/bank_accounts_api.rb'
|
38
39
|
require_relative 'square/api/bookings_api.rb'
|
40
|
+
require_relative 'square/api/cards_api.rb'
|
39
41
|
require_relative 'square/api/cash_drawers_api.rb'
|
40
42
|
require_relative 'square/api/catalog_api.rb'
|
41
43
|
require_relative 'square/api/customers_api.rb'
|
@@ -44,6 +46,8 @@ require_relative 'square/api/customer_segments_api.rb'
|
|
44
46
|
require_relative 'square/api/devices_api.rb'
|
45
47
|
require_relative 'square/api/disputes_api.rb'
|
46
48
|
require_relative 'square/api/employees_api.rb'
|
49
|
+
require_relative 'square/api/gift_cards_api.rb'
|
50
|
+
require_relative 'square/api/gift_card_activities_api.rb'
|
47
51
|
require_relative 'square/api/inventory_api.rb'
|
48
52
|
require_relative 'square/api/invoices_api.rb'
|
49
53
|
require_relative 'square/api/labor_api.rb'
|
@@ -55,6 +59,8 @@ require_relative 'square/api/merchants_api.rb'
|
|
55
59
|
require_relative 'square/api/orders_api.rb'
|
56
60
|
require_relative 'square/api/payments_api.rb'
|
57
61
|
require_relative 'square/api/refunds_api.rb'
|
62
|
+
require_relative 'square/api/sites_api.rb'
|
63
|
+
require_relative 'square/api/snippets_api.rb'
|
58
64
|
require_relative 'square/api/subscriptions_api.rb'
|
59
65
|
require_relative 'square/api/team_api.rb'
|
60
66
|
require_relative 'square/api/terminal_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
|
@@ -241,14 +241,17 @@ module Square
|
|
241
241
|
# [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
|
242
242
|
# and set the `include_deleted_objects` attribute value to `true`.
|
243
243
|
# @param [String] cursor Optional parameter: The pagination cursor returned
|
244
|
-
# in the previous response. Leave unset for an initial request.
|
244
|
+
# in the previous response. Leave unset for an initial request. The page
|
245
|
+
# size is currently set to be 100. See
|
245
246
|
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
246
247
|
# for more information.
|
247
248
|
# @param [String] types Optional parameter: An optional case-insensitive,
|
248
|
-
# comma-separated list of object types to retrieve
|
249
|
-
#
|
250
|
-
#
|
251
|
-
# `
|
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.
|
252
255
|
# @param [Long] catalog_version Optional parameter: The specific version of
|
253
256
|
# the catalog objects to be included in the response. This allows you to
|
254
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
|