square.rb 5.2.2.20200422 → 6.3.0.20200826
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/LICENSE +1 -1
- data/README.md +317 -285
- data/lib/square.rb +5 -2
- data/lib/square/api/base_api.rb +2 -2
- data/lib/square/api/catalog_api.rb +76 -57
- data/lib/square/api/customers_api.rb +16 -3
- data/lib/square/api/disputes_api.rb +1 -11
- data/lib/square/api/employees_api.rb +3 -2
- data/lib/square/api/inventory_api.rb +5 -4
- data/lib/square/api/invoices_api.rb +358 -0
- data/lib/square/api/labor_api.rb +77 -0
- data/lib/square/api/locations_api.rb +7 -2
- data/lib/square/api/loyalty_api.rb +543 -0
- data/lib/square/api/merchants_api.rb +2 -1
- data/lib/square/api/orders_api.rb +70 -56
- data/lib/square/api/payments_api.rb +3 -9
- data/lib/square/api/refunds_api.rb +3 -2
- data/lib/square/api/subscriptions_api.rb +251 -0
- data/lib/square/api/team_api.rb +326 -0
- data/lib/square/api/transactions_api.rb +0 -71
- data/lib/square/api/v1_employees_api.rb +3 -76
- data/lib/square/api/v1_items_api.rb +0 -360
- data/lib/square/api/v1_locations_api.rb +0 -18
- data/lib/square/api/v1_transactions_api.rb +1 -19
- data/lib/square/client.rb +35 -16
- data/lib/square/configuration.rb +12 -4
- metadata +7 -4
- data/lib/square/api/reporting_api.rb +0 -138
@@ -6,15 +6,6 @@ module Square
|
|
6
6
|
end
|
7
7
|
|
8
8
|
# Get the general information for a business.
|
9
|
-
# ---
|
10
|
-
# - __Deprecation date__: 2019-11-20
|
11
|
-
# - [__Retirement
|
12
|
-
# date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
|
13
|
-
# recated): 2020-11-18
|
14
|
-
# - [Migration
|
15
|
-
# guide](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-locat
|
16
|
-
# ions)
|
17
|
-
# ---
|
18
9
|
# @return [V1Merchant Hash] response from the API call
|
19
10
|
def retrieve_business
|
20
11
|
warn 'Endpoint retrieve_business in V1LocationsApi is deprecated'
|
@@ -44,15 +35,6 @@ module Square
|
|
44
35
|
|
45
36
|
# Provides details for all business locations associated with a Square
|
46
37
|
# account, including the Square-assigned object ID for the location.
|
47
|
-
# ---
|
48
|
-
# - __Deprecation date__: 2019-11-20
|
49
|
-
# - [__Retirement
|
50
|
-
# date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
|
51
|
-
# recated): 2020-11-18
|
52
|
-
# - [Migration
|
53
|
-
# guide](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-locat
|
54
|
-
# ions)
|
55
|
-
# ---
|
56
38
|
# @return [List of V1Merchant Hash] response from the API call
|
57
39
|
def list_locations
|
58
40
|
warn 'Endpoint list_locations in V1LocationsApi is deprecated'
|
@@ -8,15 +8,6 @@ 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
|
-
# ---
|
20
11
|
# @param [String] location_id Required parameter: The ID of the location to
|
21
12
|
# list bank accounts for.
|
22
13
|
# @return [List of V1BankAccount Hash] response from the API call
|
@@ -53,15 +44,6 @@ module Square
|
|
53
44
|
# Provides non-confidential details for a merchant's associated bank
|
54
45
|
# account. This endpoint does not provide full bank account numbers, and
|
55
46
|
# 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
|
-
# ---
|
65
47
|
# @param [String] location_id Required parameter: The ID of the bank
|
66
48
|
# account's associated location.
|
67
49
|
# @param [String] bank_account_id Required parameter: The bank account's
|
@@ -272,7 +254,7 @@ module Square
|
|
272
254
|
end_time: nil,
|
273
255
|
limit: nil,
|
274
256
|
batch_token: nil,
|
275
|
-
include_partial:
|
257
|
+
include_partial: false)
|
276
258
|
# Prepare query url.
|
277
259
|
_query_builder = config.get_base_uri
|
278
260
|
_query_builder << '/v1/{location_id}/payments'
|
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
|
+
'6.3.0.20200826'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
11
|
-
|
11
|
+
config.square_version
|
12
12
|
end
|
13
13
|
|
14
14
|
# Access to mobile_authorization controller.
|
@@ -113,6 +113,12 @@ module Square
|
|
113
113
|
@inventory ||= InventoryApi.new config
|
114
114
|
end
|
115
115
|
|
116
|
+
# Access to invoices controller.
|
117
|
+
# @return [InvoicesApi] Returns the controller instance.
|
118
|
+
def invoices
|
119
|
+
@invoices ||= InvoicesApi.new config
|
120
|
+
end
|
121
|
+
|
116
122
|
# Access to labor controller.
|
117
123
|
# @return [LaborApi] Returns the controller instance.
|
118
124
|
def labor
|
@@ -125,36 +131,36 @@ module Square
|
|
125
131
|
@locations ||= LocationsApi.new config
|
126
132
|
end
|
127
133
|
|
128
|
-
# Access to reporting controller.
|
129
|
-
# @return [ReportingApi] Returns the controller instance.
|
130
|
-
def reporting
|
131
|
-
@reporting ||= ReportingApi.new config
|
132
|
-
end
|
133
|
-
|
134
134
|
# Access to checkout controller.
|
135
135
|
# @return [CheckoutApi] Returns the controller instance.
|
136
136
|
def checkout
|
137
137
|
@checkout ||= CheckoutApi.new config
|
138
138
|
end
|
139
139
|
|
140
|
-
# Access to orders controller.
|
141
|
-
# @return [OrdersApi] Returns the controller instance.
|
142
|
-
def orders
|
143
|
-
@orders ||= OrdersApi.new config
|
144
|
-
end
|
145
|
-
|
146
140
|
# Access to transactions controller.
|
147
141
|
# @return [TransactionsApi] Returns the controller instance.
|
148
142
|
def transactions
|
149
143
|
@transactions ||= TransactionsApi.new config
|
150
144
|
end
|
151
145
|
|
146
|
+
# Access to loyalty controller.
|
147
|
+
# @return [LoyaltyApi] Returns the controller instance.
|
148
|
+
def loyalty
|
149
|
+
@loyalty ||= LoyaltyApi.new config
|
150
|
+
end
|
151
|
+
|
152
152
|
# Access to merchants controller.
|
153
153
|
# @return [MerchantsApi] Returns the controller instance.
|
154
154
|
def merchants
|
155
155
|
@merchants ||= MerchantsApi.new config
|
156
156
|
end
|
157
157
|
|
158
|
+
# Access to orders controller.
|
159
|
+
# @return [OrdersApi] Returns the controller instance.
|
160
|
+
def orders
|
161
|
+
@orders ||= OrdersApi.new config
|
162
|
+
end
|
163
|
+
|
158
164
|
# Access to payments controller.
|
159
165
|
# @return [PaymentsApi] Returns the controller instance.
|
160
166
|
def payments
|
@@ -167,6 +173,18 @@ module Square
|
|
167
173
|
@refunds ||= RefundsApi.new config
|
168
174
|
end
|
169
175
|
|
176
|
+
# Access to subscriptions controller.
|
177
|
+
# @return [SubscriptionsApi] Returns the controller instance.
|
178
|
+
def subscriptions
|
179
|
+
@subscriptions ||= SubscriptionsApi.new config
|
180
|
+
end
|
181
|
+
|
182
|
+
# Access to team controller.
|
183
|
+
# @return [TeamApi] Returns the controller instance.
|
184
|
+
def team
|
185
|
+
@team ||= TeamApi.new config
|
186
|
+
end
|
187
|
+
|
170
188
|
# Access to terminal controller.
|
171
189
|
# @return [TerminalApi] Returns the controller instance.
|
172
190
|
def terminal
|
@@ -175,13 +193,14 @@ module Square
|
|
175
193
|
|
176
194
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
177
195
|
backoff_factor: 1, environment: 'production',
|
178
|
-
access_token: 'TODO: Replace',
|
179
|
-
config: nil)
|
196
|
+
square_version: '2020-08-26', access_token: 'TODO: Replace',
|
197
|
+
additional_headers: {}, config: nil)
|
180
198
|
@config = if config.nil?
|
181
199
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
182
200
|
retry_interval: retry_interval,
|
183
201
|
backoff_factor: backoff_factor,
|
184
202
|
environment: environment,
|
203
|
+
square_version: square_version,
|
185
204
|
access_token: access_token,
|
186
205
|
additional_headers: additional_headers)
|
187
206
|
else
|
data/lib/square/configuration.rb
CHANGED
@@ -9,6 +9,7 @@ module Square
|
|
9
9
|
attr_reader :retry_interval
|
10
10
|
attr_reader :backoff_factor
|
11
11
|
attr_reader :environment
|
12
|
+
attr_reader :square_version
|
12
13
|
attr_reader :access_token
|
13
14
|
|
14
15
|
def additional_headers
|
@@ -21,7 +22,8 @@ module Square
|
|
21
22
|
|
22
23
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
23
24
|
backoff_factor: 1, environment: 'production',
|
24
|
-
access_token: 'TODO: Replace',
|
25
|
+
square_version: '2020-08-26', access_token: 'TODO: Replace',
|
26
|
+
additional_headers: {})
|
25
27
|
# The value to use for connection timeout
|
26
28
|
@timeout = timeout
|
27
29
|
|
@@ -38,6 +40,9 @@ module Square
|
|
38
40
|
# Current API environment
|
39
41
|
@environment = String(environment)
|
40
42
|
|
43
|
+
# Square Connect API versions
|
44
|
+
@square_version = square_version
|
45
|
+
|
41
46
|
# OAuth 2.0 Access Token
|
42
47
|
@access_token = access_token
|
43
48
|
|
@@ -49,20 +54,23 @@ module Square
|
|
49
54
|
end
|
50
55
|
|
51
56
|
def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
|
52
|
-
backoff_factor: nil, environment: nil,
|
53
|
-
additional_headers: nil)
|
57
|
+
backoff_factor: nil, environment: nil, square_version: nil,
|
58
|
+
access_token: nil, additional_headers: nil)
|
54
59
|
timeout ||= self.timeout
|
55
60
|
max_retries ||= self.max_retries
|
56
61
|
retry_interval ||= self.retry_interval
|
57
62
|
backoff_factor ||= self.backoff_factor
|
58
63
|
environment ||= self.environment
|
64
|
+
square_version ||= self.square_version
|
59
65
|
access_token ||= self.access_token
|
60
66
|
additional_headers ||= self.additional_headers
|
61
67
|
|
62
68
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
63
69
|
retry_interval: retry_interval,
|
64
70
|
backoff_factor: backoff_factor,
|
65
|
-
environment: environment,
|
71
|
+
environment: environment,
|
72
|
+
square_version: square_version,
|
73
|
+
access_token: access_token,
|
66
74
|
additional_headers: additional_headers)
|
67
75
|
end
|
68
76
|
|
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: 6.3.0.20200826
|
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-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -131,15 +131,18 @@ files:
|
|
131
131
|
- lib/square/api/disputes_api.rb
|
132
132
|
- lib/square/api/employees_api.rb
|
133
133
|
- lib/square/api/inventory_api.rb
|
134
|
+
- lib/square/api/invoices_api.rb
|
134
135
|
- lib/square/api/labor_api.rb
|
135
136
|
- lib/square/api/locations_api.rb
|
137
|
+
- lib/square/api/loyalty_api.rb
|
136
138
|
- lib/square/api/merchants_api.rb
|
137
139
|
- lib/square/api/mobile_authorization_api.rb
|
138
140
|
- lib/square/api/o_auth_api.rb
|
139
141
|
- lib/square/api/orders_api.rb
|
140
142
|
- lib/square/api/payments_api.rb
|
141
143
|
- lib/square/api/refunds_api.rb
|
142
|
-
- lib/square/api/
|
144
|
+
- lib/square/api/subscriptions_api.rb
|
145
|
+
- lib/square/api/team_api.rb
|
143
146
|
- lib/square/api/terminal_api.rb
|
144
147
|
- lib/square/api/transactions_api.rb
|
145
148
|
- lib/square/api/v1_employees_api.rb
|
@@ -190,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
193
|
- !ruby/object:Gem::Version
|
191
194
|
version: '0'
|
192
195
|
requirements: []
|
193
|
-
rubygems_version: 3.0.
|
196
|
+
rubygems_version: 3.0.8
|
194
197
|
signing_key:
|
195
198
|
specification_version: 4
|
196
199
|
summary: square
|
@@ -1,138 +0,0 @@
|
|
1
|
-
module Square
|
2
|
-
# ReportingApi
|
3
|
-
class ReportingApi < 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 refunded transactions (across all possible originating
|
9
|
-
# locations) relating to monies
|
10
|
-
# credited to the provided location ID by another Square account using the
|
11
|
-
# `additional_recipients` field in a transaction.
|
12
|
-
# Max results per [page](#paginatingresults): 50
|
13
|
-
# @param [String] location_id Required parameter: The ID of the location to
|
14
|
-
# list AdditionalRecipientReceivableRefunds for.
|
15
|
-
# @param [String] begin_time Optional parameter: The beginning of the
|
16
|
-
# requested reporting period, in RFC 3339 format. See [Date
|
17
|
-
# ranges](#dateranges) for details on date inclusivity/exclusivity. Default
|
18
|
-
# value: The current time minus one year.
|
19
|
-
# @param [String] end_time Optional parameter: The end of the requested
|
20
|
-
# reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
|
21
|
-
# details on date inclusivity/exclusivity. Default value: The current
|
22
|
-
# time.
|
23
|
-
# @param [SortOrder] sort_order Optional parameter: The order in which
|
24
|
-
# results are listed in the response (`ASC` for oldest first, `DESC` for
|
25
|
-
# newest first). Default value: `DESC`
|
26
|
-
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
27
|
-
# a previous call to this endpoint. Provide this to retrieve the next set of
|
28
|
-
# results for your original query. See [Paginating
|
29
|
-
# results](#paginatingresults) for more information.
|
30
|
-
# @return [ListAdditionalRecipientReceivableRefundsResponse Hash] response from the API call
|
31
|
-
def list_additional_recipient_receivable_refunds(location_id:,
|
32
|
-
begin_time: nil,
|
33
|
-
end_time: nil,
|
34
|
-
sort_order: nil,
|
35
|
-
cursor: nil)
|
36
|
-
warn 'Endpoint list_additional_recipient_receivable_refunds in Reporting'\
|
37
|
-
'Api is deprecated'
|
38
|
-
# Prepare query url.
|
39
|
-
_query_builder = config.get_base_uri
|
40
|
-
_query_builder << '/v2/locations/{location_id}/additional-recipient-receivable-refunds'
|
41
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
42
|
-
_query_builder,
|
43
|
-
'location_id' => location_id
|
44
|
-
)
|
45
|
-
_query_builder = APIHelper.append_url_with_query_parameters(
|
46
|
-
_query_builder,
|
47
|
-
'begin_time' => begin_time,
|
48
|
-
'end_time' => end_time,
|
49
|
-
'sort_order' => sort_order,
|
50
|
-
'cursor' => cursor
|
51
|
-
)
|
52
|
-
_query_url = APIHelper.clean_url _query_builder
|
53
|
-
|
54
|
-
# Prepare headers.
|
55
|
-
_headers = {
|
56
|
-
'accept' => 'application/json'
|
57
|
-
}
|
58
|
-
|
59
|
-
# Prepare and execute HttpRequest.
|
60
|
-
_request = config.http_client.get(
|
61
|
-
_query_url,
|
62
|
-
headers: _headers
|
63
|
-
)
|
64
|
-
OAuth2.apply(config, _request)
|
65
|
-
_response = execute_request(_request)
|
66
|
-
|
67
|
-
# Return appropriate response type.
|
68
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
69
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
70
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
71
|
-
end
|
72
|
-
|
73
|
-
# Returns a list of receivables (across all possible sending locations)
|
74
|
-
# representing monies credited
|
75
|
-
# to the provided location ID by another Square account using the
|
76
|
-
# `additional_recipients` field in a transaction.
|
77
|
-
# Max results per [page](#paginatingresults): 50
|
78
|
-
# @param [String] location_id Required parameter: The ID of the location to
|
79
|
-
# list AdditionalRecipientReceivables for.
|
80
|
-
# @param [String] begin_time Optional parameter: The beginning of the
|
81
|
-
# requested reporting period, in RFC 3339 format. See [Date
|
82
|
-
# ranges](#dateranges) for details on date inclusivity/exclusivity. Default
|
83
|
-
# value: The current time minus one year.
|
84
|
-
# @param [String] end_time Optional parameter: The end of the requested
|
85
|
-
# reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
|
86
|
-
# details on date inclusivity/exclusivity. Default value: The current
|
87
|
-
# time.
|
88
|
-
# @param [SortOrder] sort_order Optional parameter: The order in which
|
89
|
-
# results are listed in the response (`ASC` for oldest first, `DESC` for
|
90
|
-
# newest first). Default value: `DESC`
|
91
|
-
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
92
|
-
# a previous call to this endpoint. Provide this to retrieve the next set of
|
93
|
-
# results for your original query. See [Paginating
|
94
|
-
# results](#paginatingresults) for more information.
|
95
|
-
# @return [ListAdditionalRecipientReceivablesResponse Hash] response from the API call
|
96
|
-
def list_additional_recipient_receivables(location_id:,
|
97
|
-
begin_time: nil,
|
98
|
-
end_time: nil,
|
99
|
-
sort_order: nil,
|
100
|
-
cursor: nil)
|
101
|
-
warn 'Endpoint list_additional_recipient_receivables in ReportingApi is '\
|
102
|
-
'deprecated'
|
103
|
-
# Prepare query url.
|
104
|
-
_query_builder = config.get_base_uri
|
105
|
-
_query_builder << '/v2/locations/{location_id}/additional-recipient-receivables'
|
106
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
107
|
-
_query_builder,
|
108
|
-
'location_id' => location_id
|
109
|
-
)
|
110
|
-
_query_builder = APIHelper.append_url_with_query_parameters(
|
111
|
-
_query_builder,
|
112
|
-
'begin_time' => begin_time,
|
113
|
-
'end_time' => end_time,
|
114
|
-
'sort_order' => sort_order,
|
115
|
-
'cursor' => cursor
|
116
|
-
)
|
117
|
-
_query_url = APIHelper.clean_url _query_builder
|
118
|
-
|
119
|
-
# Prepare headers.
|
120
|
-
_headers = {
|
121
|
-
'accept' => 'application/json'
|
122
|
-
}
|
123
|
-
|
124
|
-
# Prepare and execute HttpRequest.
|
125
|
-
_request = config.http_client.get(
|
126
|
-
_query_url,
|
127
|
-
headers: _headers
|
128
|
-
)
|
129
|
-
OAuth2.apply(config, _request)
|
130
|
-
_response = execute_request(_request)
|
131
|
-
|
132
|
-
# Return appropriate response type.
|
133
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
134
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
135
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|