square.rb 4.1.0.20200122 → 5.0.0.20200226
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/lib/square/api/bank_accounts_api.rb +136 -0
- data/lib/square/api/base_api.rb +2 -2
- data/lib/square/api/catalog_api.rb +10 -2
- data/lib/square/api/disputes_api.rb +408 -0
- data/lib/square/api/payments_api.rb +14 -12
- data/lib/square/api/transactions_api.rb +63 -0
- data/lib/square/api/v1_employees_api.rb +82 -1
- data/lib/square/api/v1_transactions_api.rb +20 -0
- data/lib/square/client.rb +14 -2
- data/lib/square/http/faraday_client.rb +2 -6
- data/lib/square/utilities/file_wrapper.rb +12 -0
- data/lib/square.rb +5 -0
- data/spec/user_journey_spec.rb +5 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db64adc1deef73ef00086f17ac38e54e342472456ebc04cee8b64e691c5ea3a
|
4
|
+
data.tar.gz: bd4ee35fcc7bc37b6a37d7f071b6e9bce6091088879bbf1c9a4b3b6d67de3553
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bc48e30881676a19e52933b16fd57d02bb990fcafd282969f010412d31b8296c2511288cb478cb545f418959e8206847d31d53127fc6311f14ebc731ad0a3a9
|
7
|
+
data.tar.gz: 2f6af98a925f9304a1e7c833c3a637bea22329099cba3cf09656cd92bada279c7f8cf3f0d14c08faba2026f6ef777a5dbb1a119477107f6d7b7f403b795f2635
|
@@ -0,0 +1,136 @@
|
|
1
|
+
module Square
|
2
|
+
# BankAccountsApi
|
3
|
+
class BankAccountsApi < BaseApi
|
4
|
+
def initialize(config, http_call_back: nil)
|
5
|
+
super(config, http_call_back: http_call_back)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Returns a list of [BankAccount](#type-bankaccount) objects linked to a
|
9
|
+
# Square account.
|
10
|
+
# For more information, see
|
11
|
+
# [Bank Accounts
|
12
|
+
# API](https://developer.squareup.com/docs/docs/bank-accounts-api).
|
13
|
+
# @param [String] cursor Optional parameter: The pagination cursor returned
|
14
|
+
# by a previous call to this endpoint. Use it in the next `ListBankAccounts`
|
15
|
+
# request to retrieve the next set of results. See the
|
16
|
+
# [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pa
|
17
|
+
# gination) guide for more information.
|
18
|
+
# @param [Integer] limit Optional parameter: Upper limit on the number of
|
19
|
+
# bank accounts to return in the response. Currently, 1000 is the largest
|
20
|
+
# supported limit. You can specify a limit of up to 1000 bank accounts.
|
21
|
+
# This is also the default limit.
|
22
|
+
# @param [String] location_id Optional parameter: Location ID. You can
|
23
|
+
# specify this optional filter to retrieve only the linked bank accounts
|
24
|
+
# belonging to a specific location.
|
25
|
+
# @return [ListBankAccountsResponse Hash] response from the API call
|
26
|
+
def list_bank_accounts(cursor: nil,
|
27
|
+
limit: nil,
|
28
|
+
location_id: nil)
|
29
|
+
# Prepare query url.
|
30
|
+
_query_builder = config.get_base_uri
|
31
|
+
_query_builder << '/v2/bank-accounts'
|
32
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
33
|
+
_query_builder,
|
34
|
+
'cursor' => cursor,
|
35
|
+
'limit' => limit,
|
36
|
+
'location_id' => location_id
|
37
|
+
)
|
38
|
+
_query_url = APIHelper.clean_url _query_builder
|
39
|
+
|
40
|
+
# Prepare headers.
|
41
|
+
_headers = {
|
42
|
+
'accept' => 'application/json'
|
43
|
+
}
|
44
|
+
|
45
|
+
# Prepare and execute HttpRequest.
|
46
|
+
_request = config.http_client.get(
|
47
|
+
_query_url,
|
48
|
+
headers: _headers
|
49
|
+
)
|
50
|
+
OAuth2.apply(config, _request)
|
51
|
+
_response = execute_request(_request)
|
52
|
+
|
53
|
+
# Return appropriate response type.
|
54
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
55
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
56
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Returns details of a [BankAccount](#type-bankaccount) identified by V1
|
60
|
+
# bank account ID.
|
61
|
+
# For more information, see
|
62
|
+
# [Retrieve a bank account by using an ID issued by V1 Bank Accounts
|
63
|
+
# API](https://developer.squareup.com/docs/docs/bank-accounts-api#retrieve-a
|
64
|
+
# -bank-account-by-using-an-id-issued-by-the-v1-bank-accounts-api).
|
65
|
+
# @param [String] v1_bank_account_id Required parameter: Connect V1 ID of
|
66
|
+
# the desired `BankAccount`. For more information, see [Retrieve a bank
|
67
|
+
# account by using an ID issued by V1 Bank Accounts
|
68
|
+
# API](https://developer.squareup.com/docs/docs/bank-accounts-api#retrieve-a
|
69
|
+
# -bank-account-by-using-an-id-issued-by-v1-bank-accounts-api).
|
70
|
+
# @return [GetBankAccountByV1IdResponse Hash] response from the API call
|
71
|
+
def get_bank_account_by_v1_id(v1_bank_account_id:)
|
72
|
+
# Prepare query url.
|
73
|
+
_query_builder = config.get_base_uri
|
74
|
+
_query_builder << '/v2/bank-accounts/by-v1-id/{v1_bank_account_id}'
|
75
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
76
|
+
_query_builder,
|
77
|
+
'v1_bank_account_id' => v1_bank_account_id
|
78
|
+
)
|
79
|
+
_query_url = APIHelper.clean_url _query_builder
|
80
|
+
|
81
|
+
# Prepare headers.
|
82
|
+
_headers = {
|
83
|
+
'accept' => 'application/json'
|
84
|
+
}
|
85
|
+
|
86
|
+
# Prepare and execute HttpRequest.
|
87
|
+
_request = config.http_client.get(
|
88
|
+
_query_url,
|
89
|
+
headers: _headers
|
90
|
+
)
|
91
|
+
OAuth2.apply(config, _request)
|
92
|
+
_response = execute_request(_request)
|
93
|
+
|
94
|
+
# Return appropriate response type.
|
95
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
96
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
97
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Returns details of a [BankAccount](#type-bankaccount)
|
101
|
+
# linked to a Square account. For more information, see
|
102
|
+
# [Bank Accounts
|
103
|
+
# API](https://developer.squareup.com/docs/docs/bank-accounts-api).
|
104
|
+
# @param [String] bank_account_id Required parameter: Square-issued ID of
|
105
|
+
# the desired `BankAccount`.
|
106
|
+
# @return [GetBankAccountResponse Hash] response from the API call
|
107
|
+
def get_bank_account(bank_account_id:)
|
108
|
+
# Prepare query url.
|
109
|
+
_query_builder = config.get_base_uri
|
110
|
+
_query_builder << '/v2/bank-accounts/{bank_account_id}'
|
111
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
112
|
+
_query_builder,
|
113
|
+
'bank_account_id' => bank_account_id
|
114
|
+
)
|
115
|
+
_query_url = APIHelper.clean_url _query_builder
|
116
|
+
|
117
|
+
# Prepare headers.
|
118
|
+
_headers = {
|
119
|
+
'accept' => 'application/json'
|
120
|
+
}
|
121
|
+
|
122
|
+
# Prepare and execute HttpRequest.
|
123
|
+
_request = config.http_client.get(
|
124
|
+
_query_url,
|
125
|
+
headers: _headers
|
126
|
+
)
|
127
|
+
OAuth2.apply(config, _request)
|
128
|
+
_response = execute_request(_request)
|
129
|
+
|
130
|
+
# Return appropriate response type.
|
131
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
132
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
133
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
data/lib/square/api/base_api.rb
CHANGED
@@ -8,8 +8,8 @@ module Square
|
|
8
8
|
@http_call_back = http_call_back
|
9
9
|
|
10
10
|
@global_headers = {
|
11
|
-
'user-agent' => 'Square-Ruby-SDK/
|
12
|
-
'Square-Version' => '2020-
|
11
|
+
'user-agent' => 'Square-Ruby-SDK/5.0.0.20200226',
|
12
|
+
'Square-Version' => '2020-02-26'
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
@@ -181,6 +181,14 @@ module Square
|
|
181
181
|
_query_builder << '/v2/catalog/images'
|
182
182
|
_query_url = APIHelper.clean_url _query_builder
|
183
183
|
|
184
|
+
if image_file.is_a? FileWrapper
|
185
|
+
image_file_wrapper = image_file.file
|
186
|
+
image_file_content_type = image_file.content_type
|
187
|
+
else
|
188
|
+
image_file_wrapper = image_file
|
189
|
+
image_file_content_type = 'image/jpeg'
|
190
|
+
end
|
191
|
+
|
184
192
|
# Prepare headers.
|
185
193
|
_headers = {
|
186
194
|
'accept' => 'application/json'
|
@@ -193,8 +201,8 @@ module Square
|
|
193
201
|
'application/json'
|
194
202
|
),
|
195
203
|
'image_file' => Faraday::UploadIO.new(
|
196
|
-
|
197
|
-
|
204
|
+
image_file_wrapper,
|
205
|
+
image_file_content_type
|
198
206
|
)
|
199
207
|
}
|
200
208
|
_parameters = APIHelper.form_encode_parameters(_parameters)
|
@@ -0,0 +1,408 @@
|
|
1
|
+
module Square
|
2
|
+
# DisputesApi
|
3
|
+
class DisputesApi < BaseApi
|
4
|
+
def initialize(config, http_call_back: nil)
|
5
|
+
super(config, http_call_back: http_call_back)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Returns a list of disputes associated
|
9
|
+
# with a particular account.
|
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 the original query. For more information, see
|
13
|
+
# [Paginating](https://developer.squareup.com/docs/basics/api101/pagination)
|
14
|
+
# .
|
15
|
+
# @param [DisputeState] states Optional parameter: The dispute states to
|
16
|
+
# filter the result. If not specified, the endpoint returns all open
|
17
|
+
# disputes (dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`).
|
18
|
+
# @param [String] location_id Optional parameter: The ID of the location for
|
19
|
+
# which to return a list of disputes. If not specified, the endpoint
|
20
|
+
# returns all open disputes (dispute status is not `INQUIRY_CLOSED`, `WON`,
|
21
|
+
# or `LOST`) associated with all locations.
|
22
|
+
# @return [ListDisputesResponse Hash] response from the API call
|
23
|
+
def list_disputes(cursor: nil,
|
24
|
+
states: nil,
|
25
|
+
location_id: nil)
|
26
|
+
# Prepare query url.
|
27
|
+
_query_builder = config.get_base_uri
|
28
|
+
_query_builder << '/v2/disputes'
|
29
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
30
|
+
_query_builder,
|
31
|
+
'cursor' => cursor,
|
32
|
+
'states' => states,
|
33
|
+
'location_id' => location_id
|
34
|
+
)
|
35
|
+
_query_url = APIHelper.clean_url _query_builder
|
36
|
+
|
37
|
+
# Prepare headers.
|
38
|
+
_headers = {
|
39
|
+
'accept' => 'application/json'
|
40
|
+
}
|
41
|
+
|
42
|
+
# Prepare and execute HttpRequest.
|
43
|
+
_request = config.http_client.get(
|
44
|
+
_query_url,
|
45
|
+
headers: _headers
|
46
|
+
)
|
47
|
+
OAuth2.apply(config, _request)
|
48
|
+
_response = execute_request(_request)
|
49
|
+
|
50
|
+
# Return appropriate response type.
|
51
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
52
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
53
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns details of a specific dispute.
|
57
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
58
|
+
# want more details about.
|
59
|
+
# @return [RetrieveDisputeResponse Hash] response from the API call
|
60
|
+
def retrieve_dispute(dispute_id:)
|
61
|
+
# Prepare query url.
|
62
|
+
_query_builder = config.get_base_uri
|
63
|
+
_query_builder << '/v2/disputes/{dispute_id}'
|
64
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
65
|
+
_query_builder,
|
66
|
+
'dispute_id' => dispute_id
|
67
|
+
)
|
68
|
+
_query_url = APIHelper.clean_url _query_builder
|
69
|
+
|
70
|
+
# Prepare headers.
|
71
|
+
_headers = {
|
72
|
+
'accept' => 'application/json'
|
73
|
+
}
|
74
|
+
|
75
|
+
# Prepare and execute HttpRequest.
|
76
|
+
_request = config.http_client.get(
|
77
|
+
_query_url,
|
78
|
+
headers: _headers
|
79
|
+
)
|
80
|
+
OAuth2.apply(config, _request)
|
81
|
+
_response = execute_request(_request)
|
82
|
+
|
83
|
+
# Return appropriate response type.
|
84
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
85
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
86
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Accepts loss on a dispute. Square returns
|
90
|
+
# the disputed amount to the cardholder and updates the
|
91
|
+
# dispute state to ACCEPTED.
|
92
|
+
# Square debits the disputed amount from the seller’s Square
|
93
|
+
# account. If the Square account balance does not have
|
94
|
+
# sufficient funds, Square debits the associated bank account.
|
95
|
+
# For an overview of the Disputes API, see
|
96
|
+
# [Overview](https://developer.squareup.com/docs/docs/disputes-api/overview)
|
97
|
+
# .
|
98
|
+
# @param [String] dispute_id Required parameter: ID of the dispute you want
|
99
|
+
# to accept.
|
100
|
+
# @return [AcceptDisputeResponse Hash] response from the API call
|
101
|
+
def accept_dispute(dispute_id:)
|
102
|
+
# Prepare query url.
|
103
|
+
_query_builder = config.get_base_uri
|
104
|
+
_query_builder << '/v2/disputes/{dispute_id}/accept'
|
105
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
106
|
+
_query_builder,
|
107
|
+
'dispute_id' => dispute_id
|
108
|
+
)
|
109
|
+
_query_url = APIHelper.clean_url _query_builder
|
110
|
+
|
111
|
+
# Prepare headers.
|
112
|
+
_headers = {
|
113
|
+
'accept' => 'application/json'
|
114
|
+
}
|
115
|
+
|
116
|
+
# Prepare and execute HttpRequest.
|
117
|
+
_request = config.http_client.post(
|
118
|
+
_query_url,
|
119
|
+
headers: _headers
|
120
|
+
)
|
121
|
+
OAuth2.apply(config, _request)
|
122
|
+
_response = execute_request(_request)
|
123
|
+
|
124
|
+
# Return appropriate response type.
|
125
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
126
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
127
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Returns a list of evidence associated with a dispute.
|
131
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute.
|
132
|
+
# @return [ListDisputeEvidenceResponse Hash] response from the API call
|
133
|
+
def list_dispute_evidence(dispute_id:)
|
134
|
+
# Prepare query url.
|
135
|
+
_query_builder = config.get_base_uri
|
136
|
+
_query_builder << '/v2/disputes/{dispute_id}/evidence'
|
137
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
138
|
+
_query_builder,
|
139
|
+
'dispute_id' => dispute_id
|
140
|
+
)
|
141
|
+
_query_url = APIHelper.clean_url _query_builder
|
142
|
+
|
143
|
+
# Prepare headers.
|
144
|
+
_headers = {
|
145
|
+
'accept' => 'application/json'
|
146
|
+
}
|
147
|
+
|
148
|
+
# Prepare and execute HttpRequest.
|
149
|
+
_request = config.http_client.get(
|
150
|
+
_query_url,
|
151
|
+
headers: _headers
|
152
|
+
)
|
153
|
+
OAuth2.apply(config, _request)
|
154
|
+
_response = execute_request(_request)
|
155
|
+
|
156
|
+
# Return appropriate response type.
|
157
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
158
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
159
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Removes specified evidence from a dispute.
|
163
|
+
# Square does not send the bank any evidence that
|
164
|
+
# is removed. Also, you cannot remove evidence after
|
165
|
+
# submitting it to the bank using
|
166
|
+
# [SubmitEvidence](https://developer.squareup.com/docs/reference/square/disp
|
167
|
+
# utes-api/submit-evidence).
|
168
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
169
|
+
# want to remove evidence from.
|
170
|
+
# @param [String] evidence_id Required parameter: The ID of the evidence you
|
171
|
+
# want to remove.
|
172
|
+
# @return [RemoveDisputeEvidenceResponse Hash] response from the API call
|
173
|
+
def remove_dispute_evidence(dispute_id:,
|
174
|
+
evidence_id:)
|
175
|
+
# Prepare query url.
|
176
|
+
_query_builder = config.get_base_uri
|
177
|
+
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
178
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
179
|
+
_query_builder,
|
180
|
+
'dispute_id' => dispute_id,
|
181
|
+
'evidence_id' => evidence_id
|
182
|
+
)
|
183
|
+
_query_url = APIHelper.clean_url _query_builder
|
184
|
+
|
185
|
+
# Prepare headers.
|
186
|
+
_headers = {
|
187
|
+
'accept' => 'application/json'
|
188
|
+
}
|
189
|
+
|
190
|
+
# Prepare and execute HttpRequest.
|
191
|
+
_request = config.http_client.delete(
|
192
|
+
_query_url,
|
193
|
+
headers: _headers
|
194
|
+
)
|
195
|
+
OAuth2.apply(config, _request)
|
196
|
+
_response = execute_request(_request)
|
197
|
+
|
198
|
+
# Return appropriate response type.
|
199
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
200
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
201
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
202
|
+
end
|
203
|
+
|
204
|
+
# Returns the specific evidence metadata associated with a specific dispute.
|
205
|
+
# You must maintain a copy of the evidence you upload if you want to
|
206
|
+
# reference it later. You cannot download the evidence
|
207
|
+
# after you upload it.
|
208
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute that
|
209
|
+
# you want to retrieve evidence from.
|
210
|
+
# @param [String] evidence_id Required parameter: The ID of the evidence to
|
211
|
+
# retrieve.
|
212
|
+
# @return [RetrieveDisputeEvidenceResponse Hash] response from the API call
|
213
|
+
def retrieve_dispute_evidence(dispute_id:,
|
214
|
+
evidence_id:)
|
215
|
+
# Prepare query url.
|
216
|
+
_query_builder = config.get_base_uri
|
217
|
+
_query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'
|
218
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
219
|
+
_query_builder,
|
220
|
+
'dispute_id' => dispute_id,
|
221
|
+
'evidence_id' => evidence_id
|
222
|
+
)
|
223
|
+
_query_url = APIHelper.clean_url _query_builder
|
224
|
+
|
225
|
+
# Prepare headers.
|
226
|
+
_headers = {
|
227
|
+
'accept' => 'application/json'
|
228
|
+
}
|
229
|
+
|
230
|
+
# Prepare and execute HttpRequest.
|
231
|
+
_request = config.http_client.get(
|
232
|
+
_query_url,
|
233
|
+
headers: _headers
|
234
|
+
)
|
235
|
+
OAuth2.apply(config, _request)
|
236
|
+
_response = execute_request(_request)
|
237
|
+
|
238
|
+
# Return appropriate response type.
|
239
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
240
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
241
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
242
|
+
end
|
243
|
+
|
244
|
+
# Uploads a file to use as evidence in a dispute challenge. The endpoint
|
245
|
+
# accepts
|
246
|
+
# HTTP multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG,
|
247
|
+
# and TIFF formats. The following is an example of such an HTTP request:
|
248
|
+
# ```
|
249
|
+
# curl -X POST \
|
250
|
+
# -H 'Accept: application/json' \
|
251
|
+
# -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \
|
252
|
+
# -H 'Content-Type: multipart/form-data' \
|
253
|
+
# -F 'evidence=@/path/to/file/filename.tiff' \
|
254
|
+
# -F 'request={ "idempotency_key":"{{UNIQUE_KEY}}",
|
255
|
+
# "evidence_type":"{{EVIDENCE_TYPE}}", "content_type":"image/tiff" }' \
|
256
|
+
# 'https://connect.squareup.com/v2/disputes/{{DISPUTE_ID}}/evidence_file'
|
257
|
+
# ```
|
258
|
+
# For more information, see [Challenge a
|
259
|
+
# Dispute](https://developer.squareup.com/docs/docs/disputes-api/process-dis
|
260
|
+
# putes#challenge-a-dispute).
|
261
|
+
# @param [String] dispute_id Required parameter: ID of the dispute you want
|
262
|
+
# to upload evidence for.
|
263
|
+
# @param [CreateDisputeEvidenceFileRequest] request Optional parameter:
|
264
|
+
# Defines parameters for a CreateDisputeEvidenceFile request.
|
265
|
+
# @param [File | UploadIO] image_file Optional parameter: Example:
|
266
|
+
# @return [CreateDisputeEvidenceFileResponse Hash] response from the API call
|
267
|
+
def create_dispute_evidence_file(dispute_id:,
|
268
|
+
request: nil,
|
269
|
+
image_file: nil)
|
270
|
+
# Prepare query url.
|
271
|
+
_query_builder = config.get_base_uri
|
272
|
+
_query_builder << '/v2/disputes/{dispute_id}/evidence_file'
|
273
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
274
|
+
_query_builder,
|
275
|
+
'dispute_id' => dispute_id
|
276
|
+
)
|
277
|
+
_query_url = APIHelper.clean_url _query_builder
|
278
|
+
|
279
|
+
if image_file.is_a? FileWrapper
|
280
|
+
image_file_wrapper = image_file.file
|
281
|
+
image_file_content_type = image_file.content_type
|
282
|
+
else
|
283
|
+
image_file_wrapper = image_file
|
284
|
+
image_file_content_type = 'image/jpeg'
|
285
|
+
end
|
286
|
+
|
287
|
+
# Prepare headers.
|
288
|
+
_headers = {
|
289
|
+
'accept' => 'application/json'
|
290
|
+
}
|
291
|
+
|
292
|
+
# Prepare form parameters.
|
293
|
+
_parameters = {
|
294
|
+
'request' => Faraday::UploadIO.new(
|
295
|
+
StringIO.new(request.to_json),
|
296
|
+
'application/json'
|
297
|
+
),
|
298
|
+
'image_file' => Faraday::UploadIO.new(
|
299
|
+
image_file_wrapper,
|
300
|
+
image_file_content_type
|
301
|
+
)
|
302
|
+
}
|
303
|
+
_parameters = APIHelper.form_encode_parameters(_parameters)
|
304
|
+
|
305
|
+
# Prepare and execute HttpRequest.
|
306
|
+
_request = config.http_client.post(
|
307
|
+
_query_url,
|
308
|
+
headers: _headers,
|
309
|
+
parameters: _parameters
|
310
|
+
)
|
311
|
+
OAuth2.apply(config, _request)
|
312
|
+
_response = execute_request(_request)
|
313
|
+
|
314
|
+
# Return appropriate response type.
|
315
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
316
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
317
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
318
|
+
end
|
319
|
+
|
320
|
+
# Uploads text to use as evidence for a dispute challenge. For more
|
321
|
+
# information, see
|
322
|
+
# [Challenge a
|
323
|
+
# Dispute](https://developer.squareup.com/docs/docs/disputes-api/process-dis
|
324
|
+
# putes#challenge-a-dispute).
|
325
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
326
|
+
# want to upload evidence for.
|
327
|
+
# @param [CreateDisputeEvidenceTextRequest] body Required parameter: An
|
328
|
+
# object containing the fields to POST for the request. See the
|
329
|
+
# corresponding object definition for field details.
|
330
|
+
# @return [CreateDisputeEvidenceTextResponse Hash] response from the API call
|
331
|
+
def create_dispute_evidence_text(dispute_id:,
|
332
|
+
body:)
|
333
|
+
# Prepare query url.
|
334
|
+
_query_builder = config.get_base_uri
|
335
|
+
_query_builder << '/v2/disputes/{dispute_id}/evidence_text'
|
336
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
337
|
+
_query_builder,
|
338
|
+
'dispute_id' => dispute_id
|
339
|
+
)
|
340
|
+
_query_url = APIHelper.clean_url _query_builder
|
341
|
+
|
342
|
+
# Prepare headers.
|
343
|
+
_headers = {
|
344
|
+
'accept' => 'application/json',
|
345
|
+
'content-type' => 'application/json; charset=utf-8'
|
346
|
+
}
|
347
|
+
|
348
|
+
# Prepare and execute HttpRequest.
|
349
|
+
_request = config.http_client.post(
|
350
|
+
_query_url,
|
351
|
+
headers: _headers,
|
352
|
+
parameters: body.to_json
|
353
|
+
)
|
354
|
+
OAuth2.apply(config, _request)
|
355
|
+
_response = execute_request(_request)
|
356
|
+
|
357
|
+
# Return appropriate response type.
|
358
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
359
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
360
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
361
|
+
end
|
362
|
+
|
363
|
+
# Submits evidence to the cardholder's bank.
|
364
|
+
# Before submitting evidence, Square compiles all available evidence. This
|
365
|
+
# includes
|
366
|
+
# evidence uploaded using the
|
367
|
+
# [CreateDisputeEvidenceFile](https://developer.squareup.com/docs/reference/
|
368
|
+
# square/disputes-api/create-dispute-evidence-file) and
|
369
|
+
# [CreateDisputeEvidenceText](https://developer.squareup.com/docs/reference/
|
370
|
+
# square/disputes-api/create-dispute-evidence-text) endpoints,
|
371
|
+
# and evidence automatically provided by Square, when
|
372
|
+
# available. For more information, see
|
373
|
+
# [Challenge a
|
374
|
+
# Dispute](https://developer.squareup.com/docs/docs/disputes-api/process-dis
|
375
|
+
# putes#challenge-a-dispute).
|
376
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
377
|
+
# want to submit evidence for.
|
378
|
+
# @return [SubmitEvidenceResponse Hash] response from the API call
|
379
|
+
def submit_evidence(dispute_id:)
|
380
|
+
# Prepare query url.
|
381
|
+
_query_builder = config.get_base_uri
|
382
|
+
_query_builder << '/v2/disputes/{dispute_id}/submit-evidence'
|
383
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
384
|
+
_query_builder,
|
385
|
+
'dispute_id' => dispute_id
|
386
|
+
)
|
387
|
+
_query_url = APIHelper.clean_url _query_builder
|
388
|
+
|
389
|
+
# Prepare headers.
|
390
|
+
_headers = {
|
391
|
+
'accept' => 'application/json'
|
392
|
+
}
|
393
|
+
|
394
|
+
# Prepare and execute HttpRequest.
|
395
|
+
_request = config.http_client.post(
|
396
|
+
_query_url,
|
397
|
+
headers: _headers
|
398
|
+
)
|
399
|
+
OAuth2.apply(config, _request)
|
400
|
+
_response = execute_request(_request)
|
401
|
+
|
402
|
+
# Return appropriate response type.
|
403
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
404
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
405
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|
@@ -21,8 +21,9 @@ module Square
|
|
21
21
|
# results for the original query. See
|
22
22
|
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
23
23
|
# for more information.
|
24
|
-
# @param [String] location_id Optional parameter:
|
25
|
-
#
|
24
|
+
# @param [String] location_id Optional parameter: Limit results to the
|
25
|
+
# location supplied. By default, results are returned for all locations
|
26
|
+
# associated with the merchant.
|
26
27
|
# @param [Long] total Optional parameter: The exact amount in the
|
27
28
|
# total_money for a `Payment`.
|
28
29
|
# @param [String] last_4 Optional parameter: The last 4 digits of `Payment`
|
@@ -118,16 +119,17 @@ module Square
|
|
118
119
|
end
|
119
120
|
|
120
121
|
# Cancels (voids) a payment identified by the idempotency key that is
|
121
|
-
# specified in the
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
125
|
-
# you
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
122
|
+
# specified in the
|
123
|
+
# request.
|
124
|
+
# Use this method when status of a CreatePayment request is unknown. For
|
125
|
+
# example, after you send a
|
126
|
+
# CreatePayment request a network error occurs and you don't get a response.
|
127
|
+
# In this case, you can
|
128
|
+
# direct Square to cancel the payment using this endpoint. In the request,
|
129
|
+
# you provide the same
|
130
|
+
# idempotency key that you provided in your CreatePayment request you want
|
131
|
+
# to cancel. After
|
132
|
+
# cancelling the payment, you can submit your CreatePayment request again.
|
131
133
|
# Note that if no payment with the specified idempotency key is found, no
|
132
134
|
# action is taken, the end
|
133
135
|
# point returns successfully.
|
@@ -7,6 +7,15 @@ module Square
|
|
7
7
|
|
8
8
|
# Lists refunds for one of a business's locations.
|
9
9
|
# Deprecated - recommend using [SearchOrders](#endpoint-orders-searchorders)
|
10
|
+
# ---
|
11
|
+
# - __Deprecation date__: 2019-08-15
|
12
|
+
# - [__Retirement
|
13
|
+
# date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
|
14
|
+
# recated): 2021-09-01
|
15
|
+
# - [Migration
|
16
|
+
# guide](https://developer.squareup.com/docs/payments-api/migrate-from-trans
|
17
|
+
# actions-api)
|
18
|
+
# ---
|
10
19
|
# In addition to full or partial tender refunds processed through Square
|
11
20
|
# APIs,
|
12
21
|
# refunds may result from itemized returns or exchanges through Square's
|
@@ -75,6 +84,15 @@ module Square
|
|
75
84
|
|
76
85
|
# Lists transactions for a particular location.
|
77
86
|
# Deprecated - recommend using [SearchOrders](#endpoint-orders-searchorders)
|
87
|
+
# ---
|
88
|
+
# - __Deprecation date__: 2019-08-15
|
89
|
+
# - [__Retirement
|
90
|
+
# date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
|
91
|
+
# recated): 2021-09-01
|
92
|
+
# - [Migration
|
93
|
+
# guide](https://developer.squareup.com/docs/payments-api/migrate-from-trans
|
94
|
+
# actions-api)
|
95
|
+
# ---
|
78
96
|
# Transactions include payment information from sales and exchanges and
|
79
97
|
# refund
|
80
98
|
# information from returns and exchanges.
|
@@ -141,6 +159,15 @@ module Square
|
|
141
159
|
# Charges a card represented by a card nonce or a customer's card on file.
|
142
160
|
# Deprecated - recommend using
|
143
161
|
# [CreatePayment](#endpoint-payments-createpayment)
|
162
|
+
# ---
|
163
|
+
# - __Deprecation date__: 2019-08-15
|
164
|
+
# - [__Retirement
|
165
|
+
# date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
|
166
|
+
# recated): 2021-09-01
|
167
|
+
# - [Migration
|
168
|
+
# guide](https://developer.squareup.com/docs/payments-api/migrate-from-trans
|
169
|
+
# actions-api)
|
170
|
+
# ---
|
144
171
|
# Your request to this endpoint must include _either_:
|
145
172
|
# - A value for the `card_nonce` parameter (to charge a card nonce generated
|
146
173
|
# with the `SqPaymentForm`)
|
@@ -201,6 +228,15 @@ module Square
|
|
201
228
|
# Retrieves details for a single transaction.
|
202
229
|
# Deprecated - recommend using
|
203
230
|
# [BatchRetrieveOrders](#endpoint-batchretrieveorders)
|
231
|
+
# ---
|
232
|
+
# - __Deprecation date__: 2019-08-15
|
233
|
+
# - [__Retirement
|
234
|
+
# date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
|
235
|
+
# recated): 2021-09-01
|
236
|
+
# - [Migration
|
237
|
+
# guide](https://developer.squareup.com/docs/payments-api/migrate-from-trans
|
238
|
+
# actions-api)
|
239
|
+
# ---
|
204
240
|
# @param [String] location_id Required parameter: The ID of the
|
205
241
|
# transaction's associated location.
|
206
242
|
# @param [String] transaction_id Required parameter: The ID of the
|
@@ -241,6 +277,15 @@ module Square
|
|
241
277
|
# Captures a transaction that was created with the
|
242
278
|
# [Charge](#endpoint-charge)
|
243
279
|
# endpoint with a `delay_capture` value of `true`.
|
280
|
+
# ---
|
281
|
+
# - __Deprecation date__: 2019-08-15
|
282
|
+
# - [__Retirement
|
283
|
+
# date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
|
284
|
+
# recated): 2021-09-01
|
285
|
+
# - [Migration
|
286
|
+
# guide](https://developer.squareup.com/docs/payments-api/migrate-from-trans
|
287
|
+
# actions-api)
|
288
|
+
# ---
|
244
289
|
# See [Delayed capture
|
245
290
|
# transactions](https://developer.squareup.com/docs/payments/transactions/ov
|
246
291
|
# erview#delayed-capture)
|
@@ -283,6 +328,15 @@ module Square
|
|
283
328
|
# Initiates a refund for a previously charged tender.
|
284
329
|
# Deprecated - recommend using
|
285
330
|
# [RefundPayment](#endpoint-refunds-refundpayment)
|
331
|
+
# ---
|
332
|
+
# - __Deprecation date__: 2019-08-15
|
333
|
+
# - [__Retirement
|
334
|
+
# date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
|
335
|
+
# recated): 2021-09-01
|
336
|
+
# - [Migration
|
337
|
+
# guide](https://developer.squareup.com/docs/payments-api/migrate-from-trans
|
338
|
+
# actions-api)
|
339
|
+
# ---
|
286
340
|
# You must issue a refund within 120 days of the associated payment. See
|
287
341
|
# [this article](https://squareup.com/help/us/en/article/5060) for more
|
288
342
|
# information
|
@@ -335,6 +389,15 @@ module Square
|
|
335
389
|
|
336
390
|
# Cancels a transaction that was created with the [Charge](#endpoint-charge)
|
337
391
|
# endpoint with a `delay_capture` value of `true`.
|
392
|
+
# ---
|
393
|
+
# - __Deprecation date__: 2019-08-15
|
394
|
+
# - [__Retirement
|
395
|
+
# date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
|
396
|
+
# recated): 2021-09-01
|
397
|
+
# - [Migration
|
398
|
+
# guide](https://developer.squareup.com/docs/payments-api/migrate-from-trans
|
399
|
+
# actions-api)
|
400
|
+
# ---
|
338
401
|
# See [Delayed capture
|
339
402
|
# transactions](https://developer.squareup.com/docs/payments/transactions/ov
|
340
403
|
# erview#delayed-capture)
|
@@ -345,6 +345,15 @@ module Square
|
|
345
345
|
end
|
346
346
|
|
347
347
|
# Provides summary information for all of a business's employee timecards.
|
348
|
+
# ---
|
349
|
+
# - __Deprecation date__: 2020-02-26
|
350
|
+
# - [__Retirement
|
351
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
352
|
+
# e#deprecated): 2021-02-26
|
353
|
+
# - [Migration
|
354
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
355
|
+
# timecards)
|
356
|
+
# ---
|
348
357
|
# @param [SortOrder] order Optional parameter: The order in which timecards
|
349
358
|
# are listed in the response, based on their created_at field.
|
350
359
|
# @param [String] employee_id Optional parameter: If provided, the endpoint
|
@@ -389,6 +398,7 @@ module Square
|
|
389
398
|
deleted: nil,
|
390
399
|
limit: nil,
|
391
400
|
batch_token: nil)
|
401
|
+
warn 'Endpoint list_timecards in V1EmployeesApi is deprecated'
|
392
402
|
# Prepare query url.
|
393
403
|
_query_builder = config.get_base_uri
|
394
404
|
_query_builder << '/v1/me/timecards'
|
@@ -429,7 +439,17 @@ module Square
|
|
429
439
|
|
430
440
|
# Creates a timecard for an employee and clocks them in with an
|
431
441
|
# `API_CREATE` event and a `clockin_time` set to the current time unless
|
432
|
-
# the request provides a different value.
|
442
|
+
# the request provides a different value.
|
443
|
+
# ---
|
444
|
+
# - __Deprecation date__: 2020-02-26
|
445
|
+
# - [__Retirement
|
446
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
447
|
+
# e#deprecated): 2021-02-26
|
448
|
+
# - [Migration
|
449
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
450
|
+
# timecards)
|
451
|
+
# ---
|
452
|
+
# To import timecards from another
|
433
453
|
# system (rather than clocking someone in). Specify the `clockin_time`
|
434
454
|
# and* `clockout_time` in the request.
|
435
455
|
# Timecards correspond to exactly one shift for a given employee, bounded
|
@@ -442,6 +462,7 @@ module Square
|
|
442
462
|
# for field details.
|
443
463
|
# @return [V1Timecard Hash] response from the API call
|
444
464
|
def create_timecard(body:)
|
465
|
+
warn 'Endpoint create_timecard in V1EmployeesApi is deprecated'
|
445
466
|
# Prepare query url.
|
446
467
|
_query_builder = config.get_base_uri
|
447
468
|
_query_builder << '/v1/me/timecards'
|
@@ -472,6 +493,15 @@ module Square
|
|
472
493
|
# Square Dashboard. Deleted timecards are still accessible through
|
473
494
|
# Connect API endpoints, but cannot be modified. The `deleted` field of
|
474
495
|
# the `Timecard` object indicates whether the timecard has been deleted.
|
496
|
+
# ---
|
497
|
+
# - __Deprecation date__: 2020-02-26
|
498
|
+
# - [__Retirement
|
499
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
500
|
+
# e#deprecated): 2021-02-26
|
501
|
+
# - [Migration
|
502
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
503
|
+
# timecards)
|
504
|
+
# ---
|
475
505
|
# *Note**: By default, deleted timecards appear alongside valid timecards in
|
476
506
|
# results returned by the
|
477
507
|
# [ListTimecards](#endpoint-v1employees-listtimecards)
|
@@ -486,6 +516,7 @@ module Square
|
|
486
516
|
# delete.
|
487
517
|
# @return [Object] response from the API call
|
488
518
|
def delete_timecard(timecard_id:)
|
519
|
+
warn 'Endpoint delete_timecard in V1EmployeesApi is deprecated'
|
489
520
|
# Prepare query url.
|
490
521
|
_query_builder = config.get_base_uri
|
491
522
|
_query_builder << '/v1/me/timecards/{timecard_id}'
|
@@ -507,6 +538,15 @@ module Square
|
|
507
538
|
end
|
508
539
|
|
509
540
|
# Provides the details for a single timecard.
|
541
|
+
# ---
|
542
|
+
# - __Deprecation date__: 2020-02-26
|
543
|
+
# - [__Retirement
|
544
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
545
|
+
# e#deprecated): 2021-02-26
|
546
|
+
# - [Migration
|
547
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
548
|
+
# timecards)
|
549
|
+
# ---
|
510
550
|
# <aside>
|
511
551
|
# Only approved accounts can manage their employees with Square.
|
512
552
|
# Unapproved accounts cannot use employee management features with the
|
@@ -515,6 +555,7 @@ module Square
|
|
515
555
|
# @param [String] timecard_id Required parameter: The timecard's ID.
|
516
556
|
# @return [V1Timecard Hash] response from the API call
|
517
557
|
def retrieve_timecard(timecard_id:)
|
558
|
+
warn 'Endpoint retrieve_timecard in V1EmployeesApi is deprecated'
|
518
559
|
# Prepare query url.
|
519
560
|
_query_builder = config.get_base_uri
|
520
561
|
_query_builder << '/v1/me/timecards/{timecard_id}'
|
@@ -546,6 +587,15 @@ module Square
|
|
546
587
|
# Modifies the details of a timecard with an `API_EDIT` event for
|
547
588
|
# the timecard. Updating an active timecard with a `clockout_time`
|
548
589
|
# clocks the employee out.
|
590
|
+
# ---
|
591
|
+
# - __Deprecation date__: 2020-02-26
|
592
|
+
# - [__Retirement
|
593
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
594
|
+
# e#deprecated): 2021-02-26
|
595
|
+
# - [Migration
|
596
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
597
|
+
# timecards)
|
598
|
+
# ---
|
549
599
|
# @param [String] timecard_id Required parameter: TThe ID of the timecard to
|
550
600
|
# modify.
|
551
601
|
# @param [V1Timecard] body Required parameter: An object containing the
|
@@ -554,6 +604,7 @@ module Square
|
|
554
604
|
# @return [V1Timecard Hash] response from the API call
|
555
605
|
def update_timecard(timecard_id:,
|
556
606
|
body:)
|
607
|
+
warn 'Endpoint update_timecard in V1EmployeesApi is deprecated'
|
557
608
|
# Prepare query url.
|
558
609
|
_query_builder = config.get_base_uri
|
559
610
|
_query_builder << '/v1/me/timecards/{timecard_id}'
|
@@ -586,6 +637,15 @@ module Square
|
|
586
637
|
|
587
638
|
# Provides summary information for all events associated with a
|
588
639
|
# particular timecard.
|
640
|
+
# ---
|
641
|
+
# - __Deprecation date__: 2020-02-26
|
642
|
+
# - [__Retirement
|
643
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
644
|
+
# e#deprecated): 2021-02-26
|
645
|
+
# - [Migration
|
646
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
647
|
+
# timecards)
|
648
|
+
# ---
|
589
649
|
# <aside>
|
590
650
|
# Only approved accounts can manage their employees with Square.
|
591
651
|
# Unapproved accounts cannot use employee management features with the
|
@@ -595,6 +655,7 @@ module Square
|
|
595
655
|
# list events for.
|
596
656
|
# @return [List of V1TimecardEvent Hash] response from the API call
|
597
657
|
def list_timecard_events(timecard_id:)
|
658
|
+
warn 'Endpoint list_timecard_events in V1EmployeesApi is deprecated'
|
598
659
|
# Prepare query url.
|
599
660
|
_query_builder = config.get_base_uri
|
600
661
|
_query_builder << '/v1/me/timecards/{timecard_id}/events'
|
@@ -625,6 +686,15 @@ module Square
|
|
625
686
|
|
626
687
|
# Provides the details for all of a location's cash drawer shifts during a
|
627
688
|
# date range. The date range you specify cannot exceed 90 days.
|
689
|
+
# ---
|
690
|
+
# - __Deprecation date__: 2020-02-26
|
691
|
+
# - [__Retirement
|
692
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
693
|
+
# e#deprecated): 2021-02-26
|
694
|
+
# - [Migration
|
695
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
696
|
+
# cashdrawershifts)
|
697
|
+
# ---
|
628
698
|
# @param [String] location_id Required parameter: The ID of the location to
|
629
699
|
# list cash drawer shifts for.
|
630
700
|
# @param [SortOrder] order Optional parameter: The order in which cash
|
@@ -641,6 +711,7 @@ module Square
|
|
641
711
|
order: nil,
|
642
712
|
begin_time: nil,
|
643
713
|
end_time: nil)
|
714
|
+
warn 'Endpoint list_cash_drawer_shifts in V1EmployeesApi is deprecated'
|
644
715
|
# Prepare query url.
|
645
716
|
_query_builder = config.get_base_uri
|
646
717
|
_query_builder << '/v1/{location_id}/cash-drawer-shifts'
|
@@ -677,12 +748,22 @@ module Square
|
|
677
748
|
|
678
749
|
# Provides the details for a single cash drawer shift, including all events
|
679
750
|
# that occurred during the shift.
|
751
|
+
# ---
|
752
|
+
# - __Deprecation date__: 2020-02-26
|
753
|
+
# - [__Retirement
|
754
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
755
|
+
# e#deprecated): 2021-02-26
|
756
|
+
# - [Migration
|
757
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
758
|
+
# cashdrawershifts)
|
759
|
+
# ---
|
680
760
|
# @param [String] location_id Required parameter: The ID of the location to
|
681
761
|
# list cash drawer shifts for.
|
682
762
|
# @param [String] shift_id Required parameter: The shift's ID.
|
683
763
|
# @return [V1CashDrawerShift Hash] response from the API call
|
684
764
|
def retrieve_cash_drawer_shift(location_id:,
|
685
765
|
shift_id:)
|
766
|
+
warn 'Endpoint retrieve_cash_drawer_shift in V1EmployeesApi is deprecated'
|
686
767
|
# Prepare query url.
|
687
768
|
_query_builder = config.get_base_uri
|
688
769
|
_query_builder << '/v1/{location_id}/cash-drawer-shifts/{shift_id}'
|
@@ -8,10 +8,20 @@ module Square
|
|
8
8
|
# Provides non-confidential details for all of a location's associated bank
|
9
9
|
# accounts. This endpoint does not provide full bank account numbers, and
|
10
10
|
# there is no way to obtain a full bank account number with the Connect API.
|
11
|
+
# ---
|
12
|
+
# - __Deprecation date__: 2020-02-26
|
13
|
+
# - [__Retirement
|
14
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
15
|
+
# e#deprecated): 2021-02-26
|
16
|
+
# - [Migration
|
17
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
18
|
+
# bankaccounts)
|
19
|
+
# ---
|
11
20
|
# @param [String] location_id Required parameter: The ID of the location to
|
12
21
|
# list bank accounts for.
|
13
22
|
# @return [List of V1BankAccount Hash] response from the API call
|
14
23
|
def list_bank_accounts(location_id:)
|
24
|
+
warn 'Endpoint list_bank_accounts in V1TransactionsApi is deprecated'
|
15
25
|
# Prepare query url.
|
16
26
|
_query_builder = config.get_base_uri
|
17
27
|
_query_builder << '/v1/{location_id}/bank-accounts'
|
@@ -43,6 +53,15 @@ module Square
|
|
43
53
|
# Provides non-confidential details for a merchant's associated bank
|
44
54
|
# account. This endpoint does not provide full bank account numbers, and
|
45
55
|
# there is no way to obtain a full bank account number with the Connect API.
|
56
|
+
# ---
|
57
|
+
# - __Deprecation date__: 2020-02-26
|
58
|
+
# - [__Retirement
|
59
|
+
# date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
|
60
|
+
# e#deprecated): 2021-02-26
|
61
|
+
# - [Migration
|
62
|
+
# guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
|
63
|
+
# bankaccounts)
|
64
|
+
# ---
|
46
65
|
# @param [String] location_id Required parameter: The ID of the bank
|
47
66
|
# account's associated location.
|
48
67
|
# @param [String] bank_account_id Required parameter: The bank account's
|
@@ -51,6 +70,7 @@ module Square
|
|
51
70
|
# @return [V1BankAccount Hash] response from the API call
|
52
71
|
def retrieve_bank_account(location_id:,
|
53
72
|
bank_account_id:)
|
73
|
+
warn 'Endpoint retrieve_bank_account in V1TransactionsApi is deprecated'
|
54
74
|
# Prepare query url.
|
55
75
|
_query_builder = config.get_base_uri
|
56
76
|
_query_builder << '/v1/{location_id}/bank-accounts/{bank_account_id}'
|
data/lib/square/client.rb
CHANGED
@@ -4,11 +4,11 @@ module Square
|
|
4
4
|
attr_reader :config
|
5
5
|
|
6
6
|
def sdk_version
|
7
|
-
'
|
7
|
+
'5.0.0.20200226'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
11
|
-
'2020-
|
11
|
+
'2020-02-26'
|
12
12
|
end
|
13
13
|
|
14
14
|
# Access to mobile_authorization controller.
|
@@ -53,6 +53,12 @@ module Square
|
|
53
53
|
@apple_pay ||= ApplePayApi.new config
|
54
54
|
end
|
55
55
|
|
56
|
+
# Access to bank_accounts controller.
|
57
|
+
# @return [BankAccountsApi] Returns the controller instance.
|
58
|
+
def bank_accounts
|
59
|
+
@bank_accounts ||= BankAccountsApi.new config
|
60
|
+
end
|
61
|
+
|
56
62
|
# Access to cash_drawers controller.
|
57
63
|
# @return [CashDrawersApi] Returns the controller instance.
|
58
64
|
def cash_drawers
|
@@ -71,6 +77,12 @@ module Square
|
|
71
77
|
@customers ||= CustomersApi.new config
|
72
78
|
end
|
73
79
|
|
80
|
+
# Access to disputes controller.
|
81
|
+
# @return [DisputesApi] Returns the controller instance.
|
82
|
+
def disputes
|
83
|
+
@disputes ||= DisputesApi.new config
|
84
|
+
end
|
85
|
+
|
74
86
|
# Access to employees controller.
|
75
87
|
# @return [EmployeesApi] Returns the controller instance.
|
76
88
|
def employees
|
@@ -29,9 +29,7 @@ module Square
|
|
29
29
|
http_request.query_url
|
30
30
|
) do |request|
|
31
31
|
request.headers = http_request.headers
|
32
|
-
|
33
|
-
request.body = http_request.parameters
|
34
|
-
end
|
32
|
+
request.body = http_request.parameters
|
35
33
|
end
|
36
34
|
convert_response(response, http_request)
|
37
35
|
end
|
@@ -43,9 +41,7 @@ module Square
|
|
43
41
|
http_request.query_url
|
44
42
|
) do |request|
|
45
43
|
request.headers = http_request.headers
|
46
|
-
|
47
|
-
request.body = http_request.parameters
|
48
|
-
end
|
44
|
+
request.body = http_request.parameters
|
49
45
|
end
|
50
46
|
convert_response(response, http_request)
|
51
47
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Square
|
2
|
+
# A utility to allow users to set the content-type for files
|
3
|
+
class FileWrapper
|
4
|
+
attr_reader :content_type
|
5
|
+
attr_reader :file
|
6
|
+
|
7
|
+
def initialize(file, content_type: 'application/octet-stream')
|
8
|
+
@file = file
|
9
|
+
@content_type = content_type
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/square.rb
CHANGED
@@ -7,6 +7,9 @@ require 'logging'
|
|
7
7
|
require_relative 'square/api_helper.rb'
|
8
8
|
require_relative 'square/client.rb'
|
9
9
|
|
10
|
+
# Utilities
|
11
|
+
require_relative 'square/utilities/file_wrapper.rb'
|
12
|
+
|
10
13
|
# Http
|
11
14
|
require_relative 'square/http/api_response.rb'
|
12
15
|
require_relative 'square/http/http_call_back.rb'
|
@@ -33,9 +36,11 @@ require_relative 'square/api/v1_employees_api.rb'
|
|
33
36
|
require_relative 'square/api/v1_transactions_api.rb'
|
34
37
|
require_relative 'square/api/v1_items_api.rb'
|
35
38
|
require_relative 'square/api/apple_pay_api.rb'
|
39
|
+
require_relative 'square/api/bank_accounts_api.rb'
|
36
40
|
require_relative 'square/api/cash_drawers_api.rb'
|
37
41
|
require_relative 'square/api/catalog_api.rb'
|
38
42
|
require_relative 'square/api/customers_api.rb'
|
43
|
+
require_relative 'square/api/disputes_api.rb'
|
39
44
|
require_relative 'square/api/employees_api.rb'
|
40
45
|
require_relative 'square/api/inventory_api.rb'
|
41
46
|
require_relative 'square/api/labor_api.rb'
|
data/spec/user_journey_spec.rb
CHANGED
@@ -121,8 +121,11 @@ describe "UserJourney" do
|
|
121
121
|
|
122
122
|
# list
|
123
123
|
response = sq.customers.list_customers
|
124
|
-
|
125
|
-
|
124
|
+
if response.data != nil
|
125
|
+
assert_equal response.data.to_h.keys, %i[customers]
|
126
|
+
assert_equal response.status_code, 200
|
127
|
+
end
|
128
|
+
|
126
129
|
|
127
130
|
# update
|
128
131
|
response = sq.customers.update_customer(customer_id: created_customer[:id], body: customer2)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: square.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0.20200226
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Square Developer Platform
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -119,11 +119,13 @@ files:
|
|
119
119
|
- README.md
|
120
120
|
- lib/square.rb
|
121
121
|
- lib/square/api/apple_pay_api.rb
|
122
|
+
- lib/square/api/bank_accounts_api.rb
|
122
123
|
- lib/square/api/base_api.rb
|
123
124
|
- lib/square/api/cash_drawers_api.rb
|
124
125
|
- lib/square/api/catalog_api.rb
|
125
126
|
- lib/square/api/checkout_api.rb
|
126
127
|
- lib/square/api/customers_api.rb
|
128
|
+
- lib/square/api/disputes_api.rb
|
127
129
|
- lib/square/api/employees_api.rb
|
128
130
|
- lib/square/api/inventory_api.rb
|
129
131
|
- lib/square/api/labor_api.rb
|
@@ -152,6 +154,7 @@ files:
|
|
152
154
|
- lib/square/http/http_method_enum.rb
|
153
155
|
- lib/square/http/http_request.rb
|
154
156
|
- lib/square/http/http_response.rb
|
157
|
+
- lib/square/utilities/file_wrapper.rb
|
155
158
|
- spec/user_journey_spec.rb
|
156
159
|
- test/api/api_test_base.rb
|
157
160
|
- test/api/test_catalog_api.rb
|