fangkuai.rb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +10 -0
  3. data/README.md +1 -0
  4. data/lib/square.rb +61 -0
  5. data/lib/square/api/apple_pay_api.rb +50 -0
  6. data/lib/square/api/bank_accounts_api.rb +136 -0
  7. data/lib/square/api/base_api.rb +43 -0
  8. data/lib/square/api/cash_drawers_api.rb +150 -0
  9. data/lib/square/api/catalog_api.rb +572 -0
  10. data/lib/square/api/checkout_api.rb +49 -0
  11. data/lib/square/api/customer_groups_api.rb +182 -0
  12. data/lib/square/api/customer_segments_api.rb +78 -0
  13. data/lib/square/api/customers_api.rb +418 -0
  14. data/lib/square/api/devices_api.rb +120 -0
  15. data/lib/square/api/disputes_api.rb +398 -0
  16. data/lib/square/api/employees_api.rb +87 -0
  17. data/lib/square/api/inventory_api.rb +296 -0
  18. data/lib/square/api/invoices_api.rb +358 -0
  19. data/lib/square/api/labor_api.rb +630 -0
  20. data/lib/square/api/locations_api.rb +151 -0
  21. data/lib/square/api/loyalty_api.rb +543 -0
  22. data/lib/square/api/merchants_api.rb +83 -0
  23. data/lib/square/api/mobile_authorization_api.rb +52 -0
  24. data/lib/square/api/o_auth_api.rb +163 -0
  25. data/lib/square/api/orders_api.rb +280 -0
  26. data/lib/square/api/payments_api.rb +279 -0
  27. data/lib/square/api/refunds_api.rb +145 -0
  28. data/lib/square/api/subscriptions_api.rb +251 -0
  29. data/lib/square/api/team_api.rb +326 -0
  30. data/lib/square/api/terminal_api.rb +141 -0
  31. data/lib/square/api/transactions_api.rb +369 -0
  32. data/lib/square/api/v1_employees_api.rb +723 -0
  33. data/lib/square/api/v1_items_api.rb +1686 -0
  34. data/lib/square/api/v1_locations_api.rb +65 -0
  35. data/lib/square/api/v1_transactions_api.rb +572 -0
  36. data/lib/square/api_helper.rb +276 -0
  37. data/lib/square/client.rb +211 -0
  38. data/lib/square/configuration.rb +101 -0
  39. data/lib/square/exceptions/api_exception.rb +15 -0
  40. data/lib/square/http/api_response.rb +45 -0
  41. data/lib/square/http/auth/o_auth2.rb +12 -0
  42. data/lib/square/http/faraday_client.rb +55 -0
  43. data/lib/square/http/http_call_back.rb +19 -0
  44. data/lib/square/http/http_client.rb +99 -0
  45. data/lib/square/http/http_method_enum.rb +8 -0
  46. data/lib/square/http/http_request.rb +45 -0
  47. data/lib/square/http/http_response.rb +24 -0
  48. data/lib/square/utilities/file_wrapper.rb +12 -0
  49. data/spec/user_journey_spec.rb +148 -0
  50. data/test/api/api_test_base.rb +24 -0
  51. data/test/api/test_catalog_api.rb +59 -0
  52. data/test/api/test_customers_api.rb +45 -0
  53. data/test/api/test_employees_api.rb +36 -0
  54. data/test/api/test_labor_api.rb +74 -0
  55. data/test/api/test_locations_api.rb +35 -0
  56. data/test/api/test_merchants_api.rb +40 -0
  57. data/test/api/test_payments_api.rb +42 -0
  58. data/test/api/test_refunds_api.rb +41 -0
  59. data/test/http_response_catcher.rb +19 -0
  60. data/test/test_helper.rb +94 -0
  61. metadata +199 -0
@@ -0,0 +1,369 @@
1
+ module Square
2
+ # TransactionsApi
3
+ class TransactionsApi < BaseApi
4
+ def initialize(config, http_call_back: nil)
5
+ super(config, http_call_back: http_call_back)
6
+ end
7
+
8
+ # Lists refunds for one of a business's locations.
9
+ # In addition to full or partial tender refunds processed through Square
10
+ # APIs,
11
+ # refunds may result from itemized returns or exchanges through Square's
12
+ # Point of Sale applications.
13
+ # Refunds with a `status` of `PENDING` are not currently included in this
14
+ # endpoint's response.
15
+ # Max results per [page](#paginatingresults): 50
16
+ # @param [String] location_id Required parameter: The ID of the location to
17
+ # list refunds for.
18
+ # @param [String] begin_time Optional parameter: The beginning of the
19
+ # 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
+ # @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
+ # @param [SortOrder] sort_order Optional parameter: The order in which
27
+ # results are listed in the response (`ASC` for oldest first, `DESC` for
28
+ # newest first). Default value: `DESC`
29
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
30
+ # a previous call to this endpoint. Provide this to retrieve the next set of
31
+ # results for your original query. See [Paginating
32
+ # results](#paginatingresults) for more information.
33
+ # @return [ListRefundsResponse Hash] response from the API call
34
+ def list_refunds(location_id:,
35
+ begin_time: nil,
36
+ end_time: nil,
37
+ sort_order: nil,
38
+ cursor: nil)
39
+ warn 'Endpoint list_refunds in TransactionsApi is deprecated'
40
+ # Prepare query url.
41
+ _query_builder = config.get_base_uri
42
+ _query_builder << '/v2/locations/{location_id}/refunds'
43
+ _query_builder = APIHelper.append_url_with_template_parameters(
44
+ _query_builder,
45
+ 'location_id' => location_id
46
+ )
47
+ _query_builder = APIHelper.append_url_with_query_parameters(
48
+ _query_builder,
49
+ 'begin_time' => begin_time,
50
+ 'end_time' => end_time,
51
+ 'sort_order' => sort_order,
52
+ 'cursor' => cursor
53
+ )
54
+ _query_url = APIHelper.clean_url _query_builder
55
+
56
+ # Prepare headers.
57
+ _headers = {
58
+ 'accept' => 'application/json'
59
+ }
60
+
61
+ # Prepare and execute HttpRequest.
62
+ _request = config.http_client.get(
63
+ _query_url,
64
+ headers: _headers
65
+ )
66
+ OAuth2.apply(config, _request)
67
+ _response = execute_request(_request)
68
+
69
+ # Return appropriate response type.
70
+ decoded = APIHelper.json_deserialize(_response.raw_body)
71
+ _errors = APIHelper.map_response(decoded, ['errors'])
72
+ ApiResponse.new(_response, data: decoded, errors: _errors)
73
+ end
74
+
75
+ # Lists transactions for a particular location.
76
+ # Transactions include payment information from sales and exchanges and
77
+ # refund
78
+ # information from returns and exchanges.
79
+ # Max results per [page](#paginatingresults): 50
80
+ # @param [String] location_id Required parameter: The ID of the location to
81
+ # list transactions for.
82
+ # @param [String] begin_time Optional parameter: The beginning of the
83
+ # requested reporting period, in RFC 3339 format. See [Date
84
+ # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
85
+ # value: The current time minus one year.
86
+ # @param [String] end_time Optional parameter: The end of the requested
87
+ # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
88
+ # details on date inclusivity/exclusivity. Default value: The current
89
+ # time.
90
+ # @param [SortOrder] sort_order Optional parameter: The order in which
91
+ # results are listed in the response (`ASC` for oldest first, `DESC` for
92
+ # newest first). Default value: `DESC`
93
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
94
+ # a previous call to this endpoint. Provide this to retrieve the next set of
95
+ # results for your original query. See [Paginating
96
+ # results](#paginatingresults) for more information.
97
+ # @return [ListTransactionsResponse Hash] response from the API call
98
+ def list_transactions(location_id:,
99
+ begin_time: nil,
100
+ end_time: nil,
101
+ sort_order: nil,
102
+ cursor: nil)
103
+ warn 'Endpoint list_transactions in TransactionsApi is deprecated'
104
+ # Prepare query url.
105
+ _query_builder = config.get_base_uri
106
+ _query_builder << '/v2/locations/{location_id}/transactions'
107
+ _query_builder = APIHelper.append_url_with_template_parameters(
108
+ _query_builder,
109
+ 'location_id' => location_id
110
+ )
111
+ _query_builder = APIHelper.append_url_with_query_parameters(
112
+ _query_builder,
113
+ 'begin_time' => begin_time,
114
+ 'end_time' => end_time,
115
+ 'sort_order' => sort_order,
116
+ 'cursor' => cursor
117
+ )
118
+ _query_url = APIHelper.clean_url _query_builder
119
+
120
+ # Prepare headers.
121
+ _headers = {
122
+ 'accept' => 'application/json'
123
+ }
124
+
125
+ # Prepare and execute HttpRequest.
126
+ _request = config.http_client.get(
127
+ _query_url,
128
+ headers: _headers
129
+ )
130
+ OAuth2.apply(config, _request)
131
+ _response = execute_request(_request)
132
+
133
+ # Return appropriate response type.
134
+ decoded = APIHelper.json_deserialize(_response.raw_body)
135
+ _errors = APIHelper.map_response(decoded, ['errors'])
136
+ ApiResponse.new(_response, data: decoded, errors: _errors)
137
+ end
138
+
139
+ # Charges a card represented by a card nonce or a customer's card on file.
140
+ # Your request to this endpoint must include _either_:
141
+ # - A value for the `card_nonce` parameter (to charge a card nonce generated
142
+ # with the `SqPaymentForm`)
143
+ # - Values for the `customer_card_id` and `customer_id` parameters (to
144
+ # charge
145
+ # a customer's card on file)
146
+ # In order for an eCommerce payment to potentially qualify for
147
+ # [Square chargeback protection](https://squareup.com/help/article/5394),
148
+ # you
149
+ # _must_ provide values for the following parameters in your request:
150
+ # - `buyer_email_address`
151
+ # - At least one of `billing_address` or `shipping_address`
152
+ # When this response is returned, the amount of Square's processing fee
153
+ # might not yet be
154
+ # calculated. To obtain the processing fee, wait about ten seconds and call
155
+ # [RetrieveTransaction](#endpoint-retrievetransaction). See the
156
+ # `processing_fee_money`
157
+ # field of each [Tender included](#type-tender) in the transaction.
158
+ # @param [String] location_id Required parameter: The ID of the location to
159
+ # associate the created transaction with.
160
+ # @param [ChargeRequest] body Required parameter: An object containing the
161
+ # fields to POST for the request. See the corresponding object definition
162
+ # for field details.
163
+ # @return [ChargeResponse Hash] response from the API call
164
+ def charge(location_id:,
165
+ body:)
166
+ warn 'Endpoint charge in TransactionsApi is deprecated'
167
+ # Prepare query url.
168
+ _query_builder = config.get_base_uri
169
+ _query_builder << '/v2/locations/{location_id}/transactions'
170
+ _query_builder = APIHelper.append_url_with_template_parameters(
171
+ _query_builder,
172
+ 'location_id' => location_id
173
+ )
174
+ _query_url = APIHelper.clean_url _query_builder
175
+
176
+ # Prepare headers.
177
+ _headers = {
178
+ 'accept' => 'application/json',
179
+ 'content-type' => 'application/json; charset=utf-8'
180
+ }
181
+
182
+ # Prepare and execute HttpRequest.
183
+ _request = config.http_client.post(
184
+ _query_url,
185
+ headers: _headers,
186
+ parameters: body.to_json
187
+ )
188
+ OAuth2.apply(config, _request)
189
+ _response = execute_request(_request)
190
+
191
+ # Return appropriate response type.
192
+ decoded = APIHelper.json_deserialize(_response.raw_body)
193
+ _errors = APIHelper.map_response(decoded, ['errors'])
194
+ ApiResponse.new(_response, data: decoded, errors: _errors)
195
+ end
196
+
197
+ # Retrieves details for a single transaction.
198
+ # @param [String] location_id Required parameter: The ID of the
199
+ # transaction's associated location.
200
+ # @param [String] transaction_id Required parameter: The ID of the
201
+ # transaction to retrieve.
202
+ # @return [RetrieveTransactionResponse Hash] response from the API call
203
+ def retrieve_transaction(location_id:,
204
+ transaction_id:)
205
+ warn 'Endpoint retrieve_transaction in TransactionsApi is deprecated'
206
+ # Prepare query url.
207
+ _query_builder = config.get_base_uri
208
+ _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}'
209
+ _query_builder = APIHelper.append_url_with_template_parameters(
210
+ _query_builder,
211
+ 'location_id' => location_id,
212
+ 'transaction_id' => transaction_id
213
+ )
214
+ _query_url = APIHelper.clean_url _query_builder
215
+
216
+ # Prepare headers.
217
+ _headers = {
218
+ 'accept' => 'application/json'
219
+ }
220
+
221
+ # Prepare and execute HttpRequest.
222
+ _request = config.http_client.get(
223
+ _query_url,
224
+ headers: _headers
225
+ )
226
+ OAuth2.apply(config, _request)
227
+ _response = execute_request(_request)
228
+
229
+ # Return appropriate response type.
230
+ decoded = APIHelper.json_deserialize(_response.raw_body)
231
+ _errors = APIHelper.map_response(decoded, ['errors'])
232
+ ApiResponse.new(_response, data: decoded, errors: _errors)
233
+ end
234
+
235
+ # Captures a transaction that was created with the
236
+ # [Charge](#endpoint-charge)
237
+ # endpoint with a `delay_capture` value of `true`.
238
+ # See [Delayed capture
239
+ # transactions](https://developer.squareup.com/docs/payments/transactions/ov
240
+ # erview#delayed-capture)
241
+ # for more information.
242
+ # @param [String] location_id Required parameter: Example:
243
+ # @param [String] transaction_id Required parameter: Example:
244
+ # @return [CaptureTransactionResponse Hash] response from the API call
245
+ def capture_transaction(location_id:,
246
+ transaction_id:)
247
+ warn 'Endpoint capture_transaction in TransactionsApi is deprecated'
248
+ # Prepare query url.
249
+ _query_builder = config.get_base_uri
250
+ _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/capture'
251
+ _query_builder = APIHelper.append_url_with_template_parameters(
252
+ _query_builder,
253
+ 'location_id' => location_id,
254
+ 'transaction_id' => transaction_id
255
+ )
256
+ _query_url = APIHelper.clean_url _query_builder
257
+
258
+ # Prepare headers.
259
+ _headers = {
260
+ 'accept' => 'application/json'
261
+ }
262
+
263
+ # Prepare and execute HttpRequest.
264
+ _request = config.http_client.post(
265
+ _query_url,
266
+ headers: _headers
267
+ )
268
+ OAuth2.apply(config, _request)
269
+ _response = execute_request(_request)
270
+
271
+ # Return appropriate response type.
272
+ decoded = APIHelper.json_deserialize(_response.raw_body)
273
+ _errors = APIHelper.map_response(decoded, ['errors'])
274
+ ApiResponse.new(_response, data: decoded, errors: _errors)
275
+ end
276
+
277
+ # Initiates a refund for a previously charged tender.
278
+ # You must issue a refund within 120 days of the associated payment. See
279
+ # [this article](https://squareup.com/help/us/en/article/5060) for more
280
+ # information
281
+ # on refund behavior.
282
+ # NOTE: Card-present transactions with Interac credit cards **cannot be
283
+ # refunded using the Connect API**. Interac transactions must refunded
284
+ # in-person (e.g., dipping the card using POS app).
285
+ # @param [String] location_id Required parameter: The ID of the original
286
+ # transaction's associated location.
287
+ # @param [String] transaction_id Required parameter: The ID of the original
288
+ # transaction that includes the tender to refund.
289
+ # @param [CreateRefundRequest] body Required parameter: An object containing
290
+ # the fields to POST for the request. See the corresponding object
291
+ # definition for field details.
292
+ # @return [CreateRefundResponse Hash] response from the API call
293
+ def create_refund(location_id:,
294
+ transaction_id:,
295
+ body:)
296
+ warn 'Endpoint create_refund in TransactionsApi is deprecated'
297
+ # Prepare query url.
298
+ _query_builder = config.get_base_uri
299
+ _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/refund'
300
+ _query_builder = APIHelper.append_url_with_template_parameters(
301
+ _query_builder,
302
+ 'location_id' => location_id,
303
+ 'transaction_id' => transaction_id
304
+ )
305
+ _query_url = APIHelper.clean_url _query_builder
306
+
307
+ # Prepare headers.
308
+ _headers = {
309
+ 'accept' => 'application/json',
310
+ 'content-type' => 'application/json; charset=utf-8'
311
+ }
312
+
313
+ # Prepare and execute HttpRequest.
314
+ _request = config.http_client.post(
315
+ _query_url,
316
+ headers: _headers,
317
+ parameters: body.to_json
318
+ )
319
+ OAuth2.apply(config, _request)
320
+ _response = execute_request(_request)
321
+
322
+ # Return appropriate response type.
323
+ decoded = APIHelper.json_deserialize(_response.raw_body)
324
+ _errors = APIHelper.map_response(decoded, ['errors'])
325
+ ApiResponse.new(_response, data: decoded, errors: _errors)
326
+ end
327
+
328
+ # Cancels a transaction that was created with the [Charge](#endpoint-charge)
329
+ # endpoint with a `delay_capture` value of `true`.
330
+ # See [Delayed capture
331
+ # transactions](https://developer.squareup.com/docs/payments/transactions/ov
332
+ # erview#delayed-capture)
333
+ # for more information.
334
+ # @param [String] location_id Required parameter: Example:
335
+ # @param [String] transaction_id Required parameter: Example:
336
+ # @return [VoidTransactionResponse Hash] response from the API call
337
+ def void_transaction(location_id:,
338
+ transaction_id:)
339
+ warn 'Endpoint void_transaction in TransactionsApi is deprecated'
340
+ # Prepare query url.
341
+ _query_builder = config.get_base_uri
342
+ _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/void'
343
+ _query_builder = APIHelper.append_url_with_template_parameters(
344
+ _query_builder,
345
+ 'location_id' => location_id,
346
+ 'transaction_id' => transaction_id
347
+ )
348
+ _query_url = APIHelper.clean_url _query_builder
349
+
350
+ # Prepare headers.
351
+ _headers = {
352
+ 'accept' => 'application/json'
353
+ }
354
+
355
+ # Prepare and execute HttpRequest.
356
+ _request = config.http_client.post(
357
+ _query_url,
358
+ headers: _headers
359
+ )
360
+ OAuth2.apply(config, _request)
361
+ _response = execute_request(_request)
362
+
363
+ # Return appropriate response type.
364
+ decoded = APIHelper.json_deserialize(_response.raw_body)
365
+ _errors = APIHelper.map_response(decoded, ['errors'])
366
+ ApiResponse.new(_response, data: decoded, errors: _errors)
367
+ end
368
+ end
369
+ end
@@ -0,0 +1,723 @@
1
+ module Square
2
+ # V1EmployeesApi
3
+ class V1EmployeesApi < BaseApi
4
+ def initialize(config, http_call_back: nil)
5
+ super(config, http_call_back: http_call_back)
6
+ end
7
+
8
+ # Provides summary information for all of a business's employees.
9
+ # @param [SortOrder] order Optional parameter: The order in which employees
10
+ # are listed in the response, based on their created_at field. Default
11
+ # value: ASC
12
+ # @param [String] begin_updated_at Optional parameter: If filtering results
13
+ # by their updated_at field, the beginning of the requested reporting
14
+ # period, in ISO 8601 format
15
+ # @param [String] end_updated_at Optional parameter: If filtering results by
16
+ # there updated_at field, the end of the requested reporting period, in ISO
17
+ # 8601 format.
18
+ # @param [String] begin_created_at Optional parameter: If filtering results
19
+ # by their created_at field, the beginning of the requested reporting
20
+ # period, in ISO 8601 format.
21
+ # @param [String] end_created_at Optional parameter: If filtering results by
22
+ # their created_at field, the end of the requested reporting period, in ISO
23
+ # 8601 format.
24
+ # @param [V1ListEmployeesRequestStatus] status Optional parameter: If
25
+ # provided, the endpoint returns only employee entities with the specified
26
+ # status (ACTIVE or INACTIVE).
27
+ # @param [String] external_id Optional parameter: If provided, the endpoint
28
+ # returns only employee entities with the specified external_id.
29
+ # @param [Integer] limit Optional parameter: The maximum integer number of
30
+ # employee entities to return in a single response. Default 100, maximum
31
+ # 200.
32
+ # @param [String] batch_token Optional parameter: A pagination cursor to
33
+ # retrieve the next set of results for your original query to the
34
+ # endpoint.
35
+ # @return [List of V1Employee Hash] response from the API call
36
+ def list_employees(order: nil,
37
+ begin_updated_at: nil,
38
+ end_updated_at: nil,
39
+ begin_created_at: nil,
40
+ end_created_at: nil,
41
+ status: nil,
42
+ external_id: nil,
43
+ limit: nil,
44
+ batch_token: nil)
45
+ # Prepare query url.
46
+ _query_builder = config.get_base_uri
47
+ _query_builder << '/v1/me/employees'
48
+ _query_builder = APIHelper.append_url_with_query_parameters(
49
+ _query_builder,
50
+ 'order' => order,
51
+ 'begin_updated_at' => begin_updated_at,
52
+ 'end_updated_at' => end_updated_at,
53
+ 'begin_created_at' => begin_created_at,
54
+ 'end_created_at' => end_created_at,
55
+ 'status' => status,
56
+ 'external_id' => external_id,
57
+ 'limit' => limit,
58
+ 'batch_token' => batch_token
59
+ )
60
+ _query_url = APIHelper.clean_url _query_builder
61
+
62
+ # Prepare headers.
63
+ _headers = {
64
+ 'accept' => 'application/json'
65
+ }
66
+
67
+ # Prepare and execute HttpRequest.
68
+ _request = config.http_client.get(
69
+ _query_url,
70
+ headers: _headers
71
+ )
72
+ OAuth2.apply(config, _request)
73
+ _response = execute_request(_request)
74
+
75
+ # Return appropriate response type.
76
+ decoded = APIHelper.json_deserialize(_response.raw_body)
77
+ _errors = APIHelper.map_response(decoded, ['errors'])
78
+ ApiResponse.new(_response, data: decoded, errors: _errors)
79
+ end
80
+
81
+ # Use the CreateEmployee endpoint to add an employee to a Square
82
+ # account. Employees created with the Connect API have an initial status
83
+ # of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale
84
+ # until they are activated from the Square Dashboard. Employee status
85
+ # cannot be changed with the Connect API.
86
+ # <aside class="important">
87
+ # Employee entities cannot be deleted. To disable employee profiles,
88
+ # set the employee's status to <code>INACTIVE</code>
89
+ # </aside>
90
+ # @param [V1Employee] body Required parameter: An object containing the
91
+ # fields to POST for the request. See the corresponding object definition
92
+ # for field details.
93
+ # @return [V1Employee Hash] response from the API call
94
+ def create_employee(body:)
95
+ # Prepare query url.
96
+ _query_builder = config.get_base_uri
97
+ _query_builder << '/v1/me/employees'
98
+ _query_url = APIHelper.clean_url _query_builder
99
+
100
+ # Prepare headers.
101
+ _headers = {
102
+ 'accept' => 'application/json',
103
+ 'content-type' => 'application/json; charset=utf-8'
104
+ }
105
+
106
+ # Prepare and execute HttpRequest.
107
+ _request = config.http_client.post(
108
+ _query_url,
109
+ headers: _headers,
110
+ parameters: body.to_json
111
+ )
112
+ OAuth2.apply(config, _request)
113
+ _response = execute_request(_request)
114
+
115
+ # Return appropriate response type.
116
+ decoded = APIHelper.json_deserialize(_response.raw_body)
117
+ _errors = APIHelper.map_response(decoded, ['errors'])
118
+ ApiResponse.new(_response, data: decoded, errors: _errors)
119
+ end
120
+
121
+ # Provides the details for a single employee.
122
+ # @param [String] employee_id Required parameter: The employee's ID.
123
+ # @return [V1Employee Hash] response from the API call
124
+ def retrieve_employee(employee_id:)
125
+ # Prepare query url.
126
+ _query_builder = config.get_base_uri
127
+ _query_builder << '/v1/me/employees/{employee_id}'
128
+ _query_builder = APIHelper.append_url_with_template_parameters(
129
+ _query_builder,
130
+ 'employee_id' => employee_id
131
+ )
132
+ _query_url = APIHelper.clean_url _query_builder
133
+
134
+ # Prepare headers.
135
+ _headers = {
136
+ 'accept' => 'application/json'
137
+ }
138
+
139
+ # Prepare and execute HttpRequest.
140
+ _request = config.http_client.get(
141
+ _query_url,
142
+ headers: _headers
143
+ )
144
+ OAuth2.apply(config, _request)
145
+ _response = execute_request(_request)
146
+
147
+ # Return appropriate response type.
148
+ decoded = APIHelper.json_deserialize(_response.raw_body)
149
+ _errors = APIHelper.map_response(decoded, ['errors'])
150
+ ApiResponse.new(_response, data: decoded, errors: _errors)
151
+ end
152
+
153
+ # UpdateEmployee
154
+ # @param [String] employee_id Required parameter: The ID of the role to
155
+ # modify.
156
+ # @param [V1Employee] body Required parameter: An object containing the
157
+ # fields to POST for the request. See the corresponding object definition
158
+ # for field details.
159
+ # @return [V1Employee Hash] response from the API call
160
+ def update_employee(employee_id:,
161
+ body:)
162
+ # Prepare query url.
163
+ _query_builder = config.get_base_uri
164
+ _query_builder << '/v1/me/employees/{employee_id}'
165
+ _query_builder = APIHelper.append_url_with_template_parameters(
166
+ _query_builder,
167
+ 'employee_id' => employee_id
168
+ )
169
+ _query_url = APIHelper.clean_url _query_builder
170
+
171
+ # Prepare headers.
172
+ _headers = {
173
+ 'accept' => 'application/json',
174
+ 'content-type' => 'application/json; charset=utf-8'
175
+ }
176
+
177
+ # Prepare and execute HttpRequest.
178
+ _request = config.http_client.put(
179
+ _query_url,
180
+ headers: _headers,
181
+ parameters: body.to_json
182
+ )
183
+ OAuth2.apply(config, _request)
184
+ _response = execute_request(_request)
185
+
186
+ # Return appropriate response type.
187
+ decoded = APIHelper.json_deserialize(_response.raw_body)
188
+ _errors = APIHelper.map_response(decoded, ['errors'])
189
+ ApiResponse.new(_response, data: decoded, errors: _errors)
190
+ end
191
+
192
+ # Provides summary information for all of a business's employee roles.
193
+ # @param [SortOrder] order Optional parameter: The order in which employees
194
+ # are listed in the response, based on their created_at field.Default value:
195
+ # ASC
196
+ # @param [Integer] limit Optional parameter: The maximum integer number of
197
+ # employee entities to return in a single response. Default 100, maximum
198
+ # 200.
199
+ # @param [String] batch_token Optional parameter: A pagination cursor to
200
+ # retrieve the next set of results for your original query to the
201
+ # endpoint.
202
+ # @return [List of V1EmployeeRole Hash] response from the API call
203
+ def list_employee_roles(order: nil,
204
+ limit: nil,
205
+ batch_token: nil)
206
+ # Prepare query url.
207
+ _query_builder = config.get_base_uri
208
+ _query_builder << '/v1/me/roles'
209
+ _query_builder = APIHelper.append_url_with_query_parameters(
210
+ _query_builder,
211
+ 'order' => order,
212
+ 'limit' => limit,
213
+ 'batch_token' => batch_token
214
+ )
215
+ _query_url = APIHelper.clean_url _query_builder
216
+
217
+ # Prepare headers.
218
+ _headers = {
219
+ 'accept' => 'application/json'
220
+ }
221
+
222
+ # Prepare and execute HttpRequest.
223
+ _request = config.http_client.get(
224
+ _query_url,
225
+ headers: _headers
226
+ )
227
+ OAuth2.apply(config, _request)
228
+ _response = execute_request(_request)
229
+
230
+ # Return appropriate response type.
231
+ decoded = APIHelper.json_deserialize(_response.raw_body)
232
+ _errors = APIHelper.map_response(decoded, ['errors'])
233
+ ApiResponse.new(_response, data: decoded, errors: _errors)
234
+ end
235
+
236
+ # Creates an employee role you can then assign to employees.
237
+ # Square accounts can include any number of roles that can be assigned to
238
+ # employees. These roles define the actions and permissions granted to an
239
+ # employee with that role. For example, an employee with a "Shift Manager"
240
+ # role might be able to issue refunds in Square Point of Sale, whereas an
241
+ # employee with a "Clerk" role might not.
242
+ # Roles are assigned with the [V1UpdateEmployee](#endpoint-v1updateemployee)
243
+ # endpoint. An employee can have only one role at a time.
244
+ # If an employee has no role, they have none of the permissions associated
245
+ # with roles. All employees can accept payments with Square Point of Sale.
246
+ # @param [V1EmployeeRole] body Required parameter: An EmployeeRole object
247
+ # with a name and permissions, and an optional owner flag.
248
+ # @return [V1EmployeeRole Hash] response from the API call
249
+ def create_employee_role(body:)
250
+ # Prepare query url.
251
+ _query_builder = config.get_base_uri
252
+ _query_builder << '/v1/me/roles'
253
+ _query_url = APIHelper.clean_url _query_builder
254
+
255
+ # Prepare headers.
256
+ _headers = {
257
+ 'accept' => 'application/json',
258
+ 'content-type' => 'application/json; charset=utf-8'
259
+ }
260
+
261
+ # Prepare and execute HttpRequest.
262
+ _request = config.http_client.post(
263
+ _query_url,
264
+ headers: _headers,
265
+ parameters: body.to_json
266
+ )
267
+ OAuth2.apply(config, _request)
268
+ _response = execute_request(_request)
269
+
270
+ # Return appropriate response type.
271
+ decoded = APIHelper.json_deserialize(_response.raw_body)
272
+ _errors = APIHelper.map_response(decoded, ['errors'])
273
+ ApiResponse.new(_response, data: decoded, errors: _errors)
274
+ end
275
+
276
+ # Provides the details for a single employee role.
277
+ # @param [String] role_id Required parameter: The role's ID.
278
+ # @return [V1EmployeeRole Hash] response from the API call
279
+ def retrieve_employee_role(role_id:)
280
+ # Prepare query url.
281
+ _query_builder = config.get_base_uri
282
+ _query_builder << '/v1/me/roles/{role_id}'
283
+ _query_builder = APIHelper.append_url_with_template_parameters(
284
+ _query_builder,
285
+ 'role_id' => role_id
286
+ )
287
+ _query_url = APIHelper.clean_url _query_builder
288
+
289
+ # Prepare headers.
290
+ _headers = {
291
+ 'accept' => 'application/json'
292
+ }
293
+
294
+ # Prepare and execute HttpRequest.
295
+ _request = config.http_client.get(
296
+ _query_url,
297
+ headers: _headers
298
+ )
299
+ OAuth2.apply(config, _request)
300
+ _response = execute_request(_request)
301
+
302
+ # Return appropriate response type.
303
+ decoded = APIHelper.json_deserialize(_response.raw_body)
304
+ _errors = APIHelper.map_response(decoded, ['errors'])
305
+ ApiResponse.new(_response, data: decoded, errors: _errors)
306
+ end
307
+
308
+ # Modifies the details of an employee role.
309
+ # @param [String] role_id Required parameter: The ID of the role to
310
+ # modify.
311
+ # @param [V1EmployeeRole] body Required parameter: An object containing the
312
+ # fields to POST for the request. See the corresponding object definition
313
+ # for field details.
314
+ # @return [V1EmployeeRole Hash] response from the API call
315
+ def update_employee_role(role_id:,
316
+ body:)
317
+ # Prepare query url.
318
+ _query_builder = config.get_base_uri
319
+ _query_builder << '/v1/me/roles/{role_id}'
320
+ _query_builder = APIHelper.append_url_with_template_parameters(
321
+ _query_builder,
322
+ 'role_id' => role_id
323
+ )
324
+ _query_url = APIHelper.clean_url _query_builder
325
+
326
+ # Prepare headers.
327
+ _headers = {
328
+ 'accept' => 'application/json',
329
+ 'content-type' => 'application/json; charset=utf-8'
330
+ }
331
+
332
+ # Prepare and execute HttpRequest.
333
+ _request = config.http_client.put(
334
+ _query_url,
335
+ headers: _headers,
336
+ parameters: body.to_json
337
+ )
338
+ OAuth2.apply(config, _request)
339
+ _response = execute_request(_request)
340
+
341
+ # Return appropriate response type.
342
+ decoded = APIHelper.json_deserialize(_response.raw_body)
343
+ _errors = APIHelper.map_response(decoded, ['errors'])
344
+ ApiResponse.new(_response, data: decoded, errors: _errors)
345
+ end
346
+
347
+ # Provides summary information for all of a business's employee timecards.
348
+ # @param [SortOrder] order Optional parameter: The order in which timecards
349
+ # are listed in the response, based on their created_at field.
350
+ # @param [String] employee_id Optional parameter: If provided, the endpoint
351
+ # returns only timecards for the employee with the specified ID.
352
+ # @param [String] begin_clockin_time Optional parameter: If filtering
353
+ # results by their clockin_time field, the beginning of the requested
354
+ # reporting period, in ISO 8601 format.
355
+ # @param [String] end_clockin_time Optional parameter: If filtering results
356
+ # by their clockin_time field, the end of the requested reporting period, in
357
+ # ISO 8601 format.
358
+ # @param [String] begin_clockout_time Optional parameter: If filtering
359
+ # results by their clockout_time field, the beginning of the requested
360
+ # reporting period, in ISO 8601 format.
361
+ # @param [String] end_clockout_time Optional parameter: If filtering results
362
+ # by their clockout_time field, the end of the requested reporting period,
363
+ # in ISO 8601 format.
364
+ # @param [String] begin_updated_at Optional parameter: If filtering results
365
+ # by their updated_at field, the beginning of the requested reporting
366
+ # period, in ISO 8601 format.
367
+ # @param [String] end_updated_at Optional parameter: If filtering results by
368
+ # their updated_at field, the end of the requested reporting period, in ISO
369
+ # 8601 format.
370
+ # @param [Boolean] deleted Optional parameter: If true, only deleted
371
+ # timecards are returned. If false, only valid timecards are returned.If you
372
+ # don't provide this parameter, both valid and deleted timecards are
373
+ # returned.
374
+ # @param [Integer] limit Optional parameter: The maximum integer number of
375
+ # employee entities to return in a single response. Default 100, maximum
376
+ # 200.
377
+ # @param [String] batch_token Optional parameter: A pagination cursor to
378
+ # retrieve the next set of results for your original query to the
379
+ # endpoint.
380
+ # @return [List of V1Timecard Hash] response from the API call
381
+ def list_timecards(order: nil,
382
+ employee_id: nil,
383
+ begin_clockin_time: nil,
384
+ end_clockin_time: nil,
385
+ begin_clockout_time: nil,
386
+ end_clockout_time: nil,
387
+ begin_updated_at: nil,
388
+ end_updated_at: nil,
389
+ deleted: false,
390
+ limit: nil,
391
+ batch_token: nil)
392
+ warn 'Endpoint list_timecards in V1EmployeesApi is deprecated'
393
+ # Prepare query url.
394
+ _query_builder = config.get_base_uri
395
+ _query_builder << '/v1/me/timecards'
396
+ _query_builder = APIHelper.append_url_with_query_parameters(
397
+ _query_builder,
398
+ 'order' => order,
399
+ 'employee_id' => employee_id,
400
+ 'begin_clockin_time' => begin_clockin_time,
401
+ 'end_clockin_time' => end_clockin_time,
402
+ 'begin_clockout_time' => begin_clockout_time,
403
+ 'end_clockout_time' => end_clockout_time,
404
+ 'begin_updated_at' => begin_updated_at,
405
+ 'end_updated_at' => end_updated_at,
406
+ 'deleted' => deleted,
407
+ 'limit' => limit,
408
+ 'batch_token' => batch_token
409
+ )
410
+ _query_url = APIHelper.clean_url _query_builder
411
+
412
+ # Prepare headers.
413
+ _headers = {
414
+ 'accept' => 'application/json'
415
+ }
416
+
417
+ # Prepare and execute HttpRequest.
418
+ _request = config.http_client.get(
419
+ _query_url,
420
+ headers: _headers
421
+ )
422
+ OAuth2.apply(config, _request)
423
+ _response = execute_request(_request)
424
+
425
+ # Return appropriate response type.
426
+ decoded = APIHelper.json_deserialize(_response.raw_body)
427
+ _errors = APIHelper.map_response(decoded, ['errors'])
428
+ ApiResponse.new(_response, data: decoded, errors: _errors)
429
+ end
430
+
431
+ # Creates a timecard for an employee and clocks them in with an
432
+ # `API_CREATE` event and a `clockin_time` set to the current time unless
433
+ # the request provides a different value.
434
+ # To import timecards from another
435
+ # system (rather than clocking someone in). Specify the `clockin_time`
436
+ # and* `clockout_time` in the request.
437
+ # Timecards correspond to exactly one shift for a given employee, bounded
438
+ # by the `clockin_time` and `clockout_time` fields. An employee is
439
+ # considered clocked in if they have a timecard that doesn't have a
440
+ # `clockout_time` set. An employee that is currently clocked in cannot
441
+ # be clocked in a second time.
442
+ # @param [V1Timecard] body Required parameter: An object containing the
443
+ # fields to POST for the request. See the corresponding object definition
444
+ # for field details.
445
+ # @return [V1Timecard Hash] response from the API call
446
+ def create_timecard(body:)
447
+ warn 'Endpoint create_timecard in V1EmployeesApi is deprecated'
448
+ # Prepare query url.
449
+ _query_builder = config.get_base_uri
450
+ _query_builder << '/v1/me/timecards'
451
+ _query_url = APIHelper.clean_url _query_builder
452
+
453
+ # Prepare headers.
454
+ _headers = {
455
+ 'accept' => 'application/json',
456
+ 'content-type' => 'application/json; charset=utf-8'
457
+ }
458
+
459
+ # Prepare and execute HttpRequest.
460
+ _request = config.http_client.post(
461
+ _query_url,
462
+ headers: _headers,
463
+ parameters: body.to_json
464
+ )
465
+ OAuth2.apply(config, _request)
466
+ _response = execute_request(_request)
467
+
468
+ # Return appropriate response type.
469
+ decoded = APIHelper.json_deserialize(_response.raw_body)
470
+ _errors = APIHelper.map_response(decoded, ['errors'])
471
+ ApiResponse.new(_response, data: decoded, errors: _errors)
472
+ end
473
+
474
+ # Deletes a timecard. Timecards can also be deleted through the
475
+ # Square Dashboard. Deleted timecards are still accessible through
476
+ # Connect API endpoints, but cannot be modified. The `deleted` field of
477
+ # the `Timecard` object indicates whether the timecard has been deleted.
478
+ # __Note__: By default, deleted timecards appear alongside valid timecards
479
+ # in
480
+ # results returned by the
481
+ # [ListTimecards](#endpoint-v1employees-listtimecards)
482
+ # endpoint. To filter deleted timecards, include the `deleted` query
483
+ # parameter in the list request.
484
+ # Only approved accounts can manage their employees with Square.
485
+ # Unapproved accounts cannot use employee management features with the
486
+ # API.
487
+ # @param [String] timecard_id Required parameter: The ID of the timecard to
488
+ # delete.
489
+ # @return [Object] response from the API call
490
+ def delete_timecard(timecard_id:)
491
+ warn 'Endpoint delete_timecard in V1EmployeesApi is deprecated'
492
+ # Prepare query url.
493
+ _query_builder = config.get_base_uri
494
+ _query_builder << '/v1/me/timecards/{timecard_id}'
495
+ _query_builder = APIHelper.append_url_with_template_parameters(
496
+ _query_builder,
497
+ 'timecard_id' => timecard_id
498
+ )
499
+ _query_url = APIHelper.clean_url _query_builder
500
+
501
+ # Prepare and execute HttpRequest.
502
+ _request = config.http_client.delete(
503
+ _query_url
504
+ )
505
+ OAuth2.apply(config, _request)
506
+ _response = execute_request(_request)
507
+
508
+ # Return appropriate response type.
509
+ ApiResponse.new(_response, data: _response.raw_body)
510
+ end
511
+
512
+ # Provides the details for a single timecard.
513
+ # <aside>
514
+ # Only approved accounts can manage their employees with Square.
515
+ # Unapproved accounts cannot use employee management features with the
516
+ # API.
517
+ # </aside>
518
+ # @param [String] timecard_id Required parameter: The timecard's ID.
519
+ # @return [V1Timecard Hash] response from the API call
520
+ def retrieve_timecard(timecard_id:)
521
+ warn 'Endpoint retrieve_timecard in V1EmployeesApi is deprecated'
522
+ # Prepare query url.
523
+ _query_builder = config.get_base_uri
524
+ _query_builder << '/v1/me/timecards/{timecard_id}'
525
+ _query_builder = APIHelper.append_url_with_template_parameters(
526
+ _query_builder,
527
+ 'timecard_id' => timecard_id
528
+ )
529
+ _query_url = APIHelper.clean_url _query_builder
530
+
531
+ # Prepare headers.
532
+ _headers = {
533
+ 'accept' => 'application/json'
534
+ }
535
+
536
+ # Prepare and execute HttpRequest.
537
+ _request = config.http_client.get(
538
+ _query_url,
539
+ headers: _headers
540
+ )
541
+ OAuth2.apply(config, _request)
542
+ _response = execute_request(_request)
543
+
544
+ # Return appropriate response type.
545
+ decoded = APIHelper.json_deserialize(_response.raw_body)
546
+ _errors = APIHelper.map_response(decoded, ['errors'])
547
+ ApiResponse.new(_response, data: decoded, errors: _errors)
548
+ end
549
+
550
+ # Modifies the details of a timecard with an `API_EDIT` event for
551
+ # the timecard. Updating an active timecard with a `clockout_time`
552
+ # clocks the employee out.
553
+ # @param [String] timecard_id Required parameter: TThe ID of the timecard to
554
+ # modify.
555
+ # @param [V1Timecard] body Required parameter: An object containing the
556
+ # fields to POST for the request. See the corresponding object definition
557
+ # for field details.
558
+ # @return [V1Timecard Hash] response from the API call
559
+ def update_timecard(timecard_id:,
560
+ body:)
561
+ warn 'Endpoint update_timecard in V1EmployeesApi is deprecated'
562
+ # Prepare query url.
563
+ _query_builder = config.get_base_uri
564
+ _query_builder << '/v1/me/timecards/{timecard_id}'
565
+ _query_builder = APIHelper.append_url_with_template_parameters(
566
+ _query_builder,
567
+ 'timecard_id' => timecard_id
568
+ )
569
+ _query_url = APIHelper.clean_url _query_builder
570
+
571
+ # Prepare headers.
572
+ _headers = {
573
+ 'accept' => 'application/json',
574
+ 'content-type' => 'application/json; charset=utf-8'
575
+ }
576
+
577
+ # Prepare and execute HttpRequest.
578
+ _request = config.http_client.put(
579
+ _query_url,
580
+ headers: _headers,
581
+ parameters: body.to_json
582
+ )
583
+ OAuth2.apply(config, _request)
584
+ _response = execute_request(_request)
585
+
586
+ # Return appropriate response type.
587
+ decoded = APIHelper.json_deserialize(_response.raw_body)
588
+ _errors = APIHelper.map_response(decoded, ['errors'])
589
+ ApiResponse.new(_response, data: decoded, errors: _errors)
590
+ end
591
+
592
+ # Provides summary information for all events associated with a
593
+ # particular timecard.
594
+ # <aside>
595
+ # Only approved accounts can manage their employees with Square.
596
+ # Unapproved accounts cannot use employee management features with the
597
+ # API.
598
+ # </aside>
599
+ # @param [String] timecard_id Required parameter: The ID of the timecard to
600
+ # list events for.
601
+ # @return [List of V1TimecardEvent Hash] response from the API call
602
+ def list_timecard_events(timecard_id:)
603
+ warn 'Endpoint list_timecard_events in V1EmployeesApi is deprecated'
604
+ # Prepare query url.
605
+ _query_builder = config.get_base_uri
606
+ _query_builder << '/v1/me/timecards/{timecard_id}/events'
607
+ _query_builder = APIHelper.append_url_with_template_parameters(
608
+ _query_builder,
609
+ 'timecard_id' => timecard_id
610
+ )
611
+ _query_url = APIHelper.clean_url _query_builder
612
+
613
+ # Prepare headers.
614
+ _headers = {
615
+ 'accept' => 'application/json'
616
+ }
617
+
618
+ # Prepare and execute HttpRequest.
619
+ _request = config.http_client.get(
620
+ _query_url,
621
+ headers: _headers
622
+ )
623
+ OAuth2.apply(config, _request)
624
+ _response = execute_request(_request)
625
+
626
+ # Return appropriate response type.
627
+ decoded = APIHelper.json_deserialize(_response.raw_body)
628
+ _errors = APIHelper.map_response(decoded, ['errors'])
629
+ ApiResponse.new(_response, data: decoded, errors: _errors)
630
+ end
631
+
632
+ # Provides the details for all of a location's cash drawer shifts during a
633
+ # date range. The date range you specify cannot exceed 90 days.
634
+ # @param [String] location_id Required parameter: The ID of the location to
635
+ # list cash drawer shifts for.
636
+ # @param [SortOrder] order Optional parameter: The order in which cash
637
+ # drawer shifts are listed in the response, based on their created_at field.
638
+ # Default value: ASC
639
+ # @param [String] begin_time Optional parameter: The beginning of the
640
+ # requested reporting period, in ISO 8601 format. Default value: The current
641
+ # time minus 90 days.
642
+ # @param [String] end_time Optional parameter: The beginning of the
643
+ # requested reporting period, in ISO 8601 format. Default value: The current
644
+ # time.
645
+ # @return [List of V1CashDrawerShift Hash] response from the API call
646
+ def list_cash_drawer_shifts(location_id:,
647
+ order: nil,
648
+ begin_time: nil,
649
+ end_time: nil)
650
+ warn 'Endpoint list_cash_drawer_shifts in V1EmployeesApi is deprecated'
651
+ # Prepare query url.
652
+ _query_builder = config.get_base_uri
653
+ _query_builder << '/v1/{location_id}/cash-drawer-shifts'
654
+ _query_builder = APIHelper.append_url_with_template_parameters(
655
+ _query_builder,
656
+ 'location_id' => location_id
657
+ )
658
+ _query_builder = APIHelper.append_url_with_query_parameters(
659
+ _query_builder,
660
+ 'order' => order,
661
+ 'begin_time' => begin_time,
662
+ 'end_time' => end_time
663
+ )
664
+ _query_url = APIHelper.clean_url _query_builder
665
+
666
+ # Prepare headers.
667
+ _headers = {
668
+ 'accept' => 'application/json'
669
+ }
670
+
671
+ # Prepare and execute HttpRequest.
672
+ _request = config.http_client.get(
673
+ _query_url,
674
+ headers: _headers
675
+ )
676
+ OAuth2.apply(config, _request)
677
+ _response = execute_request(_request)
678
+
679
+ # Return appropriate response type.
680
+ decoded = APIHelper.json_deserialize(_response.raw_body)
681
+ _errors = APIHelper.map_response(decoded, ['errors'])
682
+ ApiResponse.new(_response, data: decoded, errors: _errors)
683
+ end
684
+
685
+ # Provides the details for a single cash drawer shift, including all events
686
+ # that occurred during the shift.
687
+ # @param [String] location_id Required parameter: The ID of the location to
688
+ # list cash drawer shifts for.
689
+ # @param [String] shift_id Required parameter: The shift's ID.
690
+ # @return [V1CashDrawerShift Hash] response from the API call
691
+ def retrieve_cash_drawer_shift(location_id:,
692
+ shift_id:)
693
+ warn 'Endpoint retrieve_cash_drawer_shift in V1EmployeesApi is deprecated'
694
+ # Prepare query url.
695
+ _query_builder = config.get_base_uri
696
+ _query_builder << '/v1/{location_id}/cash-drawer-shifts/{shift_id}'
697
+ _query_builder = APIHelper.append_url_with_template_parameters(
698
+ _query_builder,
699
+ 'location_id' => location_id,
700
+ 'shift_id' => shift_id
701
+ )
702
+ _query_url = APIHelper.clean_url _query_builder
703
+
704
+ # Prepare headers.
705
+ _headers = {
706
+ 'accept' => 'application/json'
707
+ }
708
+
709
+ # Prepare and execute HttpRequest.
710
+ _request = config.http_client.get(
711
+ _query_url,
712
+ headers: _headers
713
+ )
714
+ OAuth2.apply(config, _request)
715
+ _response = execute_request(_request)
716
+
717
+ # Return appropriate response type.
718
+ decoded = APIHelper.json_deserialize(_response.raw_body)
719
+ _errors = APIHelper.map_response(decoded, ['errors'])
720
+ ApiResponse.new(_response, data: decoded, errors: _errors)
721
+ end
722
+ end
723
+ end