square.rb 3.20190925.0 → 3.20191023.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/square/api/base_api.rb +2 -2
- data/lib/square/api/catalog_api.rb +1 -1
- data/lib/square/api/merchants_api.rb +42 -1
- data/lib/square/api/v1_employees_api.rb +3 -3
- data/lib/square/client.rb +2 -2
- data/test/api/test_merchants_api.rb +40 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6869181c2882291f8cf94d596adb12e137061d21e37f1db4a5c89487fee34569
|
4
|
+
data.tar.gz: 5c25f08d601e4907f0b4e528d1d1ecf5e995d3ccf596a7a44dd0ace25fc03db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80e91e32562c8721e2d9c64a4bd338640118a26a76776b54b220d5c133b230a8a906a8fc4c75a378bf6918f3d2751d724e0e9c1e4a1adde7610483b1febbae68
|
7
|
+
data.tar.gz: 7e6ba403f41403e826c245fa083357170f7f312659524c2f28b1e4aa2edfc2af564be057a6386870c9da22a6482f85b9d77c37eaceccefd50d43acb6f8c68ecc
|
data/lib/square/api/base_api.rb
CHANGED
@@ -13,8 +13,8 @@ module Square
|
|
13
13
|
@http_call_back = http_call_back
|
14
14
|
|
15
15
|
@global_headers = {
|
16
|
-
'user-agent' => 'Square-Ruby-SDK/3.
|
17
|
-
'Square-Version' => '2019-
|
16
|
+
'user-agent' => 'Square-Ruby-SDK/3.20191023.0',
|
17
|
+
'Square-Version' => '2019-10-23'
|
18
18
|
}
|
19
19
|
end
|
20
20
|
|
@@ -172,7 +172,7 @@ module Square
|
|
172
172
|
# is specified as a comma-separated list of valid
|
173
173
|
# [CatalogObject](#type-catalogobject) types:
|
174
174
|
# `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`,
|
175
|
-
# `DISCOUNT`, `TAX`.
|
175
|
+
# `DISCOUNT`, `TAX`, `IMAGE`.
|
176
176
|
# __Important:__ ListCatalog does not return deleted catalog items. To
|
177
177
|
# retrieve
|
178
178
|
# deleted catalog items, use SearchCatalogObjects and set
|
@@ -10,9 +10,50 @@ module Square
|
|
10
10
|
super(config, http_call_back: http_call_back)
|
11
11
|
end
|
12
12
|
|
13
|
+
# Returns `Merchant` information for a given access token.
|
14
|
+
# If you don't know a `Merchant` ID, you can use this endpoint to retrieve
|
15
|
+
# the merchant ID for an access token.
|
16
|
+
# You can specify your personal access token to get your own merchant
|
17
|
+
# information or specify an OAuth token
|
18
|
+
# to get the information for the merchant that granted you access.
|
19
|
+
# If you know the merchant ID, you can also use the
|
20
|
+
# [RetrieveMerchant](#endpoint-merchants-retrievemerchant)
|
21
|
+
# endpoint to get the merchant information.
|
22
|
+
# @param [Integer] cursor Optional parameter: The cursor generated by the
|
23
|
+
# previous response.
|
24
|
+
# @return [ListMerchantsResponse Hash] response from the API call
|
25
|
+
def list_merchants(cursor: nil)
|
26
|
+
# Prepare query url.
|
27
|
+
_query_builder = config.get_base_uri
|
28
|
+
_query_builder << '/v2/merchants'
|
29
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
30
|
+
_query_builder,
|
31
|
+
'cursor' => cursor
|
32
|
+
)
|
33
|
+
_query_url = APIHelper.clean_url _query_builder
|
34
|
+
|
35
|
+
# Prepare headers.
|
36
|
+
_headers = {
|
37
|
+
'accept' => 'application/json'
|
38
|
+
}
|
39
|
+
|
40
|
+
# Prepare and execute HttpRequest.
|
41
|
+
_request = config.http_client.get(
|
42
|
+
_query_url,
|
43
|
+
headers: _headers
|
44
|
+
)
|
45
|
+
OAuth2.apply(config, _request)
|
46
|
+
_response = execute_request(_request)
|
47
|
+
|
48
|
+
# Return appropriate response type.
|
49
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
50
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
51
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
52
|
+
end
|
53
|
+
|
13
54
|
# Retrieve a `Merchant` object for the given `merchant_id`.
|
14
55
|
# @param [String] merchant_id Required parameter: The ID of the merchant to
|
15
|
-
# retrieve
|
56
|
+
# retrieve.
|
16
57
|
# @return [RetrieveMerchantResponse Hash] response from the API call
|
17
58
|
def retrieve_merchant(merchant_id:)
|
18
59
|
# Prepare query url.
|
@@ -26,9 +26,9 @@ module Square
|
|
26
26
|
# @param [String] end_created_at Optional parameter: If filtering results by
|
27
27
|
# their created_at field, the end of the requested reporting period, in ISO
|
28
28
|
# 8601 format.
|
29
|
-
# @param [
|
30
|
-
# endpoint returns only employee entities with the specified
|
31
|
-
# or INACTIVE).
|
29
|
+
# @param [V1ListEmployeesRequestStatus] status Optional parameter: If
|
30
|
+
# provided, the endpoint returns only employee entities with the specified
|
31
|
+
# status (ACTIVE or INACTIVE).
|
32
32
|
# @param [String] external_id Optional parameter: If provided, the endpoint
|
33
33
|
# returns only employee entities with the specified external_id.
|
34
34
|
# @param [Integer] limit Optional parameter: The maximum integer number of
|
data/lib/square/client.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require_relative 'api_test_base'
|
7
|
+
|
8
|
+
class MerchantsApiTests < ApiTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
@response_catcher = HttpResponseCatcher.new
|
12
|
+
@controller = MerchantsApi.new CONFIG, http_call_back: @response_catcher
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns `Merchant` information for a given access token.
|
16
|
+
#
|
17
|
+
#If you don't know a `Merchant` ID, you can use this endpoint to retrieve the merchant ID for an access token.
|
18
|
+
#You can specify your personal access token to get your own merchant information or specify an OAuth token
|
19
|
+
#to get the information for the merchant that granted you access.
|
20
|
+
#
|
21
|
+
#If you know the merchant ID, you can also use the [RetrieveMerchant](#endpoint-merchants-retrievemerchant)
|
22
|
+
#endpoint to get the merchant information.
|
23
|
+
def test_list_merchants()
|
24
|
+
# Parameters for the API call
|
25
|
+
cursor = nil
|
26
|
+
|
27
|
+
# Perform the API call through the SDK function
|
28
|
+
result = @controller.list_merchants(cursor: cursor)
|
29
|
+
|
30
|
+
# Test response code
|
31
|
+
assert_equal(200, @response_catcher.response.status_code)
|
32
|
+
|
33
|
+
# Test headers
|
34
|
+
expected_headers = {}
|
35
|
+
expected_headers['content-type'] = 'application/json'
|
36
|
+
|
37
|
+
assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
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: 3.
|
4
|
+
version: 3.20191023.0
|
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: 2019-
|
11
|
+
date: 2019-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- test/api/test_employees_api.rb
|
159
159
|
- test/api/test_labor_api.rb
|
160
160
|
- test/api/test_locations_api.rb
|
161
|
+
- test/api/test_merchants_api.rb
|
161
162
|
- test/api/test_payments_api.rb
|
162
163
|
- test/api/test_refunds_api.rb
|
163
164
|
- test/http_response_catcher.rb
|