square.rb 6.1.0.20200722 → 7.0.0.20201118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +38 -31
- data/lib/square.rb +62 -61
- data/lib/square/api/apple_pay_api.rb +5 -3
- data/lib/square/api/bank_accounts_api.rb +16 -19
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/bookings_api.rb +266 -0
- data/lib/square/api/cash_drawers_api.rb +13 -6
- data/lib/square/api/catalog_api.rb +50 -28
- data/lib/square/api/checkout_api.rb +4 -2
- data/lib/square/api/customer_groups_api.rb +18 -8
- data/lib/square/api/customer_segments_api.rb +9 -5
- data/lib/square/api/customers_api.rb +47 -27
- data/lib/square/api/devices_api.rb +17 -6
- data/lib/square/api/disputes_api.rb +39 -34
- data/lib/square/api/employees_api.rb +10 -5
- data/lib/square/api/inventory_api.rb +30 -15
- data/lib/square/api/invoices_api.rb +31 -30
- data/lib/square/api/labor_api.rb +131 -22
- data/lib/square/api/locations_api.rb +16 -13
- data/lib/square/api/loyalty_api.rb +60 -66
- data/lib/square/api/merchants_api.rb +7 -3
- data/lib/square/api/mobile_authorization_api.rb +5 -3
- data/lib/square/api/o_auth_api.rb +11 -8
- data/lib/square/api/orders_api.rb +111 -90
- data/lib/square/api/payments_api.rb +75 -65
- data/lib/square/api/refunds_api.rb +37 -27
- data/lib/square/api/subscriptions_api.rb +263 -0
- data/lib/square/api/team_api.rb +46 -30
- data/lib/square/api/terminal_api.rb +156 -7
- data/lib/square/api/transactions_api.rb +32 -18
- data/lib/square/api/v1_employees_api.rb +59 -27
- data/lib/square/api/v1_items_api.rb +195 -115
- data/lib/square/api/v1_locations_api.rb +6 -2
- data/lib/square/api/v1_transactions_api.rb +49 -27
- data/lib/square/api_helper.rb +14 -9
- data/lib/square/client.rb +20 -14
- data/lib/square/configuration.rb +2 -2
- data/lib/square/http/api_response.rb +2 -0
- data/lib/square/http/faraday_client.rb +9 -2
- data/spec/user_journey_spec.rb +2 -5
- data/test/api/api_test_base.rb +1 -6
- data/test/api/test_catalog_api.rb +1 -4
- data/test/api/test_customers_api.rb +1 -4
- data/test/api/test_employees_api.rb +1 -4
- data/test/api/test_labor_api.rb +2 -6
- data/test/api/test_locations_api.rb +22 -33
- data/test/api/test_merchants_api.rb +1 -4
- data/test/api/test_payments_api.rb +3 -6
- data/test/api/test_refunds_api.rb +3 -6
- data/test/http_response_catcher.rb +0 -5
- data/test/test_helper.rb +0 -5
- metadata +34 -15
- data/lib/square/api/reporting_api.rb +0 -138
@@ -6,32 +6,36 @@ module Square
|
|
6
6
|
end
|
7
7
|
|
8
8
|
# Retrieves a list of refunds for the account making the request.
|
9
|
-
#
|
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
|
9
|
+
# The maximum results per page is 100.
|
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.
|
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
|
35
39
|
# @return [ListPaymentRefundsResponse Hash] response from the API call
|
36
40
|
def list_payment_refunds(begin_time: nil,
|
37
41
|
end_time: nil,
|
@@ -39,7 +43,8 @@ module Square
|
|
39
43
|
cursor: nil,
|
40
44
|
location_id: nil,
|
41
45
|
status: nil,
|
42
|
-
source_type: nil
|
46
|
+
source_type: nil,
|
47
|
+
limit: nil)
|
43
48
|
# Prepare query url.
|
44
49
|
_query_builder = config.get_base_uri
|
45
50
|
_query_builder << '/v2/refunds'
|
@@ -51,7 +56,8 @@ module Square
|
|
51
56
|
'cursor' => cursor,
|
52
57
|
'location_id' => location_id,
|
53
58
|
'status' => status,
|
54
|
-
'source_type' => source_type
|
59
|
+
'source_type' => source_type,
|
60
|
+
'limit' => limit
|
55
61
|
)
|
56
62
|
_query_url = APIHelper.clean_url _query_builder
|
57
63
|
|
@@ -71,13 +77,13 @@ module Square
|
|
71
77
|
# Return appropriate response type.
|
72
78
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
73
79
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
74
|
-
ApiResponse.new(
|
80
|
+
ApiResponse.new(
|
81
|
+
_response, data: decoded, errors: _errors
|
82
|
+
)
|
75
83
|
end
|
76
84
|
|
77
85
|
# Refunds a payment. You can refund the entire payment amount or a
|
78
|
-
# portion of it.
|
79
|
-
# [Payments and Refunds
|
80
|
-
# Overview](https://developer.squareup.com/docs/payments-api/overview).
|
86
|
+
# portion of it.
|
81
87
|
# @param [RefundPaymentRequest] body Required parameter: An object
|
82
88
|
# containing the fields to POST for the request. See the corresponding
|
83
89
|
# object definition for field details.
|
@@ -106,12 +112,14 @@ module Square
|
|
106
112
|
# Return appropriate response type.
|
107
113
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
108
114
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
109
|
-
ApiResponse.new(
|
115
|
+
ApiResponse.new(
|
116
|
+
_response, data: decoded, errors: _errors
|
117
|
+
)
|
110
118
|
end
|
111
119
|
|
112
|
-
# Retrieves a specific
|
113
|
-
# @param [String] refund_id Required parameter:
|
114
|
-
# `PaymentRefund`.
|
120
|
+
# Retrieves a specific refund using the `refund_id`.
|
121
|
+
# @param [String] refund_id Required parameter: The unique ID for the
|
122
|
+
# desired `PaymentRefund`.
|
115
123
|
# @return [GetPaymentRefundResponse Hash] response from the API call
|
116
124
|
def get_payment_refund(refund_id:)
|
117
125
|
# Prepare query url.
|
@@ -119,7 +127,7 @@ module Square
|
|
119
127
|
_query_builder << '/v2/refunds/{refund_id}'
|
120
128
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
121
129
|
_query_builder,
|
122
|
-
'refund_id' => refund_id
|
130
|
+
'refund_id' => { 'value' => refund_id, 'encode' => true }
|
123
131
|
)
|
124
132
|
_query_url = APIHelper.clean_url _query_builder
|
125
133
|
|
@@ -139,7 +147,9 @@ module Square
|
|
139
147
|
# Return appropriate response type.
|
140
148
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
141
149
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
142
|
-
ApiResponse.new(
|
150
|
+
ApiResponse.new(
|
151
|
+
_response, data: decoded, errors: _errors
|
152
|
+
)
|
143
153
|
end
|
144
154
|
end
|
145
155
|
end
|
@@ -0,0 +1,263 @@
|
|
1
|
+
module Square
|
2
|
+
# SubscriptionsApi
|
3
|
+
class SubscriptionsApi < BaseApi
|
4
|
+
def initialize(config, http_call_back: nil)
|
5
|
+
super(config, http_call_back: http_call_back)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Creates a subscription for a customer to a subscription plan.
|
9
|
+
# If you provide a card on file in the request, Square charges the card for
|
10
|
+
# the subscription. Otherwise, Square bills an invoice to the customer's
|
11
|
+
# email
|
12
|
+
# address. The subscription starts immediately, unless the request includes
|
13
|
+
# the optional `start_date`. Each individual subscription is associated with
|
14
|
+
# a particular location.
|
15
|
+
# @param [CreateSubscriptionRequest] body Required parameter: An object
|
16
|
+
# containing the fields to POST for the request. See the corresponding
|
17
|
+
# object definition for field details.
|
18
|
+
# @return [CreateSubscriptionResponse Hash] response from the API call
|
19
|
+
def create_subscription(body:)
|
20
|
+
# Prepare query url.
|
21
|
+
_query_builder = config.get_base_uri
|
22
|
+
_query_builder << '/v2/subscriptions'
|
23
|
+
_query_url = APIHelper.clean_url _query_builder
|
24
|
+
|
25
|
+
# Prepare headers.
|
26
|
+
_headers = {
|
27
|
+
'accept' => 'application/json',
|
28
|
+
'content-type' => 'application/json; charset=utf-8'
|
29
|
+
}
|
30
|
+
|
31
|
+
# Prepare and execute HttpRequest.
|
32
|
+
_request = config.http_client.post(
|
33
|
+
_query_url,
|
34
|
+
headers: _headers,
|
35
|
+
parameters: body.to_json
|
36
|
+
)
|
37
|
+
OAuth2.apply(config, _request)
|
38
|
+
_response = execute_request(_request)
|
39
|
+
|
40
|
+
# Return appropriate response type.
|
41
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
42
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
43
|
+
ApiResponse.new(
|
44
|
+
_response, data: decoded, errors: _errors
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Searches for subscriptions.
|
49
|
+
# Results are ordered chronologically by subscription creation date. If
|
50
|
+
# the request specifies more than one location ID,
|
51
|
+
# the endpoint orders the result
|
52
|
+
# by location ID, and then by creation date within each location. If no
|
53
|
+
# locations are given
|
54
|
+
# in the query, all locations are searched.
|
55
|
+
# You can also optionally specify `customer_ids` to search by customer.
|
56
|
+
# If left unset, all customers
|
57
|
+
# associated with the specified locations are returned.
|
58
|
+
# If the request specifies customer IDs, the endpoint orders results
|
59
|
+
# first by location, within location by customer ID, and within
|
60
|
+
# customer by subscription creation date.
|
61
|
+
# For more information, see
|
62
|
+
# [Retrieve
|
63
|
+
# subscriptions](https://developer.squareup.com/docs/subscriptions-api/overv
|
64
|
+
# iew#retrieve-subscriptions).
|
65
|
+
# @param [SearchSubscriptionsRequest] body Required parameter: An object
|
66
|
+
# containing the fields to POST for the request. See the corresponding
|
67
|
+
# object definition for field details.
|
68
|
+
# @return [SearchSubscriptionsResponse Hash] response from the API call
|
69
|
+
def search_subscriptions(body:)
|
70
|
+
# Prepare query url.
|
71
|
+
_query_builder = config.get_base_uri
|
72
|
+
_query_builder << '/v2/subscriptions/search'
|
73
|
+
_query_url = APIHelper.clean_url _query_builder
|
74
|
+
|
75
|
+
# Prepare headers.
|
76
|
+
_headers = {
|
77
|
+
'accept' => 'application/json',
|
78
|
+
'content-type' => 'application/json; charset=utf-8'
|
79
|
+
}
|
80
|
+
|
81
|
+
# Prepare and execute HttpRequest.
|
82
|
+
_request = config.http_client.post(
|
83
|
+
_query_url,
|
84
|
+
headers: _headers,
|
85
|
+
parameters: body.to_json
|
86
|
+
)
|
87
|
+
OAuth2.apply(config, _request)
|
88
|
+
_response = execute_request(_request)
|
89
|
+
|
90
|
+
# Return appropriate response type.
|
91
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
92
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
93
|
+
ApiResponse.new(
|
94
|
+
_response, data: decoded, errors: _errors
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Retrieves a subscription.
|
99
|
+
# @param [String] subscription_id Required parameter: The ID of the
|
100
|
+
# subscription to retrieve.
|
101
|
+
# @return [RetrieveSubscriptionResponse Hash] response from the API call
|
102
|
+
def retrieve_subscription(subscription_id:)
|
103
|
+
# Prepare query url.
|
104
|
+
_query_builder = config.get_base_uri
|
105
|
+
_query_builder << '/v2/subscriptions/{subscription_id}'
|
106
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
107
|
+
_query_builder,
|
108
|
+
'subscription_id' => { 'value' => subscription_id, 'encode' => true }
|
109
|
+
)
|
110
|
+
_query_url = APIHelper.clean_url _query_builder
|
111
|
+
|
112
|
+
# Prepare headers.
|
113
|
+
_headers = {
|
114
|
+
'accept' => 'application/json'
|
115
|
+
}
|
116
|
+
|
117
|
+
# Prepare and execute HttpRequest.
|
118
|
+
_request = config.http_client.get(
|
119
|
+
_query_url,
|
120
|
+
headers: _headers
|
121
|
+
)
|
122
|
+
OAuth2.apply(config, _request)
|
123
|
+
_response = execute_request(_request)
|
124
|
+
|
125
|
+
# Return appropriate response type.
|
126
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
127
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
128
|
+
ApiResponse.new(
|
129
|
+
_response, data: decoded, errors: _errors
|
130
|
+
)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Updates a subscription. You can set, modify, and clear the
|
134
|
+
# `subscription` field values.
|
135
|
+
# @param [String] subscription_id Required parameter: The ID for the
|
136
|
+
# subscription to update.
|
137
|
+
# @param [UpdateSubscriptionRequest] body Required parameter: An object
|
138
|
+
# containing the fields to POST for the request. See the corresponding
|
139
|
+
# object definition for field details.
|
140
|
+
# @return [UpdateSubscriptionResponse Hash] response from the API call
|
141
|
+
def update_subscription(subscription_id:,
|
142
|
+
body:)
|
143
|
+
# Prepare query url.
|
144
|
+
_query_builder = config.get_base_uri
|
145
|
+
_query_builder << '/v2/subscriptions/{subscription_id}'
|
146
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
147
|
+
_query_builder,
|
148
|
+
'subscription_id' => { 'value' => subscription_id, 'encode' => true }
|
149
|
+
)
|
150
|
+
_query_url = APIHelper.clean_url _query_builder
|
151
|
+
|
152
|
+
# Prepare headers.
|
153
|
+
_headers = {
|
154
|
+
'accept' => 'application/json',
|
155
|
+
'content-type' => 'application/json; charset=utf-8'
|
156
|
+
}
|
157
|
+
|
158
|
+
# Prepare and execute HttpRequest.
|
159
|
+
_request = config.http_client.put(
|
160
|
+
_query_url,
|
161
|
+
headers: _headers,
|
162
|
+
parameters: body.to_json
|
163
|
+
)
|
164
|
+
OAuth2.apply(config, _request)
|
165
|
+
_response = execute_request(_request)
|
166
|
+
|
167
|
+
# Return appropriate response type.
|
168
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
169
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
170
|
+
ApiResponse.new(
|
171
|
+
_response, data: decoded, errors: _errors
|
172
|
+
)
|
173
|
+
end
|
174
|
+
|
175
|
+
# Sets the `canceled_date` field to the end of the active billing period.
|
176
|
+
# After this date, the status changes from ACTIVE to CANCELED.
|
177
|
+
# @param [String] subscription_id Required parameter: The ID of the
|
178
|
+
# subscription to cancel.
|
179
|
+
# @return [CancelSubscriptionResponse Hash] response from the API call
|
180
|
+
def cancel_subscription(subscription_id:)
|
181
|
+
# Prepare query url.
|
182
|
+
_query_builder = config.get_base_uri
|
183
|
+
_query_builder << '/v2/subscriptions/{subscription_id}/cancel'
|
184
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
185
|
+
_query_builder,
|
186
|
+
'subscription_id' => { 'value' => subscription_id, 'encode' => true }
|
187
|
+
)
|
188
|
+
_query_url = APIHelper.clean_url _query_builder
|
189
|
+
|
190
|
+
# Prepare headers.
|
191
|
+
_headers = {
|
192
|
+
'accept' => 'application/json'
|
193
|
+
}
|
194
|
+
|
195
|
+
# Prepare and execute HttpRequest.
|
196
|
+
_request = config.http_client.post(
|
197
|
+
_query_url,
|
198
|
+
headers: _headers
|
199
|
+
)
|
200
|
+
OAuth2.apply(config, _request)
|
201
|
+
_response = execute_request(_request)
|
202
|
+
|
203
|
+
# Return appropriate response type.
|
204
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
205
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
206
|
+
ApiResponse.new(
|
207
|
+
_response, data: decoded, errors: _errors
|
208
|
+
)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Lists all events for a specific subscription.
|
212
|
+
# In the current implementation, only `START_SUBSCRIPTION` and
|
213
|
+
# `STOP_SUBSCRIPTION` (when the subscription was canceled) events are
|
214
|
+
# returned.
|
215
|
+
# @param [String] subscription_id Required parameter: The ID of the
|
216
|
+
# subscription to retrieve the events for.
|
217
|
+
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
218
|
+
# a previous call to this endpoint. Provide this to retrieve the next set of
|
219
|
+
# results for the original query. For more information, see
|
220
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
221
|
+
# ion).
|
222
|
+
# @param [Integer] limit Optional parameter: The upper limit on the number
|
223
|
+
# of subscription events to return in the response. Default: `200`
|
224
|
+
# @return [ListSubscriptionEventsResponse Hash] response from the API call
|
225
|
+
def list_subscription_events(subscription_id:,
|
226
|
+
cursor: nil,
|
227
|
+
limit: nil)
|
228
|
+
# Prepare query url.
|
229
|
+
_query_builder = config.get_base_uri
|
230
|
+
_query_builder << '/v2/subscriptions/{subscription_id}/events'
|
231
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
232
|
+
_query_builder,
|
233
|
+
'subscription_id' => { 'value' => subscription_id, 'encode' => true }
|
234
|
+
)
|
235
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
236
|
+
_query_builder,
|
237
|
+
'cursor' => cursor,
|
238
|
+
'limit' => limit
|
239
|
+
)
|
240
|
+
_query_url = APIHelper.clean_url _query_builder
|
241
|
+
|
242
|
+
# Prepare headers.
|
243
|
+
_headers = {
|
244
|
+
'accept' => 'application/json'
|
245
|
+
}
|
246
|
+
|
247
|
+
# Prepare and execute HttpRequest.
|
248
|
+
_request = config.http_client.get(
|
249
|
+
_query_url,
|
250
|
+
headers: _headers
|
251
|
+
)
|
252
|
+
OAuth2.apply(config, _request)
|
253
|
+
_response = execute_request(_request)
|
254
|
+
|
255
|
+
# Return appropriate response type.
|
256
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
257
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
258
|
+
ApiResponse.new(
|
259
|
+
_response, data: decoded, errors: _errors
|
260
|
+
)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
data/lib/square/api/team_api.rb
CHANGED
@@ -8,11 +8,11 @@ module Square
|
|
8
8
|
# Creates a single `TeamMember` object. The `TeamMember` will be returned on
|
9
9
|
# successful creates.
|
10
10
|
# You must provide the following values in your request to this endpoint:
|
11
|
-
# - `
|
12
|
-
# - `
|
11
|
+
# - `given_name`
|
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.
|
@@ -41,7 +41,9 @@ module Square
|
|
41
41
|
# Return appropriate response type.
|
42
42
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
43
43
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
44
|
-
ApiResponse.new(
|
44
|
+
ApiResponse.new(
|
45
|
+
_response, data: decoded, errors: _errors
|
46
|
+
)
|
45
47
|
end
|
46
48
|
|
47
49
|
# Creates multiple `TeamMember` objects. The created `TeamMember` objects
|
@@ -52,8 +54,8 @@ module Square
|
|
52
54
|
# marked as failed, but the body of the response
|
53
55
|
# will contain explicit error information for this particular create.
|
54
56
|
# Learn about [Troubleshooting the Teams
|
55
|
-
# API](https://developer.squareup.com/docs/
|
56
|
-
#
|
57
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#bulkcreatete
|
58
|
+
# ammembers).
|
57
59
|
# @param [BulkCreateTeamMembersRequest] body Required parameter: An object
|
58
60
|
# containing the fields to POST for the request. See the corresponding
|
59
61
|
# object definition for field details.
|
@@ -82,7 +84,9 @@ module Square
|
|
82
84
|
# Return appropriate response type.
|
83
85
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
84
86
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
85
|
-
ApiResponse.new(
|
87
|
+
ApiResponse.new(
|
88
|
+
_response, data: decoded, errors: _errors
|
89
|
+
)
|
86
90
|
end
|
87
91
|
|
88
92
|
# Updates multiple `TeamMember` objects. The updated `TeamMember` objects
|
@@ -93,8 +97,8 @@ module Square
|
|
93
97
|
# marked as failed, but the body of the response
|
94
98
|
# will contain explicit error information for this particular update.
|
95
99
|
# Learn about [Troubleshooting the Teams
|
96
|
-
# API](https://developer.squareup.com/docs/
|
97
|
-
#
|
100
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#bulkupdatete
|
101
|
+
# ammembers).
|
98
102
|
# @param [BulkUpdateTeamMembersRequest] body Required parameter: An object
|
99
103
|
# containing the fields to POST for the request. See the corresponding
|
100
104
|
# object definition for field details.
|
@@ -123,13 +127,15 @@ module Square
|
|
123
127
|
# Return appropriate response type.
|
124
128
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
125
129
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
126
|
-
ApiResponse.new(
|
130
|
+
ApiResponse.new(
|
131
|
+
_response, data: decoded, errors: _errors
|
132
|
+
)
|
127
133
|
end
|
128
134
|
|
129
135
|
# Returns a paginated list of `TeamMember` objects for a business.
|
130
136
|
# The list to be returned can be filtered by:
|
131
137
|
# - location IDs **and**
|
132
|
-
# - `
|
138
|
+
# - `status`
|
133
139
|
# @param [SearchTeamMembersRequest] body Required parameter: An object
|
134
140
|
# containing the fields to POST for the request. See the corresponding
|
135
141
|
# object definition for field details.
|
@@ -158,13 +164,15 @@ module Square
|
|
158
164
|
# Return appropriate response type.
|
159
165
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
160
166
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
161
|
-
ApiResponse.new(
|
167
|
+
ApiResponse.new(
|
168
|
+
_response, data: decoded, errors: _errors
|
169
|
+
)
|
162
170
|
end
|
163
171
|
|
164
|
-
# Retrieve a `TeamMember` object for the given `TeamMember.id
|
172
|
+
# Retrieve a `TeamMember` object for the given `TeamMember.id`.
|
165
173
|
# Learn about [Troubleshooting the Teams
|
166
|
-
# API](https://developer.squareup.com/docs/
|
167
|
-
#
|
174
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#retrieveteam
|
175
|
+
# member).
|
168
176
|
# @param [String] team_member_id Required parameter: The ID of the team
|
169
177
|
# member to retrieve.
|
170
178
|
# @return [RetrieveTeamMemberResponse Hash] response from the API call
|
@@ -174,7 +182,7 @@ module Square
|
|
174
182
|
_query_builder << '/v2/team-members/{team_member_id}'
|
175
183
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
176
184
|
_query_builder,
|
177
|
-
'team_member_id' => team_member_id
|
185
|
+
'team_member_id' => { 'value' => team_member_id, 'encode' => true }
|
178
186
|
)
|
179
187
|
_query_url = APIHelper.clean_url _query_builder
|
180
188
|
|
@@ -194,14 +202,16 @@ module Square
|
|
194
202
|
# Return appropriate response type.
|
195
203
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
196
204
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
197
|
-
ApiResponse.new(
|
205
|
+
ApiResponse.new(
|
206
|
+
_response, data: decoded, errors: _errors
|
207
|
+
)
|
198
208
|
end
|
199
209
|
|
200
210
|
# Updates a single `TeamMember` object. The `TeamMember` will be returned on
|
201
211
|
# successful updates.
|
202
212
|
# Learn about [Troubleshooting the Teams
|
203
|
-
# API](https://developer.squareup.com/docs/
|
204
|
-
#
|
213
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#updateteamme
|
214
|
+
# mber).
|
205
215
|
# @param [String] team_member_id Required parameter: The ID of the team
|
206
216
|
# member to update.
|
207
217
|
# @param [UpdateTeamMemberRequest] body Required parameter: An object
|
@@ -215,7 +225,7 @@ module Square
|
|
215
225
|
_query_builder << '/v2/team-members/{team_member_id}'
|
216
226
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
217
227
|
_query_builder,
|
218
|
-
'team_member_id' => team_member_id
|
228
|
+
'team_member_id' => { 'value' => team_member_id, 'encode' => true }
|
219
229
|
)
|
220
230
|
_query_url = APIHelper.clean_url _query_builder
|
221
231
|
|
@@ -237,14 +247,16 @@ module Square
|
|
237
247
|
# Return appropriate response type.
|
238
248
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
239
249
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
240
|
-
ApiResponse.new(
|
250
|
+
ApiResponse.new(
|
251
|
+
_response, data: decoded, errors: _errors
|
252
|
+
)
|
241
253
|
end
|
242
254
|
|
243
255
|
# Retrieve a `WageSetting` object for a team member specified
|
244
256
|
# by `TeamMember.id`.
|
245
257
|
# Learn about [Troubleshooting the Teams
|
246
|
-
# API](https://developer.squareup.com/docs/
|
247
|
-
#
|
258
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#retrievewage
|
259
|
+
# setting).
|
248
260
|
# @param [String] team_member_id Required parameter: The ID of the team
|
249
261
|
# member to retrieve wage setting for
|
250
262
|
# @return [RetrieveWageSettingResponse Hash] response from the API call
|
@@ -254,7 +266,7 @@ module Square
|
|
254
266
|
_query_builder << '/v2/team-members/{team_member_id}/wage-setting'
|
255
267
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
256
268
|
_query_builder,
|
257
|
-
'team_member_id' => team_member_id
|
269
|
+
'team_member_id' => { 'value' => team_member_id, 'encode' => true }
|
258
270
|
)
|
259
271
|
_query_url = APIHelper.clean_url _query_builder
|
260
272
|
|
@@ -274,7 +286,9 @@ module Square
|
|
274
286
|
# Return appropriate response type.
|
275
287
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
276
288
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
277
|
-
ApiResponse.new(
|
289
|
+
ApiResponse.new(
|
290
|
+
_response, data: decoded, errors: _errors
|
291
|
+
)
|
278
292
|
end
|
279
293
|
|
280
294
|
# Creates or updates a `WageSetting` object. The object is created if a
|
@@ -283,8 +297,8 @@ module Square
|
|
283
297
|
# it fully replaces the `WageSetting` object for the team member.
|
284
298
|
# The `WageSetting` will be returned upon successful update.
|
285
299
|
# Learn about [Troubleshooting the Teams
|
286
|
-
# API](https://developer.squareup.com/docs/
|
287
|
-
#
|
300
|
+
# API](https://developer.squareup.com/docs/team/troubleshooting#updatewagese
|
301
|
+
# tting).
|
288
302
|
# @param [String] team_member_id Required parameter: The ID of the team
|
289
303
|
# member to update the `WageSetting` object for.
|
290
304
|
# @param [UpdateWageSettingRequest] body Required parameter: An object
|
@@ -298,7 +312,7 @@ module Square
|
|
298
312
|
_query_builder << '/v2/team-members/{team_member_id}/wage-setting'
|
299
313
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
300
314
|
_query_builder,
|
301
|
-
'team_member_id' => team_member_id
|
315
|
+
'team_member_id' => { 'value' => team_member_id, 'encode' => true }
|
302
316
|
)
|
303
317
|
_query_url = APIHelper.clean_url _query_builder
|
304
318
|
|
@@ -320,7 +334,9 @@ module Square
|
|
320
334
|
# Return appropriate response type.
|
321
335
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
322
336
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
323
|
-
ApiResponse.new(
|
337
|
+
ApiResponse.new(
|
338
|
+
_response, data: decoded, errors: _errors
|
339
|
+
)
|
324
340
|
end
|
325
341
|
end
|
326
342
|
end
|