square.rb 7.0.0.20201118 → 8.0.0.20201216
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -3
- data/lib/square.rb +0 -1
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/bookings_api.rb +42 -0
- data/lib/square/api/catalog_api.rb +18 -4
- data/lib/square/api/disputes_api.rb +33 -35
- data/lib/square/api/invoices_api.rb +11 -8
- data/lib/square/api/v1_employees_api.rb +0 -4
- data/lib/square/client.rb +2 -8
- data/lib/square/configuration.rb +1 -1
- metadata +2 -3
- data/lib/square/api/v1_locations_api.rb +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50abb148c3dd6d03e86147fc8f95f3f58eeafeabb22d81c65a5c58b87b0b1060
|
4
|
+
data.tar.gz: 26371d6cdfa25de275bfef471b8145e43eaeccc7dc661d0abac57f9b643645aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a404bd6129da3f1ed2cdeaa8080d05c4ec75fe2ae93913c9c6e01de706f8dfc8487fb8696d431072a87511d9036fa6fa7cc797e6765f326c382d45ba0658d719
|
7
|
+
data.tar.gz: 8000f93f083e58f8c6c820520f535cdf5015f1184ac0bd2febfb3a4448e0850a9ea168e997f7a42f54435255a3beba8a2c74615fd2a155e05fe8cb8bcd7c1652
|
data/README.md
CHANGED
@@ -78,7 +78,6 @@ gem 'square.rb'
|
|
78
78
|
* [O Auth]
|
79
79
|
|
80
80
|
### Deprecated APIs
|
81
|
-
* [V1 Locations]
|
82
81
|
* [V1 Employees]
|
83
82
|
* [V1 Transactions]
|
84
83
|
* [V1 Items]
|
@@ -296,7 +295,7 @@ You can also use the Square API to create applications or services that work wit
|
|
296
295
|
[Cash Drawers]: doc/api/cash-drawers.md
|
297
296
|
[Customer Groups]: doc/api/customer-groups.md
|
298
297
|
[Customer Segments]: doc/api/customer-segments.md
|
299
|
-
[Bank Accounts]: doc/api/bank-accounts
|
298
|
+
[Bank Accounts]: doc/api/bank-accounts.md
|
300
299
|
[Payments]: doc/api/payments.md
|
301
300
|
[Checkout]: doc/api/checkout.md
|
302
301
|
[Catalog]: doc/api/catalog.md
|
@@ -315,7 +314,6 @@ You can also use the Square API to create applications or services that work wit
|
|
315
314
|
[Subscriptions]: doc/api/subscriptions.md
|
316
315
|
[Mobile Authorization]: doc/api/mobile-authorization.md
|
317
316
|
[O Auth]: doc/api/o-auth.md
|
318
|
-
[V1 Locations]: doc/api/v1-locations.md
|
319
317
|
[V1 Employees]: doc/api/v1-employees.md
|
320
318
|
[V1 Transactions]: doc/api/v1-transactions.md
|
321
319
|
[V1 Items]: doc/api/v1-items.md
|
data/lib/square.rb
CHANGED
@@ -31,7 +31,6 @@ require_relative 'square/configuration.rb'
|
|
31
31
|
require_relative 'square/api/base_api.rb'
|
32
32
|
require_relative 'square/api/mobile_authorization_api.rb'
|
33
33
|
require_relative 'square/api/o_auth_api.rb'
|
34
|
-
require_relative 'square/api/v1_locations_api.rb'
|
35
34
|
require_relative 'square/api/v1_employees_api.rb'
|
36
35
|
require_relative 'square/api/v1_transactions_api.rb'
|
37
36
|
require_relative 'square/api/v1_items_api.rb'
|
data/lib/square/api/base_api.rb
CHANGED
@@ -262,5 +262,47 @@ module Square
|
|
262
262
|
_response, data: decoded, errors: _errors
|
263
263
|
)
|
264
264
|
end
|
265
|
+
|
266
|
+
# Cancels an existing booking.
|
267
|
+
# @param [String] booking_id Required parameter: The ID of the
|
268
|
+
# [Booking](#type-booking) object representing the to-be-cancelled
|
269
|
+
# booking.
|
270
|
+
# @param [CancelBookingRequest] body Required parameter: An object
|
271
|
+
# containing the fields to POST for the request. See the corresponding
|
272
|
+
# object definition for field details.
|
273
|
+
# @return [CancelBookingResponse Hash] response from the API call
|
274
|
+
def cancel_booking(booking_id:,
|
275
|
+
body:)
|
276
|
+
# Prepare query url.
|
277
|
+
_query_builder = config.get_base_uri
|
278
|
+
_query_builder << '/v2/bookings/{booking_id}/cancel'
|
279
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
280
|
+
_query_builder,
|
281
|
+
'booking_id' => { 'value' => booking_id, 'encode' => true }
|
282
|
+
)
|
283
|
+
_query_url = APIHelper.clean_url _query_builder
|
284
|
+
|
285
|
+
# Prepare headers.
|
286
|
+
_headers = {
|
287
|
+
'accept' => 'application/json',
|
288
|
+
'content-type' => 'application/json; charset=utf-8'
|
289
|
+
}
|
290
|
+
|
291
|
+
# Prepare and execute HttpRequest.
|
292
|
+
_request = config.http_client.post(
|
293
|
+
_query_url,
|
294
|
+
headers: _headers,
|
295
|
+
parameters: body.to_json
|
296
|
+
)
|
297
|
+
OAuth2.apply(config, _request)
|
298
|
+
_response = execute_request(_request)
|
299
|
+
|
300
|
+
# Return appropriate response type.
|
301
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
302
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
303
|
+
ApiResponse.new(
|
304
|
+
_response, data: decoded, errors: _errors
|
305
|
+
)
|
306
|
+
end
|
265
307
|
end
|
266
308
|
end
|
@@ -251,16 +251,23 @@ module Square
|
|
251
251
|
# `ITEM,ITEM_VARIATION,CATEGORY,IMAGE`. The legal values are taken from the
|
252
252
|
# CatalogObjectType enum: `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`,
|
253
253
|
# `TAX`, `MODIFIER`, `MODIFIER_LIST`, or `IMAGE`.
|
254
|
+
# @param [Long] catalog_version Optional parameter: The specific version of
|
255
|
+
# the catalog objects to be included in the response. This allows you to
|
256
|
+
# retrieve historical versions of objects. The specified version value is
|
257
|
+
# matched against the [CatalogObject](#type-catalogobject)s' `version`
|
258
|
+
# attribute.
|
254
259
|
# @return [ListCatalogResponse Hash] response from the API call
|
255
260
|
def list_catalog(cursor: nil,
|
256
|
-
types: nil
|
261
|
+
types: nil,
|
262
|
+
catalog_version: nil)
|
257
263
|
# Prepare query url.
|
258
264
|
_query_builder = config.get_base_uri
|
259
265
|
_query_builder << '/v2/catalog/list'
|
260
266
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
261
267
|
_query_builder,
|
262
268
|
'cursor' => cursor,
|
263
|
-
'types' => types
|
269
|
+
'types' => types,
|
270
|
+
'catalog_version' => catalog_version
|
264
271
|
)
|
265
272
|
_query_url = APIHelper.clean_url _query_builder
|
266
273
|
|
@@ -382,9 +389,15 @@ module Square
|
|
382
389
|
# response contains a `CatalogItemVariation`, its parent `CatalogItem` will
|
383
390
|
# be returned in the `related_objects` field of the response. Default
|
384
391
|
# value: `false`
|
392
|
+
# @param [Long] catalog_version Optional parameter: Requests objects as of a
|
393
|
+
# specific version of the catalog. This allows you to retrieve historical
|
394
|
+
# versions of objects. The value to retrieve a specific version of an object
|
395
|
+
# can be found in the version field of
|
396
|
+
# [CatalogObject](#type-catalogobject)s.
|
385
397
|
# @return [RetrieveCatalogObjectResponse Hash] response from the API call
|
386
398
|
def retrieve_catalog_object(object_id:,
|
387
|
-
include_related_objects: false
|
399
|
+
include_related_objects: false,
|
400
|
+
catalog_version: nil)
|
388
401
|
# Prepare query url.
|
389
402
|
_query_builder = config.get_base_uri
|
390
403
|
_query_builder << '/v2/catalog/object/{object_id}'
|
@@ -394,7 +407,8 @@ module Square
|
|
394
407
|
)
|
395
408
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
396
409
|
_query_builder,
|
397
|
-
'include_related_objects' => include_related_objects
|
410
|
+
'include_related_objects' => include_related_objects,
|
411
|
+
'catalog_version' => catalog_version
|
398
412
|
)
|
399
413
|
_query_url = APIHelper.clean_url _query_builder
|
400
414
|
|
@@ -5,20 +5,19 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Returns a list of disputes associated
|
9
|
-
# with a particular account.
|
8
|
+
# Returns a list of disputes associated with a particular account.
|
10
9
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
11
|
-
# a previous call to this endpoint. Provide this to retrieve the next
|
12
|
-
# results for the original query. For more information, see
|
13
|
-
# [
|
10
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
11
|
+
# set of results for the original query. For more information, see
|
12
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
14
13
|
# .
|
15
14
|
# @param [DisputeState] states Optional parameter: The dispute states to
|
16
15
|
# filter the result. If not specified, the endpoint returns all open
|
17
|
-
# disputes (dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`).
|
16
|
+
# disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`).
|
18
17
|
# @param [String] location_id Optional parameter: The ID of the location for
|
19
|
-
# which to return
|
20
|
-
#
|
21
|
-
#
|
18
|
+
# which to return a list of disputes. If not specified, the endpoint returns
|
19
|
+
# all open disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or
|
20
|
+
# `LOST`) associated with all locations.
|
22
21
|
# @return [ListDisputesResponse Hash] response from the API call
|
23
22
|
def list_disputes(cursor: nil,
|
24
23
|
states: nil,
|
@@ -55,7 +54,7 @@ module Square
|
|
55
54
|
)
|
56
55
|
end
|
57
56
|
|
58
|
-
# Returns details
|
57
|
+
# Returns details about a specific dispute.
|
59
58
|
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
60
59
|
# want more details about.
|
61
60
|
# @return [RetrieveDisputeResponse Hash] response from the API call
|
@@ -90,14 +89,14 @@ module Square
|
|
90
89
|
)
|
91
90
|
end
|
92
91
|
|
93
|
-
# Accepts loss on a dispute. Square returns
|
94
|
-
#
|
95
|
-
# dispute state to ACCEPTED.
|
96
|
-
# Square debits the disputed amount from the seller’s Square
|
97
|
-
#
|
98
|
-
# sufficient funds, Square debits the associated bank account.
|
99
|
-
# @param [String] dispute_id Required parameter: ID of the dispute you
|
100
|
-
# to accept.
|
92
|
+
# Accepts the loss on a dispute. Square returns the disputed amount to the
|
93
|
+
# cardholder and
|
94
|
+
# updates the dispute state to ACCEPTED.
|
95
|
+
# Square debits the disputed amount from the seller’s Square account. If the
|
96
|
+
# Square account
|
97
|
+
# does not have sufficient funds, Square debits the associated bank account.
|
98
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
99
|
+
# want to accept.
|
101
100
|
# @return [AcceptDisputeResponse Hash] response from the API call
|
102
101
|
def accept_dispute(dispute_id:)
|
103
102
|
# Prepare query url.
|
@@ -165,8 +164,8 @@ module Square
|
|
165
164
|
end
|
166
165
|
|
167
166
|
# Removes specified evidence from a dispute.
|
168
|
-
# Square does not send the bank any evidence that
|
169
|
-
#
|
167
|
+
# Square does not send the bank any evidence that is removed. Also, you
|
168
|
+
# cannot remove evidence after
|
170
169
|
# submitting it to the bank using
|
171
170
|
# [SubmitEvidence](https://developer.squareup.com/docs/reference/square/disp
|
172
171
|
# utes-api/submit-evidence).
|
@@ -210,8 +209,8 @@ module Square
|
|
210
209
|
|
211
210
|
# Returns the specific evidence metadata associated with a specific dispute.
|
212
211
|
# You must maintain a copy of the evidence you upload if you want to
|
213
|
-
# reference it later. You cannot
|
214
|
-
# after you upload it.
|
212
|
+
# reference it later. You cannot
|
213
|
+
# download the evidence after you upload it.
|
215
214
|
# @param [String] dispute_id Required parameter: The ID of the dispute that
|
216
215
|
# you want to retrieve evidence from.
|
217
216
|
# @param [String] evidence_id Required parameter: The ID of the evidence to
|
@@ -251,13 +250,13 @@ module Square
|
|
251
250
|
end
|
252
251
|
|
253
252
|
# Uploads a file to use as evidence in a dispute challenge. The endpoint
|
254
|
-
# accepts
|
255
|
-
#
|
256
|
-
#
|
257
|
-
# @param [String] dispute_id Required parameter: ID of the dispute you
|
258
|
-
# to upload evidence for.
|
253
|
+
# accepts HTTP
|
254
|
+
# multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF
|
255
|
+
# formats.
|
256
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute you
|
257
|
+
# want to upload evidence for.
|
259
258
|
# @param [CreateDisputeEvidenceFileRequest] request Optional parameter:
|
260
|
-
# Defines parameters for a CreateDisputeEvidenceFile request.
|
259
|
+
# Defines the parameters for a `CreateDisputeEvidenceFile` request.
|
261
260
|
# @param [File | UploadIO] image_file Optional parameter: Example:
|
262
261
|
# @return [CreateDisputeEvidenceFileResponse Hash] response from the API call
|
263
262
|
def create_dispute_evidence_file(dispute_id:,
|
@@ -358,16 +357,15 @@ module Square
|
|
358
357
|
|
359
358
|
# Submits evidence to the cardholder's bank.
|
360
359
|
# Before submitting evidence, Square compiles all available evidence. This
|
361
|
-
# includes
|
362
|
-
#
|
360
|
+
# includes evidence uploaded
|
361
|
+
# using the
|
363
362
|
# [CreateDisputeEvidenceFile](https://developer.squareup.com/docs/reference/
|
364
363
|
# square/disputes-api/create-dispute-evidence-file) and
|
365
364
|
# [CreateDisputeEvidenceText](https://developer.squareup.com/docs/reference/
|
366
|
-
# square/disputes-api/create-dispute-evidence-text) endpoints
|
367
|
-
#
|
368
|
-
#
|
369
|
-
#
|
370
|
-
# want to submit evidence for.
|
365
|
+
# square/disputes-api/create-dispute-evidence-text) endpoints and
|
366
|
+
# evidence automatically provided by Square, when available.
|
367
|
+
# @param [String] dispute_id Required parameter: The ID of the dispute that
|
368
|
+
# you want to submit evidence for.
|
371
369
|
# @return [SubmitEvidenceResponse Hash] response from the API call
|
372
370
|
def submit_evidence(dispute_id:)
|
373
371
|
# Prepare query url.
|
@@ -134,8 +134,8 @@ module Square
|
|
134
134
|
|
135
135
|
# Deletes the specified invoice. When an invoice is deleted, the
|
136
136
|
# associated Order status changes to CANCELED. You can only delete a draft
|
137
|
-
# invoice (you cannot delete
|
138
|
-
#
|
137
|
+
# invoice (you cannot delete a published invoice, including one that is
|
138
|
+
# scheduled for processing).
|
139
139
|
# @param [String] invoice_id Required parameter: The ID of the invoice to
|
140
140
|
# delete.
|
141
141
|
# @param [Integer] version Optional parameter: The version of the
|
@@ -214,12 +214,15 @@ module Square
|
|
214
214
|
)
|
215
215
|
end
|
216
216
|
|
217
|
-
# Updates an invoice by modifying
|
218
|
-
#
|
219
|
-
#
|
220
|
-
#
|
221
|
-
# However,
|
222
|
-
#
|
217
|
+
# Updates an invoice by modifying fields, clearing fields, or both. For most
|
218
|
+
# updates, you can use a sparse
|
219
|
+
# `Invoice` object to add fields or change values, and use the
|
220
|
+
# `fields_to_clear` field to specify fields to clear.
|
221
|
+
# However, some restrictions apply. For example, you cannot change the
|
222
|
+
# `order_id` or `location_id` field, and you
|
223
|
+
# must provide the complete `custom_fields` list to update a custom field.
|
224
|
+
# Published invoices have additional restrictions.
|
225
|
+
# @param [String] invoice_id Required parameter: The ID of the invoice to
|
223
226
|
# update.
|
224
227
|
# @param [UpdateInvoiceRequest] body Required parameter: An object
|
225
228
|
# containing the fields to POST for the request. See the corresponding
|
@@ -85,10 +85,8 @@ module Square
|
|
85
85
|
# of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale
|
86
86
|
# until they are activated from the Square Dashboard. Employee status
|
87
87
|
# cannot be changed with the Connect API.
|
88
|
-
# <aside class="important">
|
89
88
|
# Employee entities cannot be deleted. To disable employee profiles,
|
90
89
|
# set the employee's status to <code>INACTIVE</code>
|
91
|
-
# </aside>
|
92
90
|
# @param [V1Employee] body Required parameter: An object containing the
|
93
91
|
# fields to POST for the request. See the corresponding object definition
|
94
92
|
# for field details.
|
@@ -617,11 +615,9 @@ module Square
|
|
617
615
|
|
618
616
|
# Provides summary information for all events associated with a
|
619
617
|
# particular timecard.
|
620
|
-
# <aside>
|
621
618
|
# Only approved accounts can manage their employees with Square.
|
622
619
|
# Unapproved accounts cannot use employee management features with the
|
623
620
|
# API.
|
624
|
-
# </aside>
|
625
621
|
# @param [String] timecard_id Required parameter: The ID of the timecard to
|
626
622
|
# list events for.
|
627
623
|
# @return [List of V1TimecardEvent Hash] response from the API call
|
data/lib/square/client.rb
CHANGED
@@ -4,7 +4,7 @@ module Square
|
|
4
4
|
attr_reader :config
|
5
5
|
|
6
6
|
def sdk_version
|
7
|
-
'
|
7
|
+
'8.0.0.20201216'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -23,12 +23,6 @@ module Square
|
|
23
23
|
@o_auth ||= OAuthApi.new config
|
24
24
|
end
|
25
25
|
|
26
|
-
# Access to v1_locations controller.
|
27
|
-
# @return [V1LocationsApi] Returns the controller instance.
|
28
|
-
def v1_locations
|
29
|
-
@v1_locations ||= V1LocationsApi.new config
|
30
|
-
end
|
31
|
-
|
32
26
|
# Access to v1_employees controller.
|
33
27
|
# @return [V1EmployeesApi] Returns the controller instance.
|
34
28
|
def v1_employees
|
@@ -199,7 +193,7 @@ module Square
|
|
199
193
|
|
200
194
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
201
195
|
backoff_factor: 1, environment: 'production',
|
202
|
-
square_version: '2020-
|
196
|
+
square_version: '2020-12-16', access_token: 'TODO: Replace',
|
203
197
|
additional_headers: {}, config: nil)
|
204
198
|
@config = if config.nil?
|
205
199
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
data/lib/square/configuration.rb
CHANGED
@@ -22,7 +22,7 @@ module Square
|
|
22
22
|
|
23
23
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
24
24
|
backoff_factor: 1, environment: 'production',
|
25
|
-
square_version: '2020-
|
25
|
+
square_version: '2020-12-16', access_token: 'TODO: Replace',
|
26
26
|
additional_headers: {})
|
27
27
|
# The value to use for connection timeout
|
28
28
|
@timeout = timeout
|
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: 8.0.0.20201216
|
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-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -166,7 +166,6 @@ files:
|
|
166
166
|
- lib/square/api/transactions_api.rb
|
167
167
|
- lib/square/api/v1_employees_api.rb
|
168
168
|
- lib/square/api/v1_items_api.rb
|
169
|
-
- lib/square/api/v1_locations_api.rb
|
170
169
|
- lib/square/api/v1_transactions_api.rb
|
171
170
|
- lib/square/api_helper.rb
|
172
171
|
- lib/square/client.rb
|
@@ -1,69 +0,0 @@
|
|
1
|
-
module Square
|
2
|
-
# V1LocationsApi
|
3
|
-
class V1LocationsApi < BaseApi
|
4
|
-
def initialize(config, http_call_back: nil)
|
5
|
-
super(config, http_call_back: http_call_back)
|
6
|
-
end
|
7
|
-
|
8
|
-
# Get the general information for a business.
|
9
|
-
# @return [V1Merchant Hash] response from the API call
|
10
|
-
def retrieve_business
|
11
|
-
warn 'Endpoint retrieve_business in V1LocationsApi is deprecated'
|
12
|
-
# Prepare query url.
|
13
|
-
_query_builder = config.get_base_uri
|
14
|
-
_query_builder << '/v1/me'
|
15
|
-
_query_url = APIHelper.clean_url _query_builder
|
16
|
-
|
17
|
-
# Prepare headers.
|
18
|
-
_headers = {
|
19
|
-
'accept' => 'application/json'
|
20
|
-
}
|
21
|
-
|
22
|
-
# Prepare and execute HttpRequest.
|
23
|
-
_request = config.http_client.get(
|
24
|
-
_query_url,
|
25
|
-
headers: _headers
|
26
|
-
)
|
27
|
-
OAuth2.apply(config, _request)
|
28
|
-
_response = execute_request(_request)
|
29
|
-
|
30
|
-
# Return appropriate response type.
|
31
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
32
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
33
|
-
ApiResponse.new(
|
34
|
-
_response, data: decoded, errors: _errors
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
# Provides details for all business locations associated with a Square
|
39
|
-
# account, including the Square-assigned object ID for the location.
|
40
|
-
# @return [List of V1Merchant Hash] response from the API call
|
41
|
-
def list_locations
|
42
|
-
warn 'Endpoint list_locations in V1LocationsApi is deprecated'
|
43
|
-
# Prepare query url.
|
44
|
-
_query_builder = config.get_base_uri
|
45
|
-
_query_builder << '/v1/me/locations'
|
46
|
-
_query_url = APIHelper.clean_url _query_builder
|
47
|
-
|
48
|
-
# Prepare headers.
|
49
|
-
_headers = {
|
50
|
-
'accept' => 'application/json'
|
51
|
-
}
|
52
|
-
|
53
|
-
# Prepare and execute HttpRequest.
|
54
|
-
_request = config.http_client.get(
|
55
|
-
_query_url,
|
56
|
-
headers: _headers
|
57
|
-
)
|
58
|
-
OAuth2.apply(config, _request)
|
59
|
-
_response = execute_request(_request)
|
60
|
-
|
61
|
-
# Return appropriate response type.
|
62
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
63
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
64
|
-
ApiResponse.new(
|
65
|
-
_response, data: decoded, errors: _errors
|
66
|
-
)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|