square.rb 6.5.0.20201028 → 9.1.0.20210317
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 +42 -31
- data/lib/square.rb +1 -2
- data/lib/square/api/apple_pay_api.rb +8 -7
- data/lib/square/api/bank_accounts_api.rb +4 -4
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/bookings_api.rb +308 -0
- data/lib/square/api/cash_drawers_api.rb +2 -1
- data/lib/square/api/catalog_api.rb +24 -10
- data/lib/square/api/checkout_api.rb +2 -2
- data/lib/square/api/customer_segments_api.rb +2 -2
- data/lib/square/api/disputes_api.rb +33 -35
- data/lib/square/api/inventory_api.rb +2 -2
- data/lib/square/api/invoices_api.rb +15 -12
- data/lib/square/api/loyalty_api.rb +1 -1
- data/lib/square/api/mobile_authorization_api.rb +2 -2
- data/lib/square/api/o_auth_api.rb +1 -4
- data/lib/square/api/payments_api.rb +57 -18
- data/lib/square/api/refunds_api.rb +26 -21
- data/lib/square/api/subscriptions_api.rb +4 -4
- data/lib/square/api/team_api.rb +14 -14
- data/lib/square/api/terminal_api.rb +15 -14
- data/lib/square/api/v1_employees_api.rb +0 -394
- data/lib/square/api/v1_transactions_api.rb +2 -83
- data/lib/square/client.rb +10 -14
- data/lib/square/configuration.rb +21 -6
- data/lib/square/http/faraday_client.rb +8 -2
- metadata +4 -5
- data/lib/square/api/v1_items_api.rb +0 -1766
- data/lib/square/api/v1_locations_api.rb +0 -69
@@ -7,35 +7,35 @@ module Square
|
|
7
7
|
|
8
8
|
# Retrieves a list of refunds for the account making the request.
|
9
9
|
# The maximum results per page is 100.
|
10
|
-
# @param [String] begin_time Optional parameter:
|
11
|
-
# of the requested reporting period, in RFC 3339 format. Default:
|
12
|
-
# current time minus one year.
|
13
|
-
# @param [String] end_time Optional parameter:
|
14
|
-
# requested reporting period, in RFC 3339 format. Default: The current
|
10
|
+
# @param [String] begin_time Optional parameter: The timestamp for the
|
11
|
+
# beginning of the requested reporting period, in RFC 3339 format. Default:
|
12
|
+
# The current time minus one year.
|
13
|
+
# @param [String] end_time Optional parameter: The timestamp for the end of
|
14
|
+
# the requested reporting period, in RFC 3339 format. Default: The current
|
15
15
|
# time.
|
16
16
|
# @param [String] sort_order Optional parameter: The order in which results
|
17
|
-
# are listed
|
17
|
+
# are listed: - `ASC` - Oldest to newest. - `DESC` - Newest to oldest
|
18
18
|
# (default).
|
19
19
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
20
|
-
# a previous call to this endpoint. Provide this to retrieve the next
|
21
|
-
# results for the original query.
|
20
|
+
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
21
|
+
# set of results for the original query. For more information, see
|
22
22
|
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
23
|
-
#
|
23
|
+
# .
|
24
24
|
# @param [String] location_id Optional parameter: Limit results to the
|
25
25
|
# location supplied. By default, results are returned for all locations
|
26
|
-
# associated with the
|
26
|
+
# associated with the seller.
|
27
27
|
# @param [String] status Optional parameter: If provided, only refunds with
|
28
28
|
# the given status are returned. For a list of refund status values, see
|
29
|
-
# [PaymentRefund](#type-paymentrefund). Default: If omitted refunds are
|
30
|
-
# returned regardless of status.
|
29
|
+
# [PaymentRefund](#type-paymentrefund). Default: If omitted, refunds are
|
30
|
+
# returned regardless of their status.
|
31
31
|
# @param [String] source_type Optional parameter: If provided, only refunds
|
32
32
|
# with the given source type are returned. - `CARD` - List refunds only for
|
33
|
-
# payments where
|
34
|
-
# refunds are returned regardless of source type.
|
35
|
-
# @param [Integer] limit Optional parameter:
|
36
|
-
# returned in a single page.
|
37
|
-
# the specified limit on a given page. If the supplied value is
|
38
|
-
# than 100,
|
33
|
+
# payments where `CARD` was specified as the payment source. Default: If
|
34
|
+
# omitted, refunds are returned regardless of the source type.
|
35
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
36
|
+
# to be returned in a single page. It is possible to receive fewer results
|
37
|
+
# than the specified limit on a given page. If the supplied value is
|
38
|
+
# greater than 100, no more than 100 results are returned. Default: 100
|
39
39
|
# @return [ListPaymentRefundsResponse Hash] response from the API call
|
40
40
|
def list_payment_refunds(begin_time: nil,
|
41
41
|
end_time: nil,
|
@@ -83,7 +83,12 @@ module Square
|
|
83
83
|
end
|
84
84
|
|
85
85
|
# Refunds a payment. You can refund the entire payment amount or a
|
86
|
-
# portion of it.
|
86
|
+
# portion of it. You can use this endpoint to refund a card payment or
|
87
|
+
# record a
|
88
|
+
# refund of a cash or external payment. For more information, see
|
89
|
+
# [Refund
|
90
|
+
# Payment](https://developer.squareup.com/docs/payments-api/refund-payments)
|
91
|
+
# .
|
87
92
|
# @param [RefundPaymentRequest] body Required parameter: An object
|
88
93
|
# containing the fields to POST for the request. See the corresponding
|
89
94
|
# object definition for field details.
|
@@ -118,8 +123,8 @@ module Square
|
|
118
123
|
end
|
119
124
|
|
120
125
|
# Retrieves a specific refund using the `refund_id`.
|
121
|
-
# @param [String] refund_id Required parameter:
|
122
|
-
# `PaymentRefund`.
|
126
|
+
# @param [String] refund_id Required parameter: The unique ID for the
|
127
|
+
# desired `PaymentRefund`.
|
123
128
|
# @return [GetPaymentRefundResponse Hash] response from the API call
|
124
129
|
def get_payment_refund(refund_id:)
|
125
130
|
# Prepare query url.
|
@@ -60,8 +60,8 @@ module Square
|
|
60
60
|
# customer by subscription creation date.
|
61
61
|
# For more information, see
|
62
62
|
# [Retrieve
|
63
|
-
# subscriptions](https://developer.squareup.com/docs/
|
64
|
-
#
|
63
|
+
# subscriptions](https://developer.squareup.com/docs/subscriptions-api/overv
|
64
|
+
# iew#retrieve-subscriptions).
|
65
65
|
# @param [SearchSubscriptionsRequest] body Required parameter: An object
|
66
66
|
# containing the fields to POST for the request. See the corresponding
|
67
67
|
# object definition for field details.
|
@@ -217,8 +217,8 @@ module Square
|
|
217
217
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
218
218
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
219
219
|
# results for the original query. For more information, see
|
220
|
-
# [Pagination](https://developer.squareup.com/docs/
|
221
|
-
#
|
220
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
221
|
+
# ion).
|
222
222
|
# @param [Integer] limit Optional parameter: The upper limit on the number
|
223
223
|
# of subscription events to return in the response. Default: `200`
|
224
224
|
# @return [ListSubscriptionEventsResponse Hash] response from the API call
|
data/lib/square/api/team_api.rb
CHANGED
@@ -11,8 +11,8 @@ module Square
|
|
11
11
|
# - `given_name`
|
12
12
|
# - `family_name`
|
13
13
|
# Learn about [Troubleshooting the Teams
|
14
|
-
# API](https://developer.squareup.com/docs/
|
15
|
-
#
|
14
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#createteamme
|
15
|
+
# mber).
|
16
16
|
# @param [CreateTeamMemberRequest] body Required parameter: An object
|
17
17
|
# containing the fields to POST for the request. See the corresponding
|
18
18
|
# object definition for field details.
|
@@ -54,8 +54,8 @@ module Square
|
|
54
54
|
# marked as failed, but the body of the response
|
55
55
|
# will contain explicit error information for this particular create.
|
56
56
|
# Learn about [Troubleshooting the Teams
|
57
|
-
# API](https://developer.squareup.com/docs/
|
58
|
-
#
|
57
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#bulkcreatete
|
58
|
+
# ammembers).
|
59
59
|
# @param [BulkCreateTeamMembersRequest] body Required parameter: An object
|
60
60
|
# containing the fields to POST for the request. See the corresponding
|
61
61
|
# object definition for field details.
|
@@ -97,8 +97,8 @@ module Square
|
|
97
97
|
# marked as failed, but the body of the response
|
98
98
|
# will contain explicit error information for this particular update.
|
99
99
|
# Learn about [Troubleshooting the Teams
|
100
|
-
# API](https://developer.squareup.com/docs/
|
101
|
-
#
|
100
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#bulkupdatete
|
101
|
+
# ammembers).
|
102
102
|
# @param [BulkUpdateTeamMembersRequest] body Required parameter: An object
|
103
103
|
# containing the fields to POST for the request. See the corresponding
|
104
104
|
# object definition for field details.
|
@@ -171,8 +171,8 @@ module Square
|
|
171
171
|
|
172
172
|
# Retrieve a `TeamMember` object for the given `TeamMember.id`.
|
173
173
|
# Learn about [Troubleshooting the Teams
|
174
|
-
# API](https://developer.squareup.com/docs/
|
175
|
-
#
|
174
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#retrieveteam
|
175
|
+
# member).
|
176
176
|
# @param [String] team_member_id Required parameter: The ID of the team
|
177
177
|
# member to retrieve.
|
178
178
|
# @return [RetrieveTeamMemberResponse Hash] response from the API call
|
@@ -210,8 +210,8 @@ module Square
|
|
210
210
|
# Updates a single `TeamMember` object. The `TeamMember` will be returned on
|
211
211
|
# successful updates.
|
212
212
|
# Learn about [Troubleshooting the Teams
|
213
|
-
# API](https://developer.squareup.com/docs/
|
214
|
-
#
|
213
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#updateteamme
|
214
|
+
# mber).
|
215
215
|
# @param [String] team_member_id Required parameter: The ID of the team
|
216
216
|
# member to update.
|
217
217
|
# @param [UpdateTeamMemberRequest] body Required parameter: An object
|
@@ -255,8 +255,8 @@ module Square
|
|
255
255
|
# Retrieve a `WageSetting` object for a team member specified
|
256
256
|
# by `TeamMember.id`.
|
257
257
|
# Learn about [Troubleshooting the Teams
|
258
|
-
# API](https://developer.squareup.com/docs/
|
259
|
-
#
|
258
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#retrievewage
|
259
|
+
# setting).
|
260
260
|
# @param [String] team_member_id Required parameter: The ID of the team
|
261
261
|
# member to retrieve wage setting for
|
262
262
|
# @return [RetrieveWageSettingResponse Hash] response from the API call
|
@@ -297,8 +297,8 @@ module Square
|
|
297
297
|
# it fully replaces the `WageSetting` object for the team member.
|
298
298
|
# The `WageSetting` will be returned upon successful update.
|
299
299
|
# Learn about [Troubleshooting the Teams
|
300
|
-
# API](https://developer.squareup.com/docs/
|
301
|
-
#
|
300
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#updatewagese
|
301
|
+
# tting).
|
302
302
|
# @param [String] team_member_id Required parameter: The ID of the team
|
303
303
|
# member to update the `WageSetting` object for.
|
304
304
|
# @param [UpdateWageSettingRequest] body Required parameter: An object
|
@@ -5,8 +5,9 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Creates a
|
9
|
-
#
|
8
|
+
# Creates a Terminal checkout request and sends it to the specified device
|
9
|
+
# to take a payment
|
10
|
+
# for the requested amount.
|
10
11
|
# @param [CreateTerminalCheckoutRequest] body Required parameter: An object
|
11
12
|
# containing the fields to POST for the request. See the corresponding
|
12
13
|
# object definition for field details.
|
@@ -75,9 +76,9 @@ module Square
|
|
75
76
|
)
|
76
77
|
end
|
77
78
|
|
78
|
-
# Retrieves a Terminal checkout request by checkout_id
|
79
|
-
# @param [String] checkout_id Required parameter:
|
80
|
-
# `TerminalCheckout
|
79
|
+
# Retrieves a Terminal checkout request by `checkout_id`.
|
80
|
+
# @param [String] checkout_id Required parameter: The unique ID for the
|
81
|
+
# desired `TerminalCheckout`.
|
81
82
|
# @return [GetTerminalCheckoutResponse Hash] response from the API call
|
82
83
|
def get_terminal_checkout(checkout_id:)
|
83
84
|
# Prepare query url.
|
@@ -112,8 +113,8 @@ module Square
|
|
112
113
|
|
113
114
|
# Cancels a Terminal checkout request if the status of the request permits
|
114
115
|
# it.
|
115
|
-
# @param [String] checkout_id Required parameter:
|
116
|
-
# `TerminalCheckout
|
116
|
+
# @param [String] checkout_id Required parameter: The unique ID for the
|
117
|
+
# desired `TerminalCheckout`.
|
117
118
|
# @return [CancelTerminalCheckoutResponse Hash] response from the API call
|
118
119
|
def cancel_terminal_checkout(checkout_id:)
|
119
120
|
# Prepare query url.
|
@@ -181,7 +182,7 @@ module Square
|
|
181
182
|
)
|
182
183
|
end
|
183
184
|
|
184
|
-
# Retrieves a filtered list of Terminal
|
185
|
+
# Retrieves a filtered list of Interac Terminal refund requests created by
|
185
186
|
# the seller making the request.
|
186
187
|
# @param [SearchTerminalRefundsRequest] body Required parameter: An object
|
187
188
|
# containing the fields to POST for the request. See the corresponding
|
@@ -216,9 +217,9 @@ module Square
|
|
216
217
|
)
|
217
218
|
end
|
218
219
|
|
219
|
-
# Retrieves an Interac
|
220
|
-
# @param [String] terminal_refund_id Required parameter:
|
221
|
-
# desired `TerminalRefund
|
220
|
+
# Retrieves an Interac Terminal refund object by ID.
|
221
|
+
# @param [String] terminal_refund_id Required parameter: The unique ID for
|
222
|
+
# the desired `TerminalRefund`.
|
222
223
|
# @return [GetTerminalRefundResponse Hash] response from the API call
|
223
224
|
def get_terminal_refund(terminal_refund_id:)
|
224
225
|
# Prepare query url.
|
@@ -251,10 +252,10 @@ module Square
|
|
251
252
|
)
|
252
253
|
end
|
253
254
|
|
254
|
-
# Cancels an Interac
|
255
|
+
# Cancels an Interac Terminal refund request by refund request ID if the
|
255
256
|
# status of the request permits it.
|
256
|
-
# @param [String] terminal_refund_id Required parameter:
|
257
|
-
# desired `TerminalRefund
|
257
|
+
# @param [String] terminal_refund_id Required parameter: The unique ID for
|
258
|
+
# the desired `TerminalRefund`.
|
258
259
|
# @return [CancelTerminalRefundResponse Hash] response from the API call
|
259
260
|
def cancel_terminal_refund(terminal_refund_id:)
|
260
261
|
# Prepare query url.
|
@@ -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.
|
@@ -359,397 +357,5 @@ module Square
|
|
359
357
|
_response, data: decoded, errors: _errors
|
360
358
|
)
|
361
359
|
end
|
362
|
-
|
363
|
-
# Provides summary information for all of a business's employee timecards.
|
364
|
-
# @param [SortOrder] order Optional parameter: The order in which timecards
|
365
|
-
# are listed in the response, based on their created_at field.
|
366
|
-
# @param [String] employee_id Optional parameter: If provided, the endpoint
|
367
|
-
# returns only timecards for the employee with the specified ID.
|
368
|
-
# @param [String] begin_clockin_time Optional parameter: If filtering
|
369
|
-
# results by their clockin_time field, the beginning of the requested
|
370
|
-
# reporting period, in ISO 8601 format.
|
371
|
-
# @param [String] end_clockin_time Optional parameter: If filtering results
|
372
|
-
# by their clockin_time field, the end of the requested reporting period, in
|
373
|
-
# ISO 8601 format.
|
374
|
-
# @param [String] begin_clockout_time Optional parameter: If filtering
|
375
|
-
# results by their clockout_time field, the beginning of the requested
|
376
|
-
# reporting period, in ISO 8601 format.
|
377
|
-
# @param [String] end_clockout_time Optional parameter: If filtering results
|
378
|
-
# by their clockout_time field, the end of the requested reporting period,
|
379
|
-
# in ISO 8601 format.
|
380
|
-
# @param [String] begin_updated_at Optional parameter: If filtering results
|
381
|
-
# by their updated_at field, the beginning of the requested reporting
|
382
|
-
# period, in ISO 8601 format.
|
383
|
-
# @param [String] end_updated_at Optional parameter: If filtering results by
|
384
|
-
# their updated_at field, the end of the requested reporting period, in ISO
|
385
|
-
# 8601 format.
|
386
|
-
# @param [Boolean] deleted Optional parameter: If true, only deleted
|
387
|
-
# timecards are returned. If false, only valid timecards are returned.If you
|
388
|
-
# don't provide this parameter, both valid and deleted timecards are
|
389
|
-
# returned.
|
390
|
-
# @param [Integer] limit Optional parameter: The maximum integer number of
|
391
|
-
# employee entities to return in a single response. Default 100, maximum
|
392
|
-
# 200.
|
393
|
-
# @param [String] batch_token Optional parameter: A pagination cursor to
|
394
|
-
# retrieve the next set of results for your original query to the
|
395
|
-
# endpoint.
|
396
|
-
# @return [List of V1Timecard Hash] response from the API call
|
397
|
-
def list_timecards(order: nil,
|
398
|
-
employee_id: nil,
|
399
|
-
begin_clockin_time: nil,
|
400
|
-
end_clockin_time: nil,
|
401
|
-
begin_clockout_time: nil,
|
402
|
-
end_clockout_time: nil,
|
403
|
-
begin_updated_at: nil,
|
404
|
-
end_updated_at: nil,
|
405
|
-
deleted: false,
|
406
|
-
limit: nil,
|
407
|
-
batch_token: nil)
|
408
|
-
warn 'Endpoint list_timecards in V1EmployeesApi is deprecated'
|
409
|
-
# Prepare query url.
|
410
|
-
_query_builder = config.get_base_uri
|
411
|
-
_query_builder << '/v1/me/timecards'
|
412
|
-
_query_builder = APIHelper.append_url_with_query_parameters(
|
413
|
-
_query_builder,
|
414
|
-
'order' => order,
|
415
|
-
'employee_id' => employee_id,
|
416
|
-
'begin_clockin_time' => begin_clockin_time,
|
417
|
-
'end_clockin_time' => end_clockin_time,
|
418
|
-
'begin_clockout_time' => begin_clockout_time,
|
419
|
-
'end_clockout_time' => end_clockout_time,
|
420
|
-
'begin_updated_at' => begin_updated_at,
|
421
|
-
'end_updated_at' => end_updated_at,
|
422
|
-
'deleted' => deleted,
|
423
|
-
'limit' => limit,
|
424
|
-
'batch_token' => batch_token
|
425
|
-
)
|
426
|
-
_query_url = APIHelper.clean_url _query_builder
|
427
|
-
|
428
|
-
# Prepare headers.
|
429
|
-
_headers = {
|
430
|
-
'accept' => 'application/json'
|
431
|
-
}
|
432
|
-
|
433
|
-
# Prepare and execute HttpRequest.
|
434
|
-
_request = config.http_client.get(
|
435
|
-
_query_url,
|
436
|
-
headers: _headers
|
437
|
-
)
|
438
|
-
OAuth2.apply(config, _request)
|
439
|
-
_response = execute_request(_request)
|
440
|
-
|
441
|
-
# Return appropriate response type.
|
442
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
443
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
444
|
-
ApiResponse.new(
|
445
|
-
_response, data: decoded, errors: _errors
|
446
|
-
)
|
447
|
-
end
|
448
|
-
|
449
|
-
# Creates a timecard for an employee and clocks them in with an
|
450
|
-
# `API_CREATE` event and a `clockin_time` set to the current time unless
|
451
|
-
# the request provides a different value.
|
452
|
-
# To import timecards from another
|
453
|
-
# system (rather than clocking someone in). Specify the `clockin_time`
|
454
|
-
# and* `clockout_time` in the request.
|
455
|
-
# Timecards correspond to exactly one shift for a given employee, bounded
|
456
|
-
# by the `clockin_time` and `clockout_time` fields. An employee is
|
457
|
-
# considered clocked in if they have a timecard that doesn't have a
|
458
|
-
# `clockout_time` set. An employee that is currently clocked in cannot
|
459
|
-
# be clocked in a second time.
|
460
|
-
# @param [V1Timecard] body Required parameter: An object containing the
|
461
|
-
# fields to POST for the request. See the corresponding object definition
|
462
|
-
# for field details.
|
463
|
-
# @return [V1Timecard Hash] response from the API call
|
464
|
-
def create_timecard(body:)
|
465
|
-
warn 'Endpoint create_timecard in V1EmployeesApi is deprecated'
|
466
|
-
# Prepare query url.
|
467
|
-
_query_builder = config.get_base_uri
|
468
|
-
_query_builder << '/v1/me/timecards'
|
469
|
-
_query_url = APIHelper.clean_url _query_builder
|
470
|
-
|
471
|
-
# Prepare headers.
|
472
|
-
_headers = {
|
473
|
-
'accept' => 'application/json',
|
474
|
-
'content-type' => 'application/json; charset=utf-8'
|
475
|
-
}
|
476
|
-
|
477
|
-
# Prepare and execute HttpRequest.
|
478
|
-
_request = config.http_client.post(
|
479
|
-
_query_url,
|
480
|
-
headers: _headers,
|
481
|
-
parameters: body.to_json
|
482
|
-
)
|
483
|
-
OAuth2.apply(config, _request)
|
484
|
-
_response = execute_request(_request)
|
485
|
-
|
486
|
-
# Return appropriate response type.
|
487
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
488
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
489
|
-
ApiResponse.new(
|
490
|
-
_response, data: decoded, errors: _errors
|
491
|
-
)
|
492
|
-
end
|
493
|
-
|
494
|
-
# Deletes a timecard. Timecards can also be deleted through the
|
495
|
-
# Square Dashboard. Deleted timecards are still accessible through
|
496
|
-
# Connect API endpoints, but cannot be modified. The `deleted` field of
|
497
|
-
# the `Timecard` object indicates whether the timecard has been deleted.
|
498
|
-
# __Note__: By default, deleted timecards appear alongside valid timecards
|
499
|
-
# in
|
500
|
-
# results returned by the
|
501
|
-
# [ListTimecards](#endpoint-v1employees-listtimecards)
|
502
|
-
# endpoint. To filter deleted timecards, include the `deleted` query
|
503
|
-
# parameter in the list request.
|
504
|
-
# Only approved accounts can manage their employees with Square.
|
505
|
-
# Unapproved accounts cannot use employee management features with the
|
506
|
-
# API.
|
507
|
-
# @param [String] timecard_id Required parameter: The ID of the timecard to
|
508
|
-
# delete.
|
509
|
-
# @return [Object] response from the API call
|
510
|
-
def delete_timecard(timecard_id:)
|
511
|
-
warn 'Endpoint delete_timecard in V1EmployeesApi is deprecated'
|
512
|
-
# Prepare query url.
|
513
|
-
_query_builder = config.get_base_uri
|
514
|
-
_query_builder << '/v1/me/timecards/{timecard_id}'
|
515
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
516
|
-
_query_builder,
|
517
|
-
'timecard_id' => { 'value' => timecard_id, 'encode' => true }
|
518
|
-
)
|
519
|
-
_query_url = APIHelper.clean_url _query_builder
|
520
|
-
|
521
|
-
# Prepare and execute HttpRequest.
|
522
|
-
_request = config.http_client.delete(
|
523
|
-
_query_url
|
524
|
-
)
|
525
|
-
OAuth2.apply(config, _request)
|
526
|
-
_response = execute_request(_request)
|
527
|
-
|
528
|
-
# Return appropriate response type.
|
529
|
-
ApiResponse.new(
|
530
|
-
_response, data: _response.raw_body
|
531
|
-
)
|
532
|
-
end
|
533
|
-
|
534
|
-
# Provides the details for a single timecard.
|
535
|
-
# <aside>
|
536
|
-
# Only approved accounts can manage their employees with Square.
|
537
|
-
# Unapproved accounts cannot use employee management features with the
|
538
|
-
# API.
|
539
|
-
# </aside>
|
540
|
-
# @param [String] timecard_id Required parameter: The timecard's ID.
|
541
|
-
# @return [V1Timecard Hash] response from the API call
|
542
|
-
def retrieve_timecard(timecard_id:)
|
543
|
-
warn 'Endpoint retrieve_timecard in V1EmployeesApi is deprecated'
|
544
|
-
# Prepare query url.
|
545
|
-
_query_builder = config.get_base_uri
|
546
|
-
_query_builder << '/v1/me/timecards/{timecard_id}'
|
547
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
548
|
-
_query_builder,
|
549
|
-
'timecard_id' => { 'value' => timecard_id, 'encode' => true }
|
550
|
-
)
|
551
|
-
_query_url = APIHelper.clean_url _query_builder
|
552
|
-
|
553
|
-
# Prepare headers.
|
554
|
-
_headers = {
|
555
|
-
'accept' => 'application/json'
|
556
|
-
}
|
557
|
-
|
558
|
-
# Prepare and execute HttpRequest.
|
559
|
-
_request = config.http_client.get(
|
560
|
-
_query_url,
|
561
|
-
headers: _headers
|
562
|
-
)
|
563
|
-
OAuth2.apply(config, _request)
|
564
|
-
_response = execute_request(_request)
|
565
|
-
|
566
|
-
# Return appropriate response type.
|
567
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
568
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
569
|
-
ApiResponse.new(
|
570
|
-
_response, data: decoded, errors: _errors
|
571
|
-
)
|
572
|
-
end
|
573
|
-
|
574
|
-
# Modifies the details of a timecard with an `API_EDIT` event for
|
575
|
-
# the timecard. Updating an active timecard with a `clockout_time`
|
576
|
-
# clocks the employee out.
|
577
|
-
# @param [String] timecard_id Required parameter: TThe ID of the timecard to
|
578
|
-
# modify.
|
579
|
-
# @param [V1Timecard] body Required parameter: An object containing the
|
580
|
-
# fields to POST for the request. See the corresponding object definition
|
581
|
-
# for field details.
|
582
|
-
# @return [V1Timecard Hash] response from the API call
|
583
|
-
def update_timecard(timecard_id:,
|
584
|
-
body:)
|
585
|
-
warn 'Endpoint update_timecard in V1EmployeesApi is deprecated'
|
586
|
-
# Prepare query url.
|
587
|
-
_query_builder = config.get_base_uri
|
588
|
-
_query_builder << '/v1/me/timecards/{timecard_id}'
|
589
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
590
|
-
_query_builder,
|
591
|
-
'timecard_id' => { 'value' => timecard_id, 'encode' => true }
|
592
|
-
)
|
593
|
-
_query_url = APIHelper.clean_url _query_builder
|
594
|
-
|
595
|
-
# Prepare headers.
|
596
|
-
_headers = {
|
597
|
-
'accept' => 'application/json',
|
598
|
-
'content-type' => 'application/json; charset=utf-8'
|
599
|
-
}
|
600
|
-
|
601
|
-
# Prepare and execute HttpRequest.
|
602
|
-
_request = config.http_client.put(
|
603
|
-
_query_url,
|
604
|
-
headers: _headers,
|
605
|
-
parameters: body.to_json
|
606
|
-
)
|
607
|
-
OAuth2.apply(config, _request)
|
608
|
-
_response = execute_request(_request)
|
609
|
-
|
610
|
-
# Return appropriate response type.
|
611
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
612
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
613
|
-
ApiResponse.new(
|
614
|
-
_response, data: decoded, errors: _errors
|
615
|
-
)
|
616
|
-
end
|
617
|
-
|
618
|
-
# Provides summary information for all events associated with a
|
619
|
-
# particular timecard.
|
620
|
-
# <aside>
|
621
|
-
# Only approved accounts can manage their employees with Square.
|
622
|
-
# Unapproved accounts cannot use employee management features with the
|
623
|
-
# API.
|
624
|
-
# </aside>
|
625
|
-
# @param [String] timecard_id Required parameter: The ID of the timecard to
|
626
|
-
# list events for.
|
627
|
-
# @return [List of V1TimecardEvent Hash] response from the API call
|
628
|
-
def list_timecard_events(timecard_id:)
|
629
|
-
warn 'Endpoint list_timecard_events in V1EmployeesApi is deprecated'
|
630
|
-
# Prepare query url.
|
631
|
-
_query_builder = config.get_base_uri
|
632
|
-
_query_builder << '/v1/me/timecards/{timecard_id}/events'
|
633
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
634
|
-
_query_builder,
|
635
|
-
'timecard_id' => { 'value' => timecard_id, 'encode' => true }
|
636
|
-
)
|
637
|
-
_query_url = APIHelper.clean_url _query_builder
|
638
|
-
|
639
|
-
# Prepare headers.
|
640
|
-
_headers = {
|
641
|
-
'accept' => 'application/json'
|
642
|
-
}
|
643
|
-
|
644
|
-
# Prepare and execute HttpRequest.
|
645
|
-
_request = config.http_client.get(
|
646
|
-
_query_url,
|
647
|
-
headers: _headers
|
648
|
-
)
|
649
|
-
OAuth2.apply(config, _request)
|
650
|
-
_response = execute_request(_request)
|
651
|
-
|
652
|
-
# Return appropriate response type.
|
653
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
654
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
655
|
-
ApiResponse.new(
|
656
|
-
_response, data: decoded, errors: _errors
|
657
|
-
)
|
658
|
-
end
|
659
|
-
|
660
|
-
# Provides the details for all of a location's cash drawer shifts during a
|
661
|
-
# date range. The date range you specify cannot exceed 90 days.
|
662
|
-
# @param [String] location_id Required parameter: The ID of the location to
|
663
|
-
# list cash drawer shifts for.
|
664
|
-
# @param [SortOrder] order Optional parameter: The order in which cash
|
665
|
-
# drawer shifts are listed in the response, based on their created_at field.
|
666
|
-
# Default value: ASC
|
667
|
-
# @param [String] begin_time Optional parameter: The beginning of the
|
668
|
-
# requested reporting period, in ISO 8601 format. Default value: The current
|
669
|
-
# time minus 90 days.
|
670
|
-
# @param [String] end_time Optional parameter: The beginning of the
|
671
|
-
# requested reporting period, in ISO 8601 format. Default value: The current
|
672
|
-
# time.
|
673
|
-
# @return [List of V1CashDrawerShift Hash] response from the API call
|
674
|
-
def list_cash_drawer_shifts(location_id:,
|
675
|
-
order: nil,
|
676
|
-
begin_time: nil,
|
677
|
-
end_time: nil)
|
678
|
-
warn 'Endpoint list_cash_drawer_shifts in V1EmployeesApi is deprecated'
|
679
|
-
# Prepare query url.
|
680
|
-
_query_builder = config.get_base_uri
|
681
|
-
_query_builder << '/v1/{location_id}/cash-drawer-shifts'
|
682
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
683
|
-
_query_builder,
|
684
|
-
'location_id' => { 'value' => location_id, 'encode' => true }
|
685
|
-
)
|
686
|
-
_query_builder = APIHelper.append_url_with_query_parameters(
|
687
|
-
_query_builder,
|
688
|
-
'order' => order,
|
689
|
-
'begin_time' => begin_time,
|
690
|
-
'end_time' => end_time
|
691
|
-
)
|
692
|
-
_query_url = APIHelper.clean_url _query_builder
|
693
|
-
|
694
|
-
# Prepare headers.
|
695
|
-
_headers = {
|
696
|
-
'accept' => 'application/json'
|
697
|
-
}
|
698
|
-
|
699
|
-
# Prepare and execute HttpRequest.
|
700
|
-
_request = config.http_client.get(
|
701
|
-
_query_url,
|
702
|
-
headers: _headers
|
703
|
-
)
|
704
|
-
OAuth2.apply(config, _request)
|
705
|
-
_response = execute_request(_request)
|
706
|
-
|
707
|
-
# Return appropriate response type.
|
708
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
709
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
710
|
-
ApiResponse.new(
|
711
|
-
_response, data: decoded, errors: _errors
|
712
|
-
)
|
713
|
-
end
|
714
|
-
|
715
|
-
# Provides the details for a single cash drawer shift, including all events
|
716
|
-
# that occurred during the shift.
|
717
|
-
# @param [String] location_id Required parameter: The ID of the location to
|
718
|
-
# list cash drawer shifts for.
|
719
|
-
# @param [String] shift_id Required parameter: The shift's ID.
|
720
|
-
# @return [V1CashDrawerShift Hash] response from the API call
|
721
|
-
def retrieve_cash_drawer_shift(location_id:,
|
722
|
-
shift_id:)
|
723
|
-
warn 'Endpoint retrieve_cash_drawer_shift in V1EmployeesApi is deprecated'
|
724
|
-
# Prepare query url.
|
725
|
-
_query_builder = config.get_base_uri
|
726
|
-
_query_builder << '/v1/{location_id}/cash-drawer-shifts/{shift_id}'
|
727
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
728
|
-
_query_builder,
|
729
|
-
'location_id' => { 'value' => location_id, 'encode' => true },
|
730
|
-
'shift_id' => { 'value' => shift_id, 'encode' => true }
|
731
|
-
)
|
732
|
-
_query_url = APIHelper.clean_url _query_builder
|
733
|
-
|
734
|
-
# Prepare headers.
|
735
|
-
_headers = {
|
736
|
-
'accept' => 'application/json'
|
737
|
-
}
|
738
|
-
|
739
|
-
# Prepare and execute HttpRequest.
|
740
|
-
_request = config.http_client.get(
|
741
|
-
_query_url,
|
742
|
-
headers: _headers
|
743
|
-
)
|
744
|
-
OAuth2.apply(config, _request)
|
745
|
-
_response = execute_request(_request)
|
746
|
-
|
747
|
-
# Return appropriate response type.
|
748
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
749
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
750
|
-
ApiResponse.new(
|
751
|
-
_response, data: decoded, errors: _errors
|
752
|
-
)
|
753
|
-
end
|
754
360
|
end
|
755
361
|
end
|