square.rb 6.2.0.20200812 → 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/README.md +0 -2
- data/lib/square.rb +1 -2
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/employees_api.rb +3 -2
- data/lib/square/api/inventory_api.rb +3 -2
- data/lib/square/api/labor_api.rb +77 -0
- data/lib/square/api/orders_api.rb +62 -80
- data/lib/square/api/subscriptions_api.rb +3 -14
- data/lib/square/client.rb +8 -14
- data/lib/square/configuration.rb +1 -1
- metadata +2 -3
- data/lib/square/api/reporting_api.rb +0 -138
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 973136d2e4f8177385869ee692c78d893fc79df5a5cb27512a57a24318027cfe
|
4
|
+
data.tar.gz: 8b502686044b15c7a047abc2c2a6dfa44cd7741406892b7bfb1f42e5a8af9190
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1138a5aeefa0e9f4a1c7fbb8d9275b7f9519bcd3092f7ee694818e00077c661893fa5c1c200d75b587bf8f6a4752b874c32f00a7f089036304302c880e5d2fc9
|
7
|
+
data.tar.gz: 669ef667f74ed01898f5fabcde7be3c92835878cc7a0fbded426b44906478a7c37dc72d1d3bd730c9d6b4701754592b24414cd33ca30402741664997907d403b
|
data/README.md
CHANGED
@@ -80,7 +80,6 @@ gem 'square.rb'
|
|
80
80
|
* [V1 Transactions]
|
81
81
|
* [V1 Items]
|
82
82
|
* [Transactions]
|
83
|
-
* [Reporting]
|
84
83
|
|
85
84
|
## Usage
|
86
85
|
|
@@ -308,7 +307,6 @@ You can also use the Square API to create applications or services that work wit
|
|
308
307
|
[Invoices]: doc/invoices.md
|
309
308
|
[Apple Pay]: doc/apple-pay.md
|
310
309
|
[Refunds]: doc/refunds.md
|
311
|
-
[Reporting]: doc/reporting.md
|
312
310
|
[Mobile Authorization]: doc/mobile-authorization.md
|
313
311
|
[O Auth]: doc/o-auth.md
|
314
312
|
[V1 Locations]: doc/v1-locations.md
|
data/lib/square.rb
CHANGED
@@ -49,12 +49,11 @@ require_relative 'square/api/inventory_api.rb'
|
|
49
49
|
require_relative 'square/api/invoices_api.rb'
|
50
50
|
require_relative 'square/api/labor_api.rb'
|
51
51
|
require_relative 'square/api/locations_api.rb'
|
52
|
-
require_relative 'square/api/reporting_api.rb'
|
53
52
|
require_relative 'square/api/checkout_api.rb'
|
54
|
-
require_relative 'square/api/orders_api.rb'
|
55
53
|
require_relative 'square/api/transactions_api.rb'
|
56
54
|
require_relative 'square/api/loyalty_api.rb'
|
57
55
|
require_relative 'square/api/merchants_api.rb'
|
56
|
+
require_relative 'square/api/orders_api.rb'
|
58
57
|
require_relative 'square/api/payments_api.rb'
|
59
58
|
require_relative 'square/api/refunds_api.rb'
|
60
59
|
require_relative 'square/api/subscriptions_api.rb'
|
data/lib/square/api/base_api.rb
CHANGED
@@ -6,8 +6,7 @@ module Square
|
|
6
6
|
end
|
7
7
|
|
8
8
|
# ListEmployees
|
9
|
-
# @param [String] location_id Optional parameter:
|
10
|
-
# to only those that are associated with the specified location.
|
9
|
+
# @param [String] location_id Optional parameter: Example:
|
11
10
|
# @param [EmployeeStatus] status Optional parameter: Specifies the
|
12
11
|
# EmployeeStatus to filter the employee by.
|
13
12
|
# @param [Integer] limit Optional parameter: The number of employees to be
|
@@ -19,6 +18,7 @@ module Square
|
|
19
18
|
status: nil,
|
20
19
|
limit: nil,
|
21
20
|
cursor: nil)
|
21
|
+
warn 'Endpoint list_employees in EmployeesApi is deprecated'
|
22
22
|
# Prepare query url.
|
23
23
|
_query_builder = config.get_base_uri
|
24
24
|
_query_builder << '/v2/employees'
|
@@ -55,6 +55,7 @@ module Square
|
|
55
55
|
# requested.
|
56
56
|
# @return [RetrieveEmployeeResponse Hash] response from the API call
|
57
57
|
def retrieve_employee(id:)
|
58
|
+
warn 'Endpoint retrieve_employee in EmployeesApi is deprecated'
|
58
59
|
# Prepare query url.
|
59
60
|
_query_builder = config.get_base_uri
|
60
61
|
_query_builder << '/v2/employees/{id}'
|
@@ -242,8 +242,9 @@ module Square
|
|
242
242
|
# [Location](#type-location)s.
|
243
243
|
# Results are paginated and sorted in descending order according to their
|
244
244
|
# `occurred_at` timestamp (newest first).
|
245
|
-
# There are no limits on how far back the caller can page. This endpoint
|
246
|
-
#
|
245
|
+
# There are no limits on how far back the caller can page. This endpoint can
|
246
|
+
# be
|
247
|
+
# used to display recent changes for a specific item. For more
|
247
248
|
# sophisticated queries, use a batch endpoint.
|
248
249
|
# @param [String] catalog_object_id Required parameter: ID of the
|
249
250
|
# [CatalogObject](#type-catalogobject) to retrieve.
|
data/lib/square/api/labor_api.rb
CHANGED
@@ -209,6 +209,7 @@ module Square
|
|
209
209
|
def list_employee_wages(employee_id: nil,
|
210
210
|
limit: nil,
|
211
211
|
cursor: nil)
|
212
|
+
warn 'Endpoint list_employee_wages in LaborApi is deprecated'
|
212
213
|
# Prepare query url.
|
213
214
|
_query_builder = config.get_base_uri
|
214
215
|
_query_builder << '/v2/labor/employee-wages'
|
@@ -244,6 +245,7 @@ module Square
|
|
244
245
|
# retrieved.
|
245
246
|
# @return [GetEmployeeWageResponse Hash] response from the API call
|
246
247
|
def get_employee_wage(id:)
|
248
|
+
warn 'Endpoint get_employee_wage in LaborApi is deprecated'
|
247
249
|
# Prepare query url.
|
248
250
|
_query_builder = config.get_base_uri
|
249
251
|
_query_builder << '/v2/labor/employee-wages/{id}'
|
@@ -474,6 +476,81 @@ module Square
|
|
474
476
|
ApiResponse.new(_response, data: decoded, errors: _errors)
|
475
477
|
end
|
476
478
|
|
479
|
+
# Returns a paginated list of `TeamMemberWage` instances for a business.
|
480
|
+
# @param [String] team_member_id Optional parameter: Filter wages returned
|
481
|
+
# to only those that are associated with the specified team member.
|
482
|
+
# @param [Integer] limit Optional parameter: Maximum number of Team Member
|
483
|
+
# Wages to return per page. Can range between 1 and 200. The default is the
|
484
|
+
# maximum at 200.
|
485
|
+
# @param [String] cursor Optional parameter: Pointer to the next page of
|
486
|
+
# Employee Wage results to fetch.
|
487
|
+
# @return [ListTeamMemberWagesResponse Hash] response from the API call
|
488
|
+
def list_team_member_wages(team_member_id: nil,
|
489
|
+
limit: nil,
|
490
|
+
cursor: nil)
|
491
|
+
# Prepare query url.
|
492
|
+
_query_builder = config.get_base_uri
|
493
|
+
_query_builder << '/v2/labor/team-member-wages'
|
494
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
495
|
+
_query_builder,
|
496
|
+
'team_member_id' => team_member_id,
|
497
|
+
'limit' => limit,
|
498
|
+
'cursor' => cursor
|
499
|
+
)
|
500
|
+
_query_url = APIHelper.clean_url _query_builder
|
501
|
+
|
502
|
+
# Prepare headers.
|
503
|
+
_headers = {
|
504
|
+
'accept' => 'application/json'
|
505
|
+
}
|
506
|
+
|
507
|
+
# Prepare and execute HttpRequest.
|
508
|
+
_request = config.http_client.get(
|
509
|
+
_query_url,
|
510
|
+
headers: _headers
|
511
|
+
)
|
512
|
+
OAuth2.apply(config, _request)
|
513
|
+
_response = execute_request(_request)
|
514
|
+
|
515
|
+
# Return appropriate response type.
|
516
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
517
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
518
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
519
|
+
end
|
520
|
+
|
521
|
+
# Returns a single `TeamMemberWage` specified by id.
|
522
|
+
# @param [String] id Required parameter: UUID for the `TeamMemberWage` being
|
523
|
+
# retrieved.
|
524
|
+
# @return [GetTeamMemberWageResponse Hash] response from the API call
|
525
|
+
def get_team_member_wage(id:)
|
526
|
+
# Prepare query url.
|
527
|
+
_query_builder = config.get_base_uri
|
528
|
+
_query_builder << '/v2/labor/team-member-wages/{id}'
|
529
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
530
|
+
_query_builder,
|
531
|
+
'id' => id
|
532
|
+
)
|
533
|
+
_query_url = APIHelper.clean_url _query_builder
|
534
|
+
|
535
|
+
# Prepare headers.
|
536
|
+
_headers = {
|
537
|
+
'accept' => 'application/json'
|
538
|
+
}
|
539
|
+
|
540
|
+
# Prepare and execute HttpRequest.
|
541
|
+
_request = config.http_client.get(
|
542
|
+
_query_url,
|
543
|
+
headers: _headers
|
544
|
+
)
|
545
|
+
OAuth2.apply(config, _request)
|
546
|
+
_response = execute_request(_request)
|
547
|
+
|
548
|
+
# Return appropriate response type.
|
549
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
550
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
551
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
552
|
+
end
|
553
|
+
|
477
554
|
# Returns a list of `WorkweekConfig` instances for a business.
|
478
555
|
# @param [Integer] limit Optional parameter: Maximum number of Workweek
|
479
556
|
# Configs to return per page.
|
@@ -16,21 +16,14 @@ module Square
|
|
16
16
|
# To learn more about the Orders API, see the
|
17
17
|
# [Orders API
|
18
18
|
# Overview](https://developer.squareup.com/docs/orders-api/what-it-does).
|
19
|
-
# @param [String] location_id Required parameter: The ID of the business
|
20
|
-
# location to associate the order with.
|
21
19
|
# @param [CreateOrderRequest] body Required parameter: An object containing
|
22
20
|
# the fields to POST for the request. See the corresponding object
|
23
21
|
# definition for field details.
|
24
22
|
# @return [CreateOrderResponse Hash] response from the API call
|
25
|
-
def create_order(
|
26
|
-
body:)
|
23
|
+
def create_order(body:)
|
27
24
|
# Prepare query url.
|
28
25
|
_query_builder = config.get_base_uri
|
29
|
-
_query_builder << '/v2/
|
30
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
31
|
-
_query_builder,
|
32
|
-
'location_id' => location_id
|
33
|
-
)
|
26
|
+
_query_builder << '/v2/orders'
|
34
27
|
_query_url = APIHelper.clean_url _query_builder
|
35
28
|
|
36
29
|
# Prepare headers.
|
@@ -57,21 +50,14 @@ module Square
|
|
57
50
|
# Retrieves a set of [Order](#type-order)s by their IDs.
|
58
51
|
# If a given Order ID does not exist, the ID is ignored instead of
|
59
52
|
# generating an error.
|
60
|
-
# @param [String] location_id Required parameter: The ID of the orders'
|
61
|
-
# associated location.
|
62
53
|
# @param [BatchRetrieveOrdersRequest] body Required parameter: An object
|
63
54
|
# containing the fields to POST for the request. See the corresponding
|
64
55
|
# object definition for field details.
|
65
56
|
# @return [BatchRetrieveOrdersResponse Hash] response from the API call
|
66
|
-
def batch_retrieve_orders(
|
67
|
-
body:)
|
57
|
+
def batch_retrieve_orders(body:)
|
68
58
|
# Prepare query url.
|
69
59
|
_query_builder = config.get_base_uri
|
70
|
-
_query_builder << '/v2/
|
71
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
72
|
-
_query_builder,
|
73
|
-
'location_id' => location_id
|
74
|
-
)
|
60
|
+
_query_builder << '/v2/orders/batch-retrieve'
|
75
61
|
_query_url = APIHelper.clean_url _query_builder
|
76
62
|
|
77
63
|
# Prepare headers.
|
@@ -95,68 +81,6 @@ module Square
|
|
95
81
|
ApiResponse.new(_response, data: decoded, errors: _errors)
|
96
82
|
end
|
97
83
|
|
98
|
-
# Updates an open [Order](#type-order) by adding, replacing, or deleting
|
99
|
-
# fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
|
100
|
-
# An UpdateOrder request requires the following:
|
101
|
-
# - The `order_id` in the endpoint path, identifying the order to update.
|
102
|
-
# - The latest `version` of the order to update.
|
103
|
-
# - The [sparse
|
104
|
-
# order](https://developer.squareup.com/docs/orders-api/manage-orders#sparse
|
105
|
-
# -order-objects)
|
106
|
-
# containing only the fields to update and the version the update is
|
107
|
-
# being applied to.
|
108
|
-
# - If deleting fields, the [dot notation
|
109
|
-
# paths](https://developer.squareup.com/docs/orders-api/manage-orders#on-dot
|
110
|
-
# -notation)
|
111
|
-
# identifying fields to clear.
|
112
|
-
# To pay for an order, please refer to the [Pay for
|
113
|
-
# Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders)
|
114
|
-
# guide.
|
115
|
-
# To learn more about the Orders API, see the
|
116
|
-
# [Orders API
|
117
|
-
# Overview](https://developer.squareup.com/docs/orders-api/what-it-does).
|
118
|
-
# @param [String] location_id Required parameter: The ID of the order's
|
119
|
-
# associated location.
|
120
|
-
# @param [String] order_id Required parameter: The ID of the order to
|
121
|
-
# update.
|
122
|
-
# @param [UpdateOrderRequest] body Required parameter: An object containing
|
123
|
-
# the fields to POST for the request. See the corresponding object
|
124
|
-
# definition for field details.
|
125
|
-
# @return [UpdateOrderResponse Hash] response from the API call
|
126
|
-
def update_order(location_id:,
|
127
|
-
order_id:,
|
128
|
-
body:)
|
129
|
-
# Prepare query url.
|
130
|
-
_query_builder = config.get_base_uri
|
131
|
-
_query_builder << '/v2/locations/{location_id}/orders/{order_id}'
|
132
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
133
|
-
_query_builder,
|
134
|
-
'location_id' => location_id,
|
135
|
-
'order_id' => order_id
|
136
|
-
)
|
137
|
-
_query_url = APIHelper.clean_url _query_builder
|
138
|
-
|
139
|
-
# Prepare headers.
|
140
|
-
_headers = {
|
141
|
-
'accept' => 'application/json',
|
142
|
-
'content-type' => 'application/json; charset=utf-8'
|
143
|
-
}
|
144
|
-
|
145
|
-
# Prepare and execute HttpRequest.
|
146
|
-
_request = config.http_client.put(
|
147
|
-
_query_url,
|
148
|
-
headers: _headers,
|
149
|
-
parameters: body.to_json
|
150
|
-
)
|
151
|
-
OAuth2.apply(config, _request)
|
152
|
-
_response = execute_request(_request)
|
153
|
-
|
154
|
-
# Return appropriate response type.
|
155
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
156
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
157
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
158
|
-
end
|
159
|
-
|
160
84
|
# Calculates an [Order](#type-order).
|
161
85
|
# @param [CalculateOrderRequest] body Required parameter: An object
|
162
86
|
# containing the fields to POST for the request. See the corresponding
|
@@ -236,6 +160,64 @@ module Square
|
|
236
160
|
ApiResponse.new(_response, data: decoded, errors: _errors)
|
237
161
|
end
|
238
162
|
|
163
|
+
# Updates an open [Order](#type-order) by adding, replacing, or deleting
|
164
|
+
# fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
|
165
|
+
# An UpdateOrder request requires the following:
|
166
|
+
# - The `order_id` in the endpoint path, identifying the order to update.
|
167
|
+
# - The latest `version` of the order to update.
|
168
|
+
# - The [sparse
|
169
|
+
# order](https://developer.squareup.com/docs/orders-api/manage-orders#sparse
|
170
|
+
# -order-objects)
|
171
|
+
# containing only the fields to update and the version the update is
|
172
|
+
# being applied to.
|
173
|
+
# - If deleting fields, the [dot notation
|
174
|
+
# paths](https://developer.squareup.com/docs/orders-api/manage-orders#on-dot
|
175
|
+
# -notation)
|
176
|
+
# identifying fields to clear.
|
177
|
+
# To pay for an order, please refer to the [Pay for
|
178
|
+
# Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders)
|
179
|
+
# guide.
|
180
|
+
# To learn more about the Orders API, see the
|
181
|
+
# [Orders API
|
182
|
+
# Overview](https://developer.squareup.com/docs/orders-api/what-it-does).
|
183
|
+
# @param [String] order_id Required parameter: The ID of the order to
|
184
|
+
# update.
|
185
|
+
# @param [UpdateOrderRequest] body Required parameter: An object containing
|
186
|
+
# the fields to POST for the request. See the corresponding object
|
187
|
+
# definition for field details.
|
188
|
+
# @return [UpdateOrderResponse Hash] response from the API call
|
189
|
+
def update_order(order_id:,
|
190
|
+
body:)
|
191
|
+
# Prepare query url.
|
192
|
+
_query_builder = config.get_base_uri
|
193
|
+
_query_builder << '/v2/orders/{order_id}'
|
194
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
195
|
+
_query_builder,
|
196
|
+
'order_id' => order_id
|
197
|
+
)
|
198
|
+
_query_url = APIHelper.clean_url _query_builder
|
199
|
+
|
200
|
+
# Prepare headers.
|
201
|
+
_headers = {
|
202
|
+
'accept' => 'application/json',
|
203
|
+
'content-type' => 'application/json; charset=utf-8'
|
204
|
+
}
|
205
|
+
|
206
|
+
# Prepare and execute HttpRequest.
|
207
|
+
_request = config.http_client.put(
|
208
|
+
_query_url,
|
209
|
+
headers: _headers,
|
210
|
+
parameters: body.to_json
|
211
|
+
)
|
212
|
+
OAuth2.apply(config, _request)
|
213
|
+
_response = execute_request(_request)
|
214
|
+
|
215
|
+
# Return appropriate response type.
|
216
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
217
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
218
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
219
|
+
end
|
220
|
+
|
239
221
|
# Pay for an [order](#type-order) using one or more approved
|
240
222
|
# [payments](#type-payment),
|
241
223
|
# or settle an order with a total of `0`.
|
@@ -12,10 +12,6 @@ module Square
|
|
12
12
|
# address. The subscription starts immediately, unless the request includes
|
13
13
|
# the optional `start_date`. Each individual subscription is associated with
|
14
14
|
# a particular location.
|
15
|
-
# For more information,
|
16
|
-
# see [Subscription API
|
17
|
-
# Overview](https://developer.squareup.com/docs/docs/subscriptions-api/overv
|
18
|
-
# iew).
|
19
15
|
# @param [CreateSubscriptionRequest] body Required parameter: An object
|
20
16
|
# containing the fields to POST for the request. See the corresponding
|
21
17
|
# object definition for field details.
|
@@ -129,10 +125,7 @@ module Square
|
|
129
125
|
end
|
130
126
|
|
131
127
|
# Updates a subscription. You can set, modify, and clear the
|
132
|
-
# `subscription` field values.
|
133
|
-
# [Update
|
134
|
-
# subscriptions](https://developer.squareup.com/docs/docs/subscriptions-api/
|
135
|
-
# overview#update-subscriptions).
|
128
|
+
# `subscription` field values.
|
136
129
|
# @param [String] subscription_id Required parameter: The ID for the
|
137
130
|
# subscription to update.
|
138
131
|
# @param [UpdateSubscriptionRequest] body Required parameter: An object
|
@@ -171,12 +164,8 @@ module Square
|
|
171
164
|
ApiResponse.new(_response, data: decoded, errors: _errors)
|
172
165
|
end
|
173
166
|
|
174
|
-
#
|
175
|
-
#
|
176
|
-
# endpoint to cancel a subscription at a future date. For more
|
177
|
-
# information, see
|
178
|
-
# [CancelSubscriptions](https://developer.squareup.com/docs/docs/subscriptio
|
179
|
-
# ns-api/overview#cancel-subscriptions).
|
167
|
+
# Sets the `canceled_date` field to the end of the active billing period.
|
168
|
+
# After this date, the status changes from ACTIVE to CANCELED.
|
180
169
|
# @param [String] subscription_id Required parameter: The ID of the
|
181
170
|
# subscription to cancel.
|
182
171
|
# @return [CancelSubscriptionResponse 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
|
-
'6.
|
7
|
+
'6.3.0.20200826'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -131,24 +131,12 @@ module Square
|
|
131
131
|
@locations ||= LocationsApi.new config
|
132
132
|
end
|
133
133
|
|
134
|
-
# Access to reporting controller.
|
135
|
-
# @return [ReportingApi] Returns the controller instance.
|
136
|
-
def reporting
|
137
|
-
@reporting ||= ReportingApi.new config
|
138
|
-
end
|
139
|
-
|
140
134
|
# Access to checkout controller.
|
141
135
|
# @return [CheckoutApi] Returns the controller instance.
|
142
136
|
def checkout
|
143
137
|
@checkout ||= CheckoutApi.new config
|
144
138
|
end
|
145
139
|
|
146
|
-
# Access to orders controller.
|
147
|
-
# @return [OrdersApi] Returns the controller instance.
|
148
|
-
def orders
|
149
|
-
@orders ||= OrdersApi.new config
|
150
|
-
end
|
151
|
-
|
152
140
|
# Access to transactions controller.
|
153
141
|
# @return [TransactionsApi] Returns the controller instance.
|
154
142
|
def transactions
|
@@ -167,6 +155,12 @@ module Square
|
|
167
155
|
@merchants ||= MerchantsApi.new config
|
168
156
|
end
|
169
157
|
|
158
|
+
# Access to orders controller.
|
159
|
+
# @return [OrdersApi] Returns the controller instance.
|
160
|
+
def orders
|
161
|
+
@orders ||= OrdersApi.new config
|
162
|
+
end
|
163
|
+
|
170
164
|
# Access to payments controller.
|
171
165
|
# @return [PaymentsApi] Returns the controller instance.
|
172
166
|
def payments
|
@@ -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-08-
|
196
|
+
square_version: '2020-08-26', 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-08-
|
25
|
+
square_version: '2020-08-26', 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: 6.
|
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-08-
|
11
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -141,7 +141,6 @@ files:
|
|
141
141
|
- lib/square/api/orders_api.rb
|
142
142
|
- lib/square/api/payments_api.rb
|
143
143
|
- lib/square/api/refunds_api.rb
|
144
|
-
- lib/square/api/reporting_api.rb
|
145
144
|
- lib/square/api/subscriptions_api.rb
|
146
145
|
- lib/square/api/team_api.rb
|
147
146
|
- lib/square/api/terminal_api.rb
|
@@ -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
|