square.rb 3.3.0.20191217 → 3.20190624.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +28 -10
- data/README.md +17235 -285
- data/lib/square/api/apple_pay_api.rb +7 -3
- data/lib/square/api/base_api.rb +8 -6
- data/lib/square/api/catalog_api.rb +23 -108
- data/lib/square/api/checkout_api.rb +5 -0
- data/lib/square/api/customers_api.rb +17 -10
- data/lib/square/api/employees_api.rb +7 -2
- data/lib/square/api/inventory_api.rb +9 -6
- data/lib/square/api/labor_api.rb +5 -0
- data/lib/square/api/locations_api.rb +6 -107
- data/lib/square/api/mobile_authorization_api.rb +8 -4
- data/lib/square/api/o_auth_api.rb +8 -7
- data/lib/square/api/orders_api.rb +30 -145
- data/lib/square/api/reporting_api.rb +9 -8
- data/lib/square/api/transactions_api.rb +15 -32
- data/lib/square/api/v1_employees_api.rb +8 -3
- data/lib/square/api/v1_items_api.rb +50 -445
- data/lib/square/api/v1_locations_api.rb +7 -23
- data/lib/square/api/v1_transactions_api.rb +7 -1
- data/lib/square/api_helper.rb +5 -4
- data/lib/square/client.rb +7 -36
- data/lib/square/configuration.rb +8 -16
- data/lib/square/exceptions/api_exception.rb +5 -0
- data/lib/square/http/api_response.rb +5 -0
- data/lib/square/http/auth/o_auth2.rb +5 -0
- data/lib/square/http/faraday_client.rb +5 -0
- data/lib/square/http/http_call_back.rb +5 -0
- data/lib/square/http/http_client.rb +5 -0
- data/lib/square/http/http_method_enum.rb +5 -0
- data/lib/square/http/http_request.rb +5 -0
- data/lib/square/http/http_response.rb +5 -0
- data/lib/square.rb +5 -4
- data/spec/user_journey_spec.rb +14 -15
- data/test/api/api_test_base.rb +1 -2
- metadata +11 -22
- data/lib/square/api/cash_drawers_api.rb +0 -150
- data/lib/square/api/merchants_api.rb +0 -82
- data/lib/square/api/payments_api.rb +0 -277
- data/lib/square/api/refunds_api.rb +0 -144
- data/test/api/test_catalog_api.rb +0 -59
- data/test/api/test_employees_api.rb +0 -36
- data/test/api/test_labor_api.rb +0 -74
- data/test/api/test_locations_api.rb +0 -35
- data/test/api/test_merchants_api.rb +0 -40
- data/test/api/test_payments_api.rb +0 -42
- data/test/api/test_refunds_api.rb +0 -41
@@ -1,3 +1,8 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
1
6
|
module Square
|
2
7
|
# ApplePayApi
|
3
8
|
class ApplePayApi < BaseApi
|
@@ -13,9 +18,8 @@ module Square
|
|
13
18
|
# activate
|
14
19
|
# Web Apple Pay with Square for merchants using their platform.
|
15
20
|
# To learn more about Apple Pay on Web see the Apple Pay section in the
|
16
|
-
# [Square Payment
|
17
|
-
#
|
18
|
-
# -form-walkthrough).
|
21
|
+
# [Embedding the Square Payment
|
22
|
+
# Form](/payment-form/add-digital-wallets/apple-pay) guide.
|
19
23
|
# @param [RegisterDomainRequest] body Required parameter: An object
|
20
24
|
# containing the fields to POST for the request. See the corresponding
|
21
25
|
# object definition for field details.
|
data/lib/square/api/base_api.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
1
6
|
module Square
|
2
7
|
# BaseApi.
|
3
8
|
class BaseApi
|
@@ -8,8 +13,8 @@ module Square
|
|
8
13
|
@http_call_back = http_call_back
|
9
14
|
|
10
15
|
@global_headers = {
|
11
|
-
'user-agent' => 'Square-Ruby-
|
12
|
-
'Square-Version' => '2019-12
|
16
|
+
'user-agent' => 'Square-Connect-Ruby-BETA/3.20190624.0',
|
17
|
+
'Square-Version' => '2019-06-12'
|
13
18
|
}
|
14
19
|
end
|
15
20
|
|
@@ -25,10 +30,7 @@ module Square
|
|
25
30
|
@http_call_back.on_before_request(request) if @http_call_back
|
26
31
|
|
27
32
|
APIHelper.clean_hash(request.headers)
|
28
|
-
request.headers.merge
|
29
|
-
unless config.additional_headers.nil?
|
30
|
-
request.headers.merge!(config.additional_headers)
|
31
|
-
end
|
33
|
+
request.headers = @global_headers.clone.merge(request.headers)
|
32
34
|
|
33
35
|
response = if binary
|
34
36
|
config.http_client.execute_as_binary(request)
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
1
6
|
module Square
|
2
7
|
# CatalogApi
|
3
8
|
class CatalogApi < BaseApi
|
@@ -131,89 +136,6 @@ module Square
|
|
131
136
|
ApiResponse.new(_response, data: decoded, errors: _errors)
|
132
137
|
end
|
133
138
|
|
134
|
-
# Upload an image file to create a new [CatalogImage](#type-catalogimage)
|
135
|
-
# for an existing
|
136
|
-
# [CatalogObject](#type-catalogobject). Images can be uploaded and linked in
|
137
|
-
# this request or created independently
|
138
|
-
# (without an object assignment) and linked to a
|
139
|
-
# [CatalogObject](#type-catalogobject) at a later time.
|
140
|
-
# CreateCatalogImage accepts HTTP multipart/form-data requests with a JSON
|
141
|
-
# part and an image file part in
|
142
|
-
# JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. The
|
143
|
-
# following is an example of such an HTTP request:
|
144
|
-
# ```
|
145
|
-
# POST /v2/catalog/images
|
146
|
-
# Accept: application/json
|
147
|
-
# Content-Type: multipart/form-data;boundary="boundary"
|
148
|
-
# Square-Version: XXXX-XX-XX
|
149
|
-
# Authorization: Bearer {ACCESS_TOKEN}
|
150
|
-
# --boundary
|
151
|
-
# Content-Disposition: form-data; name="request"
|
152
|
-
# Content-Type: application/json
|
153
|
-
# {
|
154
|
-
# "idempotency_key":"528dea59-7bfb-43c1-bd48-4a6bba7dd61f86",
|
155
|
-
# "object_id": "ND6EA5AAJEO5WL3JNNIAQA32",
|
156
|
-
# "image":{
|
157
|
-
# "id":"#TEMP_ID",
|
158
|
-
# "type":"IMAGE",
|
159
|
-
# "image_data":{
|
160
|
-
# "caption":"A picture of a cup of coffee"
|
161
|
-
# }
|
162
|
-
# }
|
163
|
-
# }
|
164
|
-
# --boundary
|
165
|
-
# Content-Disposition: form-data; name="image"; filename="Coffee.jpg"
|
166
|
-
# Content-Type: image/jpeg
|
167
|
-
# {ACTUAL_IMAGE_BYTES}
|
168
|
-
# --boundary
|
169
|
-
# ```
|
170
|
-
# Additional information and an example cURL request can be found in the
|
171
|
-
# [Create a Catalog Image
|
172
|
-
# recipe](https://developer.squareup.com/docs/more-apis/catalog/cookbook/cre
|
173
|
-
# ate-catalog-images).
|
174
|
-
# @param [CreateCatalogImageRequest] request Optional parameter: Example:
|
175
|
-
# @param [File | UploadIO] image_file Optional parameter: Example:
|
176
|
-
# @return [CreateCatalogImageResponse Hash] response from the API call
|
177
|
-
def create_catalog_image(request: nil,
|
178
|
-
image_file: nil)
|
179
|
-
# Prepare query url.
|
180
|
-
_query_builder = config.get_base_uri
|
181
|
-
_query_builder << '/v2/catalog/images'
|
182
|
-
_query_url = APIHelper.clean_url _query_builder
|
183
|
-
|
184
|
-
# Prepare headers.
|
185
|
-
_headers = {
|
186
|
-
'accept' => 'application/json'
|
187
|
-
}
|
188
|
-
|
189
|
-
# Prepare form parameters.
|
190
|
-
_parameters = {
|
191
|
-
'request' => Faraday::UploadIO.new(
|
192
|
-
StringIO.new(request.to_json),
|
193
|
-
'application/json'
|
194
|
-
),
|
195
|
-
'image_file' => Faraday::UploadIO.new(
|
196
|
-
image_file,
|
197
|
-
'image/jpeg'
|
198
|
-
)
|
199
|
-
}
|
200
|
-
_parameters = APIHelper.form_encode_parameters(_parameters)
|
201
|
-
|
202
|
-
# Prepare and execute HttpRequest.
|
203
|
-
_request = config.http_client.post(
|
204
|
-
_query_url,
|
205
|
-
headers: _headers,
|
206
|
-
parameters: _parameters
|
207
|
-
)
|
208
|
-
OAuth2.apply(config, _request)
|
209
|
-
_response = execute_request(_request)
|
210
|
-
|
211
|
-
# Return appropriate response type.
|
212
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
213
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
214
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
215
|
-
end
|
216
|
-
|
217
139
|
# Returns information about the Square Catalog API, such as batch size
|
218
140
|
# limits for `BatchUpsertCatalogObjects`.
|
219
141
|
# @return [CatalogInfoResponse Hash] response from the API call
|
@@ -250,7 +172,7 @@ module Square
|
|
250
172
|
# is specified as a comma-separated list of valid
|
251
173
|
# [CatalogObject](#type-catalogobject) types:
|
252
174
|
# `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`,
|
253
|
-
# `DISCOUNT`, `TAX
|
175
|
+
# `DISCOUNT`, `TAX`.
|
254
176
|
# __Important:__ ListCatalog does not return deleted catalog items. To
|
255
177
|
# retrieve
|
256
178
|
# deleted catalog items, use SearchCatalogObjects and set
|
@@ -258,13 +180,13 @@ module Square
|
|
258
180
|
# to `true`.
|
259
181
|
# @param [String] cursor Optional parameter: The pagination cursor returned
|
260
182
|
# in the previous response. Leave unset for an initial request. See
|
261
|
-
# [Pagination](
|
262
|
-
# for more information.
|
183
|
+
# [Pagination](/basics/api101/pagination) for more information.
|
263
184
|
# @param [String] types Optional parameter: An optional case-insensitive,
|
264
185
|
# comma-separated list of object types to retrieve, for example
|
265
186
|
# `ITEM,ITEM_VARIATION,CATEGORY,IMAGE`. The legal values are taken from the
|
266
|
-
# CatalogObjectType
|
267
|
-
# `
|
187
|
+
# [CatalogObjectType](#type-catalogobjecttype) enumeration, namely `ITEM`,
|
188
|
+
# `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`, `MODIFIER`,
|
189
|
+
# `MODIFIER_LIST`, or `IMAGE`.
|
268
190
|
# @return [ListCatalogResponse Hash] response from the API call
|
269
191
|
def list_catalog(cursor: nil,
|
270
192
|
types: nil)
|
@@ -337,10 +259,11 @@ module Square
|
|
337
259
|
# are also deleted. For example, deleting a [CatalogItem](#type-catalogitem)
|
338
260
|
# will also delete all of its
|
339
261
|
# [CatalogItemVariation](#type-catalogitemvariation) children.
|
340
|
-
# @param [String] object_id Required parameter: The ID of the
|
341
|
-
# to be deleted. When an object is
|
342
|
-
#
|
343
|
-
#
|
262
|
+
# @param [String] object_id Required parameter: The ID of the
|
263
|
+
# [CatalogObject](#type-catalogobject) to be deleted. When an object is
|
264
|
+
# deleted, other objects in the graph that depend on that object will be
|
265
|
+
# deleted as well (for example, deleting a [CatalogItem](#type-catalogitem)
|
266
|
+
# will delete its [CatalogItemVariation](#type-catalogitemvariation)s).
|
344
267
|
# @return [DeleteCatalogObjectResponse Hash] response from the API call
|
345
268
|
def delete_catalog_object(object_id:)
|
346
269
|
# Prepare query url.
|
@@ -380,16 +303,18 @@ module Square
|
|
380
303
|
# [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of
|
381
304
|
# any [CatalogTax](#type-catalogtax) objects that apply to it.
|
382
305
|
# @param [String] object_id Required parameter: The object ID of any type of
|
383
|
-
#
|
306
|
+
# [CatalogObject](#type-catalogobject)s to be retrieved.
|
384
307
|
# @param [Boolean] include_related_objects Optional parameter: If `true`,
|
385
308
|
# the response will include additional objects that are related to the
|
386
309
|
# requested object, as follows: If the `object` field of the response
|
387
|
-
# contains a CatalogItem, its associated
|
388
|
-
#
|
310
|
+
# contains a [CatalogItem](#type-catalogitem), its associated
|
311
|
+
# [CatalogCategory](#type-catalogcategory),
|
312
|
+
# [CatalogTax](#type-catalogtax)es, [CatalogImage](#type-catalogimage)s and
|
313
|
+
# [CatalogModifierList](#type-catalogmodifierlist)s will be returned in the
|
389
314
|
# `related_objects` field of the response. If the `object` field of the
|
390
|
-
# response contains a CatalogItemVariation,
|
391
|
-
#
|
392
|
-
# `false`
|
315
|
+
# response contains a [CatalogItemVariation](#type-catalogitemvariation),
|
316
|
+
# its parent [CatalogItem](#type-catalogitem) will be returned in the
|
317
|
+
# `related_objects` field of the response. Default value: `false`
|
393
318
|
# @return [RetrieveCatalogObjectResponse Hash] response from the API call
|
394
319
|
def retrieve_catalog_object(object_id:,
|
395
320
|
include_related_objects: nil)
|
@@ -433,16 +358,6 @@ module Square
|
|
433
358
|
# [CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), and
|
434
359
|
# [CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist)
|
435
360
|
# .
|
436
|
-
# --
|
437
|
-
# --
|
438
|
-
# Future end of the above comment:
|
439
|
-
# [CatalogQueryItemsForTax](#type-catalogqueryitemsfortax),
|
440
|
-
# [CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist)
|
441
|
-
# ,
|
442
|
-
# [CatalogQueryItemsForItemOptions](#type-catalogqueryitemsforitemoptions),
|
443
|
-
# and
|
444
|
-
# [CatalogQueryItemVariationsForItemOptionValues](#type-catalogqueryitemvari
|
445
|
-
# ationsforitemoptionvalues).
|
446
361
|
# @param [SearchCatalogObjectsRequest] body Required parameter: An object
|
447
362
|
# containing the fields to POST for the request. See the corresponding
|
448
363
|
# object definition for field details.
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
1
6
|
module Square
|
2
7
|
# CustomersApi
|
3
8
|
class CustomersApi < BaseApi
|
@@ -8,14 +13,13 @@ module Square
|
|
8
13
|
# Lists a business's customers.
|
9
14
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
10
15
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
11
|
-
# results for your original query. See
|
12
|
-
#
|
13
|
-
# for more information.
|
16
|
+
# results for your original query. See
|
17
|
+
# [Pagination](/basics/api101/pagination) for more information.
|
14
18
|
# @param [CustomerSortField] sort_field Optional parameter: Indicates how
|
15
|
-
# Customers should be sorted.
|
19
|
+
# Customers should be sorted. Default: `DEFAULT`.
|
16
20
|
# @param [SortOrder] sort_order Optional parameter: Indicates whether
|
17
21
|
# Customers should be sorted in ascending (`ASC`) or descending (`DESC`)
|
18
|
-
# order.
|
22
|
+
# order. Default: `ASC`.
|
19
23
|
# @return [ListCustomersResponse Hash] response from the API call
|
20
24
|
def list_customers(cursor: nil,
|
21
25
|
sort_field: nil,
|
@@ -203,9 +207,10 @@ module Square
|
|
203
207
|
# You cannot edit a customer's cards on file with this endpoint. To make
|
204
208
|
# changes
|
205
209
|
# to a card on file, you must delete the existing card on file with the
|
206
|
-
# [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint,
|
207
|
-
#
|
208
|
-
#
|
210
|
+
# [DeleteCustomerCard](#endpoint-customers-deletecustomercard) endpoint,
|
211
|
+
# then
|
212
|
+
# create a new one with the
|
213
|
+
# [CreateCustomerCard](#endpoint-customers-createcustomercard) endpoint.
|
209
214
|
# @param [String] customer_id Required parameter: The ID of the customer to
|
210
215
|
# update.
|
211
216
|
# @param [UpdateCustomerRequest] body Required parameter: An object
|
@@ -249,8 +254,10 @@ module Square
|
|
249
254
|
# calls with the same card nonce return the same card record that was
|
250
255
|
# created
|
251
256
|
# with the provided nonce during the _first_ call.
|
252
|
-
#
|
253
|
-
#
|
257
|
+
# Cards on file are automatically updated on a monthly basis to confirm they
|
258
|
+
# are still valid and can be charged.
|
259
|
+
# @param [String] customer_id Required parameter: The ID of the customer to
|
260
|
+
# link the card on file to.
|
254
261
|
# @param [CreateCustomerCardRequest] body Required parameter: An object
|
255
262
|
# containing the fields to POST for the request. See the corresponding
|
256
263
|
# object definition for field details.
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
1
6
|
module Square
|
2
7
|
# EmployeesApi
|
3
8
|
class EmployeesApi < BaseApi
|
@@ -5,7 +10,7 @@ module Square
|
|
5
10
|
super(config, http_call_back: http_call_back)
|
6
11
|
end
|
7
12
|
|
8
|
-
#
|
13
|
+
# Gets a list of `Employee` objects for a business.
|
9
14
|
# @param [String] location_id Optional parameter: Filter employees returned
|
10
15
|
# to only those that are associated with the specified location.
|
11
16
|
# @param [EmployeeStatus] status Optional parameter: Specifies the
|
@@ -50,7 +55,7 @@ module Square
|
|
50
55
|
ApiResponse.new(_response, data: decoded, errors: _errors)
|
51
56
|
end
|
52
57
|
|
53
|
-
#
|
58
|
+
# Gets an `Employee` by Square-assigned employee `ID` (UUID)
|
54
59
|
# @param [String] id Required parameter: UUID for the employee that was
|
55
60
|
# requested.
|
56
61
|
# @return [RetrieveEmployeeResponse Hash] response from the API call
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
1
6
|
module Square
|
2
7
|
# InventoryApi
|
3
8
|
class InventoryApi < BaseApi
|
@@ -197,9 +202,8 @@ module Square
|
|
197
202
|
# empty list queries all locations.
|
198
203
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
199
204
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
200
|
-
# results for the original query. See
|
201
|
-
# [Pagination](
|
202
|
-
# gination) guide for more information.
|
205
|
+
# results for the original query. See
|
206
|
+
# [Pagination](/basics/api101/pagination) for more information.
|
203
207
|
# @return [RetrieveInventoryCountResponse Hash] response from the API call
|
204
208
|
def retrieve_inventory_count(catalog_object_id:,
|
205
209
|
location_ids: nil,
|
@@ -252,9 +256,8 @@ module Square
|
|
252
256
|
# empty list queries all locations.
|
253
257
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
254
258
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
255
|
-
# results for the original query. See
|
256
|
-
# [Pagination](
|
257
|
-
# gination) guide for more information.
|
259
|
+
# results for the original query. See
|
260
|
+
# [Pagination](/basics/api101/pagination) for more information.
|
258
261
|
# @return [RetrieveInventoryChangesResponse Hash] response from the API call
|
259
262
|
def retrieve_inventory_changes(catalog_object_id:,
|
260
263
|
location_ids: nil,
|
data/lib/square/api/labor_api.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
1
6
|
module Square
|
2
7
|
# LocationsApi
|
3
8
|
class LocationsApi < BaseApi
|
@@ -5,7 +10,7 @@ module Square
|
|
5
10
|
super(config, http_call_back: http_call_back)
|
6
11
|
end
|
7
12
|
|
8
|
-
# Provides
|
13
|
+
# Provides the details for all of a business's locations.
|
9
14
|
# Most other Connect API endpoints have a required `location_id` path
|
10
15
|
# parameter.
|
11
16
|
# The `id` field of the [`Location`](#type-location) objects returned by
|
@@ -36,111 +41,5 @@ module Square
|
|
36
41
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
37
42
|
ApiResponse.new(_response, data: decoded, errors: _errors)
|
38
43
|
end
|
39
|
-
|
40
|
-
# Creates a location.
|
41
|
-
# For more information about locations, see [Locations API
|
42
|
-
# Overview](https://developer.squareup.com/docs/locations-api).
|
43
|
-
# @param [CreateLocationRequest] body Required parameter: An object
|
44
|
-
# containing the fields to POST for the request. See the corresponding
|
45
|
-
# object definition for field details.
|
46
|
-
# @return [CreateLocationResponse Hash] response from the API call
|
47
|
-
def create_location(body:)
|
48
|
-
# Prepare query url.
|
49
|
-
_query_builder = config.get_base_uri
|
50
|
-
_query_builder << '/v2/locations'
|
51
|
-
_query_url = APIHelper.clean_url _query_builder
|
52
|
-
|
53
|
-
# Prepare headers.
|
54
|
-
_headers = {
|
55
|
-
'accept' => 'application/json',
|
56
|
-
'content-type' => 'application/json; charset=utf-8'
|
57
|
-
}
|
58
|
-
|
59
|
-
# Prepare and execute HttpRequest.
|
60
|
-
_request = config.http_client.post(
|
61
|
-
_query_url,
|
62
|
-
headers: _headers,
|
63
|
-
parameters: body.to_json
|
64
|
-
)
|
65
|
-
OAuth2.apply(config, _request)
|
66
|
-
_response = execute_request(_request)
|
67
|
-
|
68
|
-
# Return appropriate response type.
|
69
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
70
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
71
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
72
|
-
end
|
73
|
-
|
74
|
-
# Retrieves details of a location.
|
75
|
-
# @param [String] location_id Required parameter: The ID of the location to
|
76
|
-
# retrieve.
|
77
|
-
# @return [RetrieveLocationResponse Hash] response from the API call
|
78
|
-
def retrieve_location(location_id:)
|
79
|
-
# Prepare query url.
|
80
|
-
_query_builder = config.get_base_uri
|
81
|
-
_query_builder << '/v2/locations/{location_id}'
|
82
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
83
|
-
_query_builder,
|
84
|
-
'location_id' => location_id
|
85
|
-
)
|
86
|
-
_query_url = APIHelper.clean_url _query_builder
|
87
|
-
|
88
|
-
# Prepare headers.
|
89
|
-
_headers = {
|
90
|
-
'accept' => 'application/json'
|
91
|
-
}
|
92
|
-
|
93
|
-
# Prepare and execute HttpRequest.
|
94
|
-
_request = config.http_client.get(
|
95
|
-
_query_url,
|
96
|
-
headers: _headers
|
97
|
-
)
|
98
|
-
OAuth2.apply(config, _request)
|
99
|
-
_response = execute_request(_request)
|
100
|
-
|
101
|
-
# Return appropriate response type.
|
102
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
103
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
104
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
105
|
-
end
|
106
|
-
|
107
|
-
# Updates a location.
|
108
|
-
# @param [String] location_id Required parameter: The ID of the location to
|
109
|
-
# update.
|
110
|
-
# @param [UpdateLocationRequest] body Required parameter: An object
|
111
|
-
# containing the fields to POST for the request. See the corresponding
|
112
|
-
# object definition for field details.
|
113
|
-
# @return [UpdateLocationResponse Hash] response from the API call
|
114
|
-
def update_location(location_id:,
|
115
|
-
body:)
|
116
|
-
# Prepare query url.
|
117
|
-
_query_builder = config.get_base_uri
|
118
|
-
_query_builder << '/v2/locations/{location_id}'
|
119
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
120
|
-
_query_builder,
|
121
|
-
'location_id' => location_id
|
122
|
-
)
|
123
|
-
_query_url = APIHelper.clean_url _query_builder
|
124
|
-
|
125
|
-
# Prepare headers.
|
126
|
-
_headers = {
|
127
|
-
'accept' => 'application/json',
|
128
|
-
'content-type' => 'application/json; charset=utf-8'
|
129
|
-
}
|
130
|
-
|
131
|
-
# Prepare and execute HttpRequest.
|
132
|
-
_request = config.http_client.put(
|
133
|
-
_query_url,
|
134
|
-
headers: _headers,
|
135
|
-
parameters: body.to_json
|
136
|
-
)
|
137
|
-
OAuth2.apply(config, _request)
|
138
|
-
_response = execute_request(_request)
|
139
|
-
|
140
|
-
# Return appropriate response type.
|
141
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
142
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
143
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
144
|
-
end
|
145
44
|
end
|
146
45
|
end
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
1
6
|
module Square
|
2
7
|
# MobileAuthorizationApi
|
3
8
|
class MobileAuthorizationApi < BaseApi
|
@@ -14,10 +19,9 @@ module Square
|
|
14
19
|
# ```
|
15
20
|
# Authorization: Bearer ACCESS_TOKEN
|
16
21
|
# ```
|
17
|
-
# Replace `ACCESS_TOKEN` with a
|
18
|
-
#
|
19
|
-
#
|
20
|
-
# okens).
|
22
|
+
# Replace `ACCESS_TOKEN` with a [valid production authorization
|
23
|
+
# credential](https://docs.connect.squareup.com/get-started#step-4-understan
|
24
|
+
# d-the-different-application-credentials).
|
21
25
|
# @param [CreateMobileAuthorizationCodeRequest] body Required parameter: An
|
22
26
|
# object containing the fields to POST for the request. See the
|
23
27
|
# corresponding object definition for field details.
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
1
6
|
module Square
|
2
7
|
# OAuthApi
|
3
8
|
class OAuthApi < BaseApi
|
@@ -7,9 +12,7 @@ module Square
|
|
7
12
|
|
8
13
|
# `RenewToken` is deprecated. For information about refreshing OAuth access
|
9
14
|
# tokens, see
|
10
|
-
# [Renew OAuth
|
11
|
-
# Token](https://developer.squareup.com/docs/oauth-api/cookbook/renew-oauth-
|
12
|
-
# tokens).
|
15
|
+
# [Renew OAuth Token](/authz/oauth/cookbook/oauth-renew).
|
13
16
|
# Renews an OAuth access token before it expires.
|
14
17
|
# OAuth access tokens besides your application's personal access token
|
15
18
|
# expire after __30 days__.
|
@@ -26,7 +29,7 @@ module Square
|
|
26
29
|
# Replace `APPLICATION_SECRET` with the application secret on the
|
27
30
|
# Credentials
|
28
31
|
# page in the [application dashboard](https://connect.squareup.com/apps).
|
29
|
-
# @param [String] client_id Required parameter: Your application ID,
|
32
|
+
# @param [String] client_id Required parameter: Your application's ID,
|
30
33
|
# available from the [application
|
31
34
|
# dashboard](https://connect.squareup.com/apps).
|
32
35
|
# @param [RenewTokenRequest] body Required parameter: An object containing
|
@@ -38,7 +41,6 @@ module Square
|
|
38
41
|
def renew_token(client_id:,
|
39
42
|
body:,
|
40
43
|
authorization:)
|
41
|
-
warn 'Endpoint renew_token in OAuthApi is deprecated'
|
42
44
|
# Prepare query url.
|
43
45
|
_query_builder = config.get_base_uri
|
44
46
|
_query_builder << '/oauth2/clients/{client_id}/access-token/renew'
|
@@ -123,8 +125,7 @@ module Square
|
|
123
125
|
# Applications specify a method by adding the `grant_type` parameter
|
124
126
|
# in the request and also provide relevant information.
|
125
127
|
# For more information, see [OAuth access token
|
126
|
-
# management](
|
127
|
-
# auth-access-token-management).
|
128
|
+
# management](/authz/oauth/how-it-works#oauth-access-token-management).
|
128
129
|
# __Note:__ Regardless of the method application specified,
|
129
130
|
# the endpoint always returns two items; an OAuth access token and
|
130
131
|
# a refresh token in the response.
|