square.rb 8.0.0.20201216 → 10.0.0.202104217

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,9 @@ module Square
6
6
  end
7
7
 
8
8
  # Retrieves a list of payments taken by the account making the request.
9
+ # Results are eventually consistent, and new payments or changes to payments
10
+ # might take several
11
+ # seconds to appear.
9
12
  # The maximum results per page is 100.
10
13
  # @param [String] begin_time Optional parameter: The timestamp for the
11
14
  # beginning of the reporting period, in RFC 3339 format. Inclusive. Default:
@@ -83,16 +86,14 @@ module Square
83
86
  )
84
87
  end
85
88
 
86
- # Charges a payment source (for example, a card
87
- # represented by customer's card on file or a card nonce). In addition
88
- # to the payment source, the request must include the
89
- # amount to accept for the payment.
90
- # There are several optional parameters that you can include in the request
91
- # (for example, tip money, whether to autocomplete the payment, or a
92
- # reference ID
93
- # to correlate this payment with another system).
94
- # The `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required
95
- # to enable application fees.
89
+ # Creates a payment using the provided source. You can use this endpoint
90
+ # to charge a card (credit/debit card or
91
+ # Square gift card) or record a payment that the seller received outside of
92
+ # Square
93
+ # (cash payment from a buyer or a payment that an external entity
94
+ # processed on behalf of the seller).
95
+ # The endpoint creates a
96
+ # `Payment` object and returns it in the response.
96
97
  # @param [CreatePaymentRequest] body Required parameter: An object
97
98
  # containing the fields to POST for the request. See the corresponding
98
99
  # object definition for field details.
@@ -209,11 +210,53 @@ module Square
209
210
  )
210
211
  end
211
212
 
212
- # Cancels (voids) a payment. If you set `autocomplete` to `false` when
213
- # creating a payment,
214
- # you can cancel the payment using this endpoint.
215
- # @param [String] payment_id Required parameter: The `payment_id`
216
- # identifying the payment to be canceled.
213
+ # Updates a payment with the APPROVED status.
214
+ # You can update the `amount_money` and `tip_money` using this endpoint.
215
+ # @param [String] payment_id Required parameter: The ID of the payment to
216
+ # update.
217
+ # @param [UpdatePaymentRequest] body Required parameter: An object
218
+ # containing the fields to POST for the request. See the corresponding
219
+ # object definition for field details.
220
+ # @return [UpdatePaymentResponse Hash] response from the API call
221
+ def update_payment(payment_id:,
222
+ body:)
223
+ # Prepare query url.
224
+ _query_builder = config.get_base_uri
225
+ _query_builder << '/v2/payments/{payment_id}'
226
+ _query_builder = APIHelper.append_url_with_template_parameters(
227
+ _query_builder,
228
+ 'payment_id' => { 'value' => payment_id, 'encode' => true }
229
+ )
230
+ _query_url = APIHelper.clean_url _query_builder
231
+
232
+ # Prepare headers.
233
+ _headers = {
234
+ 'accept' => 'application/json',
235
+ 'content-type' => 'application/json; charset=utf-8'
236
+ }
237
+
238
+ # Prepare and execute HttpRequest.
239
+ _request = config.http_client.put(
240
+ _query_url,
241
+ headers: _headers,
242
+ parameters: body.to_json
243
+ )
244
+ OAuth2.apply(config, _request)
245
+ _response = execute_request(_request)
246
+
247
+ # Return appropriate response type.
248
+ decoded = APIHelper.json_deserialize(_response.raw_body)
249
+ _errors = APIHelper.map_response(decoded, ['errors'])
250
+ ApiResponse.new(
251
+ _response, data: decoded, errors: _errors
252
+ )
253
+ end
254
+
255
+ # Cancels (voids) a payment. You can use this endpoint to cancel a payment
256
+ # with
257
+ # the APPROVED `status`.
258
+ # @param [String] payment_id Required parameter: The ID of the payment to
259
+ # cancel.
217
260
  # @return [CancelPaymentResponse Hash] response from the API call
218
261
  def cancel_payment(payment_id:)
219
262
  # Prepare query url.
@@ -249,9 +292,8 @@ module Square
249
292
  # Completes (captures) a payment.
250
293
  # By default, payments are set to complete immediately after they are
251
294
  # created.
252
- # If you set `autocomplete` to `false` when creating a payment, you can
253
- # complete (capture)
254
- # the payment using this endpoint.
295
+ # You can use this endpoint to complete a payment with the APPROVED
296
+ # `status`.
255
297
  # @param [String] payment_id Required parameter: The unique ID identifying
256
298
  # the payment to be completed.
257
299
  # @return [CompletePaymentResponse Hash] response from the API call
@@ -6,6 +6,9 @@ module Square
6
6
  end
7
7
 
8
8
  # Retrieves a list of refunds for the account making the request.
9
+ # Results are eventually consistent, and new refunds or changes to refunds
10
+ # might take several
11
+ # seconds to appear.
9
12
  # The maximum results per page is 100.
10
13
  # @param [String] begin_time Optional parameter: The timestamp for the
11
14
  # beginning of the requested reporting period, in RFC 3339 format. Default:
@@ -26,7 +29,7 @@ module Square
26
29
  # associated with the seller.
27
30
  # @param [String] status Optional parameter: If provided, only refunds with
28
31
  # the given status are returned. For a list of refund status values, see
29
- # [PaymentRefund](#type-paymentrefund). Default: If omitted, refunds are
32
+ # [PaymentRefund]($m/PaymentRefund). Default: If omitted, refunds are
30
33
  # returned regardless of their status.
31
34
  # @param [String] source_type Optional parameter: If provided, only refunds
32
35
  # with the given source type are returned. - `CARD` - List refunds only for
@@ -83,7 +86,12 @@ module Square
83
86
  end
84
87
 
85
88
  # Refunds a payment. You can refund the entire payment amount or a
86
- # portion of it.
89
+ # portion of it. You can use this endpoint to refund a card payment or
90
+ # record a
91
+ # refund of a cash or external payment. For more information, see
92
+ # [Refund
93
+ # Payment](https://developer.squareup.com/docs/payments-api/refund-payments)
94
+ # .
87
95
  # @param [RefundPaymentRequest] body Required parameter: An object
88
96
  # containing the fields to POST for the request. See the corresponding
89
97
  # object definition for field details.
@@ -220,7 +220,7 @@ module Square
220
220
  # [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
221
221
  # ion).
222
222
  # @param [Integer] limit Optional parameter: The upper limit on the number
223
- # of subscription events to return in the response. Default: `200`
223
+ # of subscription events to return in the response. Default: `200`
224
224
  # @return [ListSubscriptionEventsResponse Hash] response from the API call
225
225
  def list_subscription_events(subscription_id:,
226
226
  cursor: nil,
@@ -259,5 +259,40 @@ module Square
259
259
  _response, data: decoded, errors: _errors
260
260
  )
261
261
  end
262
+
263
+ # Resumes a deactivated subscription.
264
+ # @param [String] subscription_id Required parameter: The ID of the
265
+ # subscription to resume.
266
+ # @return [ResumeSubscriptionResponse Hash] response from the API call
267
+ def resume_subscription(subscription_id:)
268
+ # Prepare query url.
269
+ _query_builder = config.get_base_uri
270
+ _query_builder << '/v2/subscriptions/{subscription_id}/resume'
271
+ _query_builder = APIHelper.append_url_with_template_parameters(
272
+ _query_builder,
273
+ 'subscription_id' => { 'value' => subscription_id, 'encode' => true }
274
+ )
275
+ _query_url = APIHelper.clean_url _query_builder
276
+
277
+ # Prepare headers.
278
+ _headers = {
279
+ 'accept' => 'application/json'
280
+ }
281
+
282
+ # Prepare and execute HttpRequest.
283
+ _request = config.http_client.post(
284
+ _query_url,
285
+ headers: _headers
286
+ )
287
+ OAuth2.apply(config, _request)
288
+ _response = execute_request(_request)
289
+
290
+ # Return appropriate response type.
291
+ decoded = APIHelper.json_deserialize(_response.raw_body)
292
+ _errors = APIHelper.map_response(decoded, ['errors'])
293
+ ApiResponse.new(
294
+ _response, data: decoded, errors: _errors
295
+ )
296
+ end
262
297
  end
263
298
  end
@@ -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/team/troubleshooting#bulkcreatete
58
- # ammembers).
57
+ # API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-
58
+ # team-members).
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/team/troubleshooting#bulkupdatete
101
- # ammembers).
100
+ # API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-
101
+ # team-members).
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/team/troubleshooting#retrieveteam
175
- # member).
174
+ # API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-t
175
+ # eam-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/team/troubleshooting#updateteamme
214
- # mber).
213
+ # API](https://developer.squareup.com/docs/team/troubleshooting#update-a-tea
214
+ # m-member).
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
@@ -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/team/troubleshooting#updatewagese
301
- # tting).
300
+ # API](https://developer.squareup.com/docs/team/troubleshooting#create-or-up
301
+ # date-a-wage-setting).
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 new Terminal checkout request and sends it to the specified
9
- # device to take a payment for the requested amount.
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: Unique ID for the desired
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: Unique ID for the desired
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 Interac refund requests created by
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 terminal refund object by ID.
220
- # @param [String] terminal_refund_id Required parameter: Unique ID for the
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 terminal refund request by refund request ID if the
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: Unique ID for the
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.
@@ -12,24 +12,29 @@ module Square
12
12
  # Point of Sale applications.
13
13
  # Refunds with a `status` of `PENDING` are not currently included in this
14
14
  # endpoint's response.
15
- # Max results per [page](#paginatingresults): 50
15
+ # Max results per
16
+ # [page](https://developer.squareup.com/docs/working-with-apis/pagination):
17
+ # 50
16
18
  # @param [String] location_id Required parameter: The ID of the location to
17
19
  # list refunds for.
18
20
  # @param [String] begin_time Optional parameter: The beginning of the
19
21
  # requested reporting period, in RFC 3339 format. See [Date
20
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
21
- # value: The current time minus one year.
22
+ # ranges](https://developer.squareup.com/docs/build-basics/working-with-date
23
+ # s) for details on date inclusivity/exclusivity. Default value: The
24
+ # current time minus one year.
22
25
  # @param [String] end_time Optional parameter: The end of the requested
23
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
24
- # details on date inclusivity/exclusivity. Default value: The current
25
- # time.
26
+ # reporting period, in RFC 3339 format. See [Date
27
+ # ranges](https://developer.squareup.com/docs/build-basics/working-with-date
28
+ # s) for details on date inclusivity/exclusivity. Default value: The
29
+ # current time.
26
30
  # @param [SortOrder] sort_order Optional parameter: The order in which
27
31
  # results are listed in the response (`ASC` for oldest first, `DESC` for
28
32
  # newest first). Default value: `DESC`
29
33
  # @param [String] cursor Optional parameter: A pagination cursor returned by
30
34
  # a previous call to this endpoint. Provide this to retrieve the next set of
31
35
  # results for your original query. See [Paginating
32
- # results](#paginatingresults) for more information.
36
+ # results](https://developer.squareup.com/docs/working-with-apis/pagination)
37
+ # for more information.
33
38
  # @return [ListRefundsResponse Hash] response from the API call
34
39
  def list_refunds(location_id:,
35
40
  begin_time: nil,
@@ -78,24 +83,29 @@ module Square
78
83
  # Transactions include payment information from sales and exchanges and
79
84
  # refund
80
85
  # information from returns and exchanges.
81
- # Max results per [page](#paginatingresults): 50
86
+ # Max results per
87
+ # [page](https://developer.squareup.com/docs/working-with-apis/pagination):
88
+ # 50
82
89
  # @param [String] location_id Required parameter: The ID of the location to
83
90
  # list transactions for.
84
91
  # @param [String] begin_time Optional parameter: The beginning of the
85
92
  # requested reporting period, in RFC 3339 format. See [Date
86
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
87
- # value: The current time minus one year.
93
+ # ranges](https://developer.squareup.com/docs/build-basics/working-with-date
94
+ # s) for details on date inclusivity/exclusivity. Default value: The
95
+ # current time minus one year.
88
96
  # @param [String] end_time Optional parameter: The end of the requested
89
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
90
- # details on date inclusivity/exclusivity. Default value: The current
91
- # time.
97
+ # reporting period, in RFC 3339 format. See [Date
98
+ # ranges](https://developer.squareup.com/docs/build-basics/working-with-date
99
+ # s) for details on date inclusivity/exclusivity. Default value: The
100
+ # current time.
92
101
  # @param [SortOrder] sort_order Optional parameter: The order in which
93
102
  # results are listed in the response (`ASC` for oldest first, `DESC` for
94
103
  # newest first). Default value: `DESC`
95
104
  # @param [String] cursor Optional parameter: A pagination cursor returned by
96
105
  # a previous call to this endpoint. Provide this to retrieve the next set of
97
106
  # results for your original query. See [Paginating
98
- # results](#paginatingresults) for more information.
107
+ # results](https://developer.squareup.com/docs/working-with-apis/pagination)
108
+ # for more information.
99
109
  # @return [ListTransactionsResponse Hash] response from the API call
100
110
  def list_transactions(location_id:,
101
111
  begin_time: nil,
@@ -156,9 +166,9 @@ module Square
156
166
  # When this response is returned, the amount of Square's processing fee
157
167
  # might not yet be
158
168
  # calculated. To obtain the processing fee, wait about ten seconds and call
159
- # [RetrieveTransaction](#endpoint-retrievetransaction). See the
169
+ # [RetrieveTransaction]($e/Transactions/RetrieveTransaction). See the
160
170
  # `processing_fee_money`
161
- # field of each [Tender included](#type-tender) in the transaction.
171
+ # field of each [Tender included]($m/Tender) in the transaction.
162
172
  # @param [String] location_id Required parameter: The ID of the location to
163
173
  # associate the created transaction with.
164
174
  # @param [ChargeRequest] body Required parameter: An object containing the
@@ -241,7 +251,7 @@ module Square
241
251
  end
242
252
 
243
253
  # Captures a transaction that was created with the
244
- # [Charge](#endpoint-charge)
254
+ # [Charge]($e/Transactions/Charge)
245
255
  # endpoint with a `delay_capture` value of `true`.
246
256
  # See [Delayed capture
247
257
  # transactions](https://developer.squareup.com/docs/payments/transactions/ov
@@ -337,7 +347,8 @@ module Square
337
347
  )
338
348
  end
339
349
 
340
- # Cancels a transaction that was created with the [Charge](#endpoint-charge)
350
+ # Cancels a transaction that was created with the
351
+ # [Charge]($e/Transactions/Charge)
341
352
  # endpoint with a `delay_capture` value of `true`.
342
353
  # See [Delayed capture
343
354
  # transactions](https://developer.squareup.com/docs/payments/transactions/ov
@@ -247,7 +247,8 @@ module Square
247
247
  # employee with that role. For example, an employee with a "Shift Manager"
248
248
  # role might be able to issue refunds in Square Point of Sale, whereas an
249
249
  # employee with a "Clerk" role might not.
250
- # Roles are assigned with the [V1UpdateEmployee](#endpoint-v1updateemployee)
250
+ # Roles are assigned with the
251
+ # [V1UpdateEmployee]($e/V1Employees/UpdateEmployeeRole)
251
252
  # endpoint. An employee can have only one role at a time.
252
253
  # If an employee has no role, they have none of the permissions associated
253
254
  # with roles. All employees can accept payments with Square Point of Sale.
@@ -357,395 +358,5 @@ module Square
357
358
  _response, data: decoded, errors: _errors
358
359
  )
359
360
  end
360
-
361
- # Provides summary information for all of a business's employee timecards.
362
- # @param [SortOrder] order Optional parameter: The order in which timecards
363
- # are listed in the response, based on their created_at field.
364
- # @param [String] employee_id Optional parameter: If provided, the endpoint
365
- # returns only timecards for the employee with the specified ID.
366
- # @param [String] begin_clockin_time Optional parameter: If filtering
367
- # results by their clockin_time field, the beginning of the requested
368
- # reporting period, in ISO 8601 format.
369
- # @param [String] end_clockin_time Optional parameter: If filtering results
370
- # by their clockin_time field, the end of the requested reporting period, in
371
- # ISO 8601 format.
372
- # @param [String] begin_clockout_time Optional parameter: If filtering
373
- # results by their clockout_time field, the beginning of the requested
374
- # reporting period, in ISO 8601 format.
375
- # @param [String] end_clockout_time Optional parameter: If filtering results
376
- # by their clockout_time field, the end of the requested reporting period,
377
- # in ISO 8601 format.
378
- # @param [String] begin_updated_at Optional parameter: If filtering results
379
- # by their updated_at field, the beginning of the requested reporting
380
- # period, in ISO 8601 format.
381
- # @param [String] end_updated_at Optional parameter: If filtering results by
382
- # their updated_at field, the end of the requested reporting period, in ISO
383
- # 8601 format.
384
- # @param [Boolean] deleted Optional parameter: If true, only deleted
385
- # timecards are returned. If false, only valid timecards are returned.If you
386
- # don't provide this parameter, both valid and deleted timecards are
387
- # returned.
388
- # @param [Integer] limit Optional parameter: The maximum integer number of
389
- # employee entities to return in a single response. Default 100, maximum
390
- # 200.
391
- # @param [String] batch_token Optional parameter: A pagination cursor to
392
- # retrieve the next set of results for your original query to the
393
- # endpoint.
394
- # @return [List of V1Timecard Hash] response from the API call
395
- def list_timecards(order: nil,
396
- employee_id: nil,
397
- begin_clockin_time: nil,
398
- end_clockin_time: nil,
399
- begin_clockout_time: nil,
400
- end_clockout_time: nil,
401
- begin_updated_at: nil,
402
- end_updated_at: nil,
403
- deleted: false,
404
- limit: nil,
405
- batch_token: nil)
406
- warn 'Endpoint list_timecards in V1EmployeesApi is deprecated'
407
- # Prepare query url.
408
- _query_builder = config.get_base_uri
409
- _query_builder << '/v1/me/timecards'
410
- _query_builder = APIHelper.append_url_with_query_parameters(
411
- _query_builder,
412
- 'order' => order,
413
- 'employee_id' => employee_id,
414
- 'begin_clockin_time' => begin_clockin_time,
415
- 'end_clockin_time' => end_clockin_time,
416
- 'begin_clockout_time' => begin_clockout_time,
417
- 'end_clockout_time' => end_clockout_time,
418
- 'begin_updated_at' => begin_updated_at,
419
- 'end_updated_at' => end_updated_at,
420
- 'deleted' => deleted,
421
- 'limit' => limit,
422
- 'batch_token' => batch_token
423
- )
424
- _query_url = APIHelper.clean_url _query_builder
425
-
426
- # Prepare headers.
427
- _headers = {
428
- 'accept' => 'application/json'
429
- }
430
-
431
- # Prepare and execute HttpRequest.
432
- _request = config.http_client.get(
433
- _query_url,
434
- headers: _headers
435
- )
436
- OAuth2.apply(config, _request)
437
- _response = execute_request(_request)
438
-
439
- # Return appropriate response type.
440
- decoded = APIHelper.json_deserialize(_response.raw_body)
441
- _errors = APIHelper.map_response(decoded, ['errors'])
442
- ApiResponse.new(
443
- _response, data: decoded, errors: _errors
444
- )
445
- end
446
-
447
- # Creates a timecard for an employee and clocks them in with an
448
- # `API_CREATE` event and a `clockin_time` set to the current time unless
449
- # the request provides a different value.
450
- # To import timecards from another
451
- # system (rather than clocking someone in). Specify the `clockin_time`
452
- # and* `clockout_time` in the request.
453
- # Timecards correspond to exactly one shift for a given employee, bounded
454
- # by the `clockin_time` and `clockout_time` fields. An employee is
455
- # considered clocked in if they have a timecard that doesn't have a
456
- # `clockout_time` set. An employee that is currently clocked in cannot
457
- # be clocked in a second time.
458
- # @param [V1Timecard] body Required parameter: An object containing the
459
- # fields to POST for the request. See the corresponding object definition
460
- # for field details.
461
- # @return [V1Timecard Hash] response from the API call
462
- def create_timecard(body:)
463
- warn 'Endpoint create_timecard in V1EmployeesApi is deprecated'
464
- # Prepare query url.
465
- _query_builder = config.get_base_uri
466
- _query_builder << '/v1/me/timecards'
467
- _query_url = APIHelper.clean_url _query_builder
468
-
469
- # Prepare headers.
470
- _headers = {
471
- 'accept' => 'application/json',
472
- 'content-type' => 'application/json; charset=utf-8'
473
- }
474
-
475
- # Prepare and execute HttpRequest.
476
- _request = config.http_client.post(
477
- _query_url,
478
- headers: _headers,
479
- parameters: body.to_json
480
- )
481
- OAuth2.apply(config, _request)
482
- _response = execute_request(_request)
483
-
484
- # Return appropriate response type.
485
- decoded = APIHelper.json_deserialize(_response.raw_body)
486
- _errors = APIHelper.map_response(decoded, ['errors'])
487
- ApiResponse.new(
488
- _response, data: decoded, errors: _errors
489
- )
490
- end
491
-
492
- # Deletes a timecard. Timecards can also be deleted through the
493
- # Square Dashboard. Deleted timecards are still accessible through
494
- # Connect API endpoints, but cannot be modified. The `deleted` field of
495
- # the `Timecard` object indicates whether the timecard has been deleted.
496
- # __Note__: By default, deleted timecards appear alongside valid timecards
497
- # in
498
- # results returned by the
499
- # [ListTimecards](#endpoint-v1employees-listtimecards)
500
- # endpoint. To filter deleted timecards, include the `deleted` query
501
- # parameter in the list request.
502
- # Only approved accounts can manage their employees with Square.
503
- # Unapproved accounts cannot use employee management features with the
504
- # API.
505
- # @param [String] timecard_id Required parameter: The ID of the timecard to
506
- # delete.
507
- # @return [Object] response from the API call
508
- def delete_timecard(timecard_id:)
509
- warn 'Endpoint delete_timecard in V1EmployeesApi is deprecated'
510
- # Prepare query url.
511
- _query_builder = config.get_base_uri
512
- _query_builder << '/v1/me/timecards/{timecard_id}'
513
- _query_builder = APIHelper.append_url_with_template_parameters(
514
- _query_builder,
515
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
516
- )
517
- _query_url = APIHelper.clean_url _query_builder
518
-
519
- # Prepare and execute HttpRequest.
520
- _request = config.http_client.delete(
521
- _query_url
522
- )
523
- OAuth2.apply(config, _request)
524
- _response = execute_request(_request)
525
-
526
- # Return appropriate response type.
527
- ApiResponse.new(
528
- _response, data: _response.raw_body
529
- )
530
- end
531
-
532
- # Provides the details for a single timecard.
533
- # <aside>
534
- # Only approved accounts can manage their employees with Square.
535
- # Unapproved accounts cannot use employee management features with the
536
- # API.
537
- # </aside>
538
- # @param [String] timecard_id Required parameter: The timecard's ID.
539
- # @return [V1Timecard Hash] response from the API call
540
- def retrieve_timecard(timecard_id:)
541
- warn 'Endpoint retrieve_timecard in V1EmployeesApi is deprecated'
542
- # Prepare query url.
543
- _query_builder = config.get_base_uri
544
- _query_builder << '/v1/me/timecards/{timecard_id}'
545
- _query_builder = APIHelper.append_url_with_template_parameters(
546
- _query_builder,
547
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
548
- )
549
- _query_url = APIHelper.clean_url _query_builder
550
-
551
- # Prepare headers.
552
- _headers = {
553
- 'accept' => 'application/json'
554
- }
555
-
556
- # Prepare and execute HttpRequest.
557
- _request = config.http_client.get(
558
- _query_url,
559
- headers: _headers
560
- )
561
- OAuth2.apply(config, _request)
562
- _response = execute_request(_request)
563
-
564
- # Return appropriate response type.
565
- decoded = APIHelper.json_deserialize(_response.raw_body)
566
- _errors = APIHelper.map_response(decoded, ['errors'])
567
- ApiResponse.new(
568
- _response, data: decoded, errors: _errors
569
- )
570
- end
571
-
572
- # Modifies the details of a timecard with an `API_EDIT` event for
573
- # the timecard. Updating an active timecard with a `clockout_time`
574
- # clocks the employee out.
575
- # @param [String] timecard_id Required parameter: TThe ID of the timecard to
576
- # modify.
577
- # @param [V1Timecard] body Required parameter: An object containing the
578
- # fields to POST for the request. See the corresponding object definition
579
- # for field details.
580
- # @return [V1Timecard Hash] response from the API call
581
- def update_timecard(timecard_id:,
582
- body:)
583
- warn 'Endpoint update_timecard in V1EmployeesApi is deprecated'
584
- # Prepare query url.
585
- _query_builder = config.get_base_uri
586
- _query_builder << '/v1/me/timecards/{timecard_id}'
587
- _query_builder = APIHelper.append_url_with_template_parameters(
588
- _query_builder,
589
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
590
- )
591
- _query_url = APIHelper.clean_url _query_builder
592
-
593
- # Prepare headers.
594
- _headers = {
595
- 'accept' => 'application/json',
596
- 'content-type' => 'application/json; charset=utf-8'
597
- }
598
-
599
- # Prepare and execute HttpRequest.
600
- _request = config.http_client.put(
601
- _query_url,
602
- headers: _headers,
603
- parameters: body.to_json
604
- )
605
- OAuth2.apply(config, _request)
606
- _response = execute_request(_request)
607
-
608
- # Return appropriate response type.
609
- decoded = APIHelper.json_deserialize(_response.raw_body)
610
- _errors = APIHelper.map_response(decoded, ['errors'])
611
- ApiResponse.new(
612
- _response, data: decoded, errors: _errors
613
- )
614
- end
615
-
616
- # Provides summary information for all events associated with a
617
- # particular timecard.
618
- # Only approved accounts can manage their employees with Square.
619
- # Unapproved accounts cannot use employee management features with the
620
- # API.
621
- # @param [String] timecard_id Required parameter: The ID of the timecard to
622
- # list events for.
623
- # @return [List of V1TimecardEvent Hash] response from the API call
624
- def list_timecard_events(timecard_id:)
625
- warn 'Endpoint list_timecard_events in V1EmployeesApi is deprecated'
626
- # Prepare query url.
627
- _query_builder = config.get_base_uri
628
- _query_builder << '/v1/me/timecards/{timecard_id}/events'
629
- _query_builder = APIHelper.append_url_with_template_parameters(
630
- _query_builder,
631
- 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
632
- )
633
- _query_url = APIHelper.clean_url _query_builder
634
-
635
- # Prepare headers.
636
- _headers = {
637
- 'accept' => 'application/json'
638
- }
639
-
640
- # Prepare and execute HttpRequest.
641
- _request = config.http_client.get(
642
- _query_url,
643
- headers: _headers
644
- )
645
- OAuth2.apply(config, _request)
646
- _response = execute_request(_request)
647
-
648
- # Return appropriate response type.
649
- decoded = APIHelper.json_deserialize(_response.raw_body)
650
- _errors = APIHelper.map_response(decoded, ['errors'])
651
- ApiResponse.new(
652
- _response, data: decoded, errors: _errors
653
- )
654
- end
655
-
656
- # Provides the details for all of a location's cash drawer shifts during a
657
- # date range. The date range you specify cannot exceed 90 days.
658
- # @param [String] location_id Required parameter: The ID of the location to
659
- # list cash drawer shifts for.
660
- # @param [SortOrder] order Optional parameter: The order in which cash
661
- # drawer shifts are listed in the response, based on their created_at field.
662
- # Default value: ASC
663
- # @param [String] begin_time Optional parameter: The beginning of the
664
- # requested reporting period, in ISO 8601 format. Default value: The current
665
- # time minus 90 days.
666
- # @param [String] end_time Optional parameter: The beginning of the
667
- # requested reporting period, in ISO 8601 format. Default value: The current
668
- # time.
669
- # @return [List of V1CashDrawerShift Hash] response from the API call
670
- def list_cash_drawer_shifts(location_id:,
671
- order: nil,
672
- begin_time: nil,
673
- end_time: nil)
674
- warn 'Endpoint list_cash_drawer_shifts in V1EmployeesApi is deprecated'
675
- # Prepare query url.
676
- _query_builder = config.get_base_uri
677
- _query_builder << '/v1/{location_id}/cash-drawer-shifts'
678
- _query_builder = APIHelper.append_url_with_template_parameters(
679
- _query_builder,
680
- 'location_id' => { 'value' => location_id, 'encode' => true }
681
- )
682
- _query_builder = APIHelper.append_url_with_query_parameters(
683
- _query_builder,
684
- 'order' => order,
685
- 'begin_time' => begin_time,
686
- 'end_time' => end_time
687
- )
688
- _query_url = APIHelper.clean_url _query_builder
689
-
690
- # Prepare headers.
691
- _headers = {
692
- 'accept' => 'application/json'
693
- }
694
-
695
- # Prepare and execute HttpRequest.
696
- _request = config.http_client.get(
697
- _query_url,
698
- headers: _headers
699
- )
700
- OAuth2.apply(config, _request)
701
- _response = execute_request(_request)
702
-
703
- # Return appropriate response type.
704
- decoded = APIHelper.json_deserialize(_response.raw_body)
705
- _errors = APIHelper.map_response(decoded, ['errors'])
706
- ApiResponse.new(
707
- _response, data: decoded, errors: _errors
708
- )
709
- end
710
-
711
- # Provides the details for a single cash drawer shift, including all events
712
- # that occurred during the shift.
713
- # @param [String] location_id Required parameter: The ID of the location to
714
- # list cash drawer shifts for.
715
- # @param [String] shift_id Required parameter: The shift's ID.
716
- # @return [V1CashDrawerShift Hash] response from the API call
717
- def retrieve_cash_drawer_shift(location_id:,
718
- shift_id:)
719
- warn 'Endpoint retrieve_cash_drawer_shift in V1EmployeesApi is deprecated'
720
- # Prepare query url.
721
- _query_builder = config.get_base_uri
722
- _query_builder << '/v1/{location_id}/cash-drawer-shifts/{shift_id}'
723
- _query_builder = APIHelper.append_url_with_template_parameters(
724
- _query_builder,
725
- 'location_id' => { 'value' => location_id, 'encode' => true },
726
- 'shift_id' => { 'value' => shift_id, 'encode' => true }
727
- )
728
- _query_url = APIHelper.clean_url _query_builder
729
-
730
- # Prepare headers.
731
- _headers = {
732
- 'accept' => 'application/json'
733
- }
734
-
735
- # Prepare and execute HttpRequest.
736
- _request = config.http_client.get(
737
- _query_url,
738
- headers: _headers
739
- )
740
- OAuth2.apply(config, _request)
741
- _response = execute_request(_request)
742
-
743
- # Return appropriate response type.
744
- decoded = APIHelper.json_deserialize(_response.raw_body)
745
- _errors = APIHelper.map_response(decoded, ['errors'])
746
- ApiResponse.new(
747
- _response, data: decoded, errors: _errors
748
- )
749
- end
750
361
  end
751
362
  end