square.rb 5.2.1.20200422 → 6.2.0.20200812

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,7 +48,8 @@ module Square
48
48
 
49
49
  # Retrieve a `Merchant` object for the given `merchant_id`.
50
50
  # @param [String] merchant_id Required parameter: The ID of the merchant to
51
- # retrieve.
51
+ # retrieve. If the string "me" is supplied as the ID, then retrieve the
52
+ # merchant that is currently accessible to this call.
52
53
  # @return [RetrieveMerchantResponse Hash] response from the API call
53
54
  def retrieve_merchant(merchant_id:)
54
55
  # Prepare query url.
@@ -157,6 +157,38 @@ module Square
157
157
  ApiResponse.new(_response, data: decoded, errors: _errors)
158
158
  end
159
159
 
160
+ # Calculates an [Order](#type-order).
161
+ # @param [CalculateOrderRequest] body Required parameter: An object
162
+ # containing the fields to POST for the request. See the corresponding
163
+ # object definition for field details.
164
+ # @return [CalculateOrderResponse Hash] response from the API call
165
+ def calculate_order(body:)
166
+ # Prepare query url.
167
+ _query_builder = config.get_base_uri
168
+ _query_builder << '/v2/orders/calculate'
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.post(
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
+
160
192
  # Search all orders for one or more locations. Orders include all sales,
161
193
  # returns, and exchanges regardless of how or when they entered the Square
162
194
  # Ecosystem (e.g. Point of Sale, Invoices, Connect APIs, etc).
@@ -246,12 +246,8 @@ module Square
246
246
  # elayed-payments).
247
247
  # @param [String] payment_id Required parameter: Unique ID identifying the
248
248
  # payment to be completed.
249
- # @param [Object] body Required parameter: An object containing the fields
250
- # to POST for the request. See the corresponding object definition for
251
- # field details.
252
249
  # @return [CompletePaymentResponse Hash] response from the API call
253
- def complete_payment(payment_id:,
254
- body:)
250
+ def complete_payment(payment_id:)
255
251
  # Prepare query url.
256
252
  _query_builder = config.get_base_uri
257
253
  _query_builder << '/v2/payments/{payment_id}/complete'
@@ -263,15 +259,13 @@ module Square
263
259
 
264
260
  # Prepare headers.
265
261
  _headers = {
266
- 'accept' => 'application/json',
267
- 'content-type' => 'application/json; charset=utf-8'
262
+ 'accept' => 'application/json'
268
263
  }
269
264
 
270
265
  # Prepare and execute HttpRequest.
271
266
  _request = config.http_client.post(
272
267
  _query_url,
273
- headers: _headers,
274
- parameters: body.to_json
268
+ headers: _headers
275
269
  )
276
270
  OAuth2.apply(config, _request)
277
271
  _response = execute_request(_request)
@@ -21,8 +21,9 @@ module Square
21
21
  # results for the original query. See
22
22
  # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
23
23
  # for more information.
24
- # @param [String] location_id Optional parameter: ID of location associated
25
- # with payment.
24
+ # @param [String] location_id Optional parameter: Limit results to the
25
+ # location supplied. By default, results are returned for all locations
26
+ # associated with the merchant.
26
27
  # @param [String] status Optional parameter: If provided, only refunds with
27
28
  # the given status are returned. For a list of refund status values, see
28
29
  # [PaymentRefund](#type-paymentrefund). Default: If omitted refunds are
@@ -0,0 +1,262 @@
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
+ # For more information,
16
+ # see [Subscription API
17
+ # Overview](https://developer.squareup.com/docs/docs/subscriptions-api/overv
18
+ # iew).
19
+ # @param [CreateSubscriptionRequest] body Required parameter: An object
20
+ # containing the fields to POST for the request. See the corresponding
21
+ # object definition for field details.
22
+ # @return [CreateSubscriptionResponse Hash] response from the API call
23
+ def create_subscription(body:)
24
+ # Prepare query url.
25
+ _query_builder = config.get_base_uri
26
+ _query_builder << '/v2/subscriptions'
27
+ _query_url = APIHelper.clean_url _query_builder
28
+
29
+ # Prepare headers.
30
+ _headers = {
31
+ 'accept' => 'application/json',
32
+ 'content-type' => 'application/json; charset=utf-8'
33
+ }
34
+
35
+ # Prepare and execute HttpRequest.
36
+ _request = config.http_client.post(
37
+ _query_url,
38
+ headers: _headers,
39
+ parameters: body.to_json
40
+ )
41
+ OAuth2.apply(config, _request)
42
+ _response = execute_request(_request)
43
+
44
+ # Return appropriate response type.
45
+ decoded = APIHelper.json_deserialize(_response.raw_body)
46
+ _errors = APIHelper.map_response(decoded, ['errors'])
47
+ ApiResponse.new(_response, data: decoded, errors: _errors)
48
+ end
49
+
50
+ # Searches for subscriptions.
51
+ # Results are ordered chronologically by subscription creation date. If
52
+ # the request specifies more than one location ID,
53
+ # the endpoint orders the result
54
+ # by location ID, and then by creation date within each location. If no
55
+ # locations are given
56
+ # in the query, all locations are searched.
57
+ # You can also optionally specify `customer_ids` to search by customer.
58
+ # If left unset, all customers
59
+ # associated with the specified locations are returned.
60
+ # If the request specifies customer IDs, the endpoint orders results
61
+ # first by location, within location by customer ID, and within
62
+ # customer by subscription creation date.
63
+ # For more information, see
64
+ # [Retrieve
65
+ # subscriptions](https://developer.squareup.com/docs/docs/subscriptions-api/
66
+ # overview#retrieve-subscriptions).
67
+ # @param [SearchSubscriptionsRequest] body Required parameter: An object
68
+ # containing the fields to POST for the request. See the corresponding
69
+ # object definition for field details.
70
+ # @return [SearchSubscriptionsResponse Hash] response from the API call
71
+ def search_subscriptions(body:)
72
+ # Prepare query url.
73
+ _query_builder = config.get_base_uri
74
+ _query_builder << '/v2/subscriptions/search'
75
+ _query_url = APIHelper.clean_url _query_builder
76
+
77
+ # Prepare headers.
78
+ _headers = {
79
+ 'accept' => 'application/json',
80
+ 'content-type' => 'application/json; charset=utf-8'
81
+ }
82
+
83
+ # Prepare and execute HttpRequest.
84
+ _request = config.http_client.post(
85
+ _query_url,
86
+ headers: _headers,
87
+ parameters: body.to_json
88
+ )
89
+ OAuth2.apply(config, _request)
90
+ _response = execute_request(_request)
91
+
92
+ # Return appropriate response type.
93
+ decoded = APIHelper.json_deserialize(_response.raw_body)
94
+ _errors = APIHelper.map_response(decoded, ['errors'])
95
+ ApiResponse.new(_response, data: decoded, errors: _errors)
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' => subscription_id
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(_response, data: decoded, errors: _errors)
129
+ end
130
+
131
+ # Updates a subscription. You can set, modify, and clear the
132
+ # `subscription` field values. For more information and examples, see
133
+ # [Update
134
+ # subscriptions](https://developer.squareup.com/docs/docs/subscriptions-api/
135
+ # overview#update-subscriptions).
136
+ # @param [String] subscription_id Required parameter: The ID for the
137
+ # subscription to update.
138
+ # @param [UpdateSubscriptionRequest] body Required parameter: An object
139
+ # containing the fields to POST for the request. See the corresponding
140
+ # object definition for field details.
141
+ # @return [UpdateSubscriptionResponse Hash] response from the API call
142
+ def update_subscription(subscription_id:,
143
+ body:)
144
+ # Prepare query url.
145
+ _query_builder = config.get_base_uri
146
+ _query_builder << '/v2/subscriptions/{subscription_id}'
147
+ _query_builder = APIHelper.append_url_with_template_parameters(
148
+ _query_builder,
149
+ 'subscription_id' => subscription_id
150
+ )
151
+ _query_url = APIHelper.clean_url _query_builder
152
+
153
+ # Prepare headers.
154
+ _headers = {
155
+ 'accept' => 'application/json',
156
+ 'content-type' => 'application/json; charset=utf-8'
157
+ }
158
+
159
+ # Prepare and execute HttpRequest.
160
+ _request = config.http_client.put(
161
+ _query_url,
162
+ headers: _headers,
163
+ parameters: body.to_json
164
+ )
165
+ OAuth2.apply(config, _request)
166
+ _response = execute_request(_request)
167
+
168
+ # Return appropriate response type.
169
+ decoded = APIHelper.json_deserialize(_response.raw_body)
170
+ _errors = APIHelper.map_response(decoded, ['errors'])
171
+ ApiResponse.new(_response, data: decoded, errors: _errors)
172
+ end
173
+
174
+ # Cancels a subscription immediately and sets the subscription
175
+ # `status` to `CANCELED`. You can also use the `UpdateSubscription`
176
+ # endpoint to cancel a subscription at a future date. For more
177
+ # information, see
178
+ # [CancelSubscriptions](https://developer.squareup.com/docs/docs/subscriptio
179
+ # ns-api/overview#cancel-subscriptions).
180
+ # @param [String] subscription_id Required parameter: The ID of the
181
+ # subscription to cancel.
182
+ # @return [CancelSubscriptionResponse Hash] response from the API call
183
+ def cancel_subscription(subscription_id:)
184
+ # Prepare query url.
185
+ _query_builder = config.get_base_uri
186
+ _query_builder << '/v2/subscriptions/{subscription_id}/cancel'
187
+ _query_builder = APIHelper.append_url_with_template_parameters(
188
+ _query_builder,
189
+ 'subscription_id' => subscription_id
190
+ )
191
+ _query_url = APIHelper.clean_url _query_builder
192
+
193
+ # Prepare headers.
194
+ _headers = {
195
+ 'accept' => 'application/json'
196
+ }
197
+
198
+ # Prepare and execute HttpRequest.
199
+ _request = config.http_client.post(
200
+ _query_url,
201
+ headers: _headers
202
+ )
203
+ OAuth2.apply(config, _request)
204
+ _response = execute_request(_request)
205
+
206
+ # Return appropriate response type.
207
+ decoded = APIHelper.json_deserialize(_response.raw_body)
208
+ _errors = APIHelper.map_response(decoded, ['errors'])
209
+ ApiResponse.new(_response, data: decoded, errors: _errors)
210
+ end
211
+
212
+ # Lists all events for a specific subscription.
213
+ # In the current implementation, only `START_SUBSCRIPTION` and
214
+ # `STOP_SUBSCRIPTION` (when the subscription was canceled) events are
215
+ # returned.
216
+ # @param [String] subscription_id Required parameter: The ID of the
217
+ # subscription to retrieve the events for.
218
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
219
+ # a previous call to this endpoint. Provide this to retrieve the next set of
220
+ # results for the original query. For more information, see
221
+ # [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pa
222
+ # gination).
223
+ # @param [Integer] limit Optional parameter: The upper limit on the number
224
+ # of subscription events to return in the response. Default: `200`
225
+ # @return [ListSubscriptionEventsResponse Hash] response from the API call
226
+ def list_subscription_events(subscription_id:,
227
+ cursor: nil,
228
+ limit: nil)
229
+ # Prepare query url.
230
+ _query_builder = config.get_base_uri
231
+ _query_builder << '/v2/subscriptions/{subscription_id}/events'
232
+ _query_builder = APIHelper.append_url_with_template_parameters(
233
+ _query_builder,
234
+ 'subscription_id' => subscription_id
235
+ )
236
+ _query_builder = APIHelper.append_url_with_query_parameters(
237
+ _query_builder,
238
+ 'cursor' => cursor,
239
+ 'limit' => limit
240
+ )
241
+ _query_url = APIHelper.clean_url _query_builder
242
+
243
+ # Prepare headers.
244
+ _headers = {
245
+ 'accept' => 'application/json'
246
+ }
247
+
248
+ # Prepare and execute HttpRequest.
249
+ _request = config.http_client.get(
250
+ _query_url,
251
+ headers: _headers
252
+ )
253
+ OAuth2.apply(config, _request)
254
+ _response = execute_request(_request)
255
+
256
+ # Return appropriate response type.
257
+ decoded = APIHelper.json_deserialize(_response.raw_body)
258
+ _errors = APIHelper.map_response(decoded, ['errors'])
259
+ ApiResponse.new(_response, data: decoded, errors: _errors)
260
+ end
261
+ end
262
+ end
@@ -0,0 +1,326 @@
1
+ module Square
2
+ # TeamApi
3
+ class TeamApi < BaseApi
4
+ def initialize(config, http_call_back: nil)
5
+ super(config, http_call_back: http_call_back)
6
+ end
7
+
8
+ # Creates a single `TeamMember` object. The `TeamMember` will be returned on
9
+ # successful creates.
10
+ # You must provide the following values in your request to this endpoint:
11
+ # - `first_name`
12
+ # - `last_name`
13
+ # Learn about [Troubleshooting the Teams
14
+ # API](https://developer.squareup.com/docs/docs/team/troubleshooting#createt
15
+ # eammember).
16
+ # @param [CreateTeamMemberRequest] body Required parameter: An object
17
+ # containing the fields to POST for the request. See the corresponding
18
+ # object definition for field details.
19
+ # @return [CreateTeamMemberResponse Hash] response from the API call
20
+ def create_team_member(body:)
21
+ # Prepare query url.
22
+ _query_builder = config.get_base_uri
23
+ _query_builder << '/v2/team-members'
24
+ _query_url = APIHelper.clean_url _query_builder
25
+
26
+ # Prepare headers.
27
+ _headers = {
28
+ 'accept' => 'application/json',
29
+ 'content-type' => 'application/json; charset=utf-8'
30
+ }
31
+
32
+ # Prepare and execute HttpRequest.
33
+ _request = config.http_client.post(
34
+ _query_url,
35
+ headers: _headers,
36
+ parameters: body.to_json
37
+ )
38
+ OAuth2.apply(config, _request)
39
+ _response = execute_request(_request)
40
+
41
+ # Return appropriate response type.
42
+ decoded = APIHelper.json_deserialize(_response.raw_body)
43
+ _errors = APIHelper.map_response(decoded, ['errors'])
44
+ ApiResponse.new(_response, data: decoded, errors: _errors)
45
+ end
46
+
47
+ # Creates multiple `TeamMember` objects. The created `TeamMember` objects
48
+ # will be returned on successful creates.
49
+ # This process is non-transactional and will process as much of the request
50
+ # as is possible. If one of the creates in
51
+ # the request cannot be successfully processed, the request will NOT be
52
+ # marked as failed, but the body of the response
53
+ # will contain explicit error information for this particular create.
54
+ # Learn about [Troubleshooting the Teams
55
+ # API](https://developer.squareup.com/docs/docs/team/troubleshooting#bulkcre
56
+ # ateteammembers).
57
+ # @param [BulkCreateTeamMembersRequest] body Required parameter: An object
58
+ # containing the fields to POST for the request. See the corresponding
59
+ # object definition for field details.
60
+ # @return [BulkCreateTeamMembersResponse Hash] response from the API call
61
+ def bulk_create_team_members(body:)
62
+ # Prepare query url.
63
+ _query_builder = config.get_base_uri
64
+ _query_builder << '/v2/team-members/bulk-create'
65
+ _query_url = APIHelper.clean_url _query_builder
66
+
67
+ # Prepare headers.
68
+ _headers = {
69
+ 'accept' => 'application/json',
70
+ 'content-type' => 'application/json; charset=utf-8'
71
+ }
72
+
73
+ # Prepare and execute HttpRequest.
74
+ _request = config.http_client.post(
75
+ _query_url,
76
+ headers: _headers,
77
+ parameters: body.to_json
78
+ )
79
+ OAuth2.apply(config, _request)
80
+ _response = execute_request(_request)
81
+
82
+ # Return appropriate response type.
83
+ decoded = APIHelper.json_deserialize(_response.raw_body)
84
+ _errors = APIHelper.map_response(decoded, ['errors'])
85
+ ApiResponse.new(_response, data: decoded, errors: _errors)
86
+ end
87
+
88
+ # Updates multiple `TeamMember` objects. The updated `TeamMember` objects
89
+ # will be returned on successful updates.
90
+ # This process is non-transactional and will process as much of the request
91
+ # as is possible. If one of the updates in
92
+ # the request cannot be successfully processed, the request will NOT be
93
+ # marked as failed, but the body of the response
94
+ # will contain explicit error information for this particular update.
95
+ # Learn about [Troubleshooting the Teams
96
+ # API](https://developer.squareup.com/docs/docs/team/troubleshooting#bulkupd
97
+ # ateteammembers).
98
+ # @param [BulkUpdateTeamMembersRequest] body Required parameter: An object
99
+ # containing the fields to POST for the request. See the corresponding
100
+ # object definition for field details.
101
+ # @return [BulkUpdateTeamMembersResponse Hash] response from the API call
102
+ def bulk_update_team_members(body:)
103
+ # Prepare query url.
104
+ _query_builder = config.get_base_uri
105
+ _query_builder << '/v2/team-members/bulk-update'
106
+ _query_url = APIHelper.clean_url _query_builder
107
+
108
+ # Prepare headers.
109
+ _headers = {
110
+ 'accept' => 'application/json',
111
+ 'content-type' => 'application/json; charset=utf-8'
112
+ }
113
+
114
+ # Prepare and execute HttpRequest.
115
+ _request = config.http_client.post(
116
+ _query_url,
117
+ headers: _headers,
118
+ parameters: body.to_json
119
+ )
120
+ OAuth2.apply(config, _request)
121
+ _response = execute_request(_request)
122
+
123
+ # Return appropriate response type.
124
+ decoded = APIHelper.json_deserialize(_response.raw_body)
125
+ _errors = APIHelper.map_response(decoded, ['errors'])
126
+ ApiResponse.new(_response, data: decoded, errors: _errors)
127
+ end
128
+
129
+ # Returns a paginated list of `TeamMember` objects for a business.
130
+ # The list to be returned can be filtered by:
131
+ # - location IDs **and**
132
+ # - `is_active`
133
+ # @param [SearchTeamMembersRequest] body Required parameter: An object
134
+ # containing the fields to POST for the request. See the corresponding
135
+ # object definition for field details.
136
+ # @return [SearchTeamMembersResponse Hash] response from the API call
137
+ def search_team_members(body:)
138
+ # Prepare query url.
139
+ _query_builder = config.get_base_uri
140
+ _query_builder << '/v2/team-members/search'
141
+ _query_url = APIHelper.clean_url _query_builder
142
+
143
+ # Prepare headers.
144
+ _headers = {
145
+ 'accept' => 'application/json',
146
+ 'content-type' => 'application/json; charset=utf-8'
147
+ }
148
+
149
+ # Prepare and execute HttpRequest.
150
+ _request = config.http_client.post(
151
+ _query_url,
152
+ headers: _headers,
153
+ parameters: body.to_json
154
+ )
155
+ OAuth2.apply(config, _request)
156
+ _response = execute_request(_request)
157
+
158
+ # Return appropriate response type.
159
+ decoded = APIHelper.json_deserialize(_response.raw_body)
160
+ _errors = APIHelper.map_response(decoded, ['errors'])
161
+ ApiResponse.new(_response, data: decoded, errors: _errors)
162
+ end
163
+
164
+ # Retrieve a `TeamMember` object for the given `TeamMember.id`
165
+ # Learn about [Troubleshooting the Teams
166
+ # API](https://developer.squareup.com/docs/docs/team/troubleshooting#retriev
167
+ # eteammember).
168
+ # @param [String] team_member_id Required parameter: The ID of the team
169
+ # member to retrieve.
170
+ # @return [RetrieveTeamMemberResponse Hash] response from the API call
171
+ def retrieve_team_member(team_member_id:)
172
+ # Prepare query url.
173
+ _query_builder = config.get_base_uri
174
+ _query_builder << '/v2/team-members/{team_member_id}'
175
+ _query_builder = APIHelper.append_url_with_template_parameters(
176
+ _query_builder,
177
+ 'team_member_id' => team_member_id
178
+ )
179
+ _query_url = APIHelper.clean_url _query_builder
180
+
181
+ # Prepare headers.
182
+ _headers = {
183
+ 'accept' => 'application/json'
184
+ }
185
+
186
+ # Prepare and execute HttpRequest.
187
+ _request = config.http_client.get(
188
+ _query_url,
189
+ headers: _headers
190
+ )
191
+ OAuth2.apply(config, _request)
192
+ _response = execute_request(_request)
193
+
194
+ # Return appropriate response type.
195
+ decoded = APIHelper.json_deserialize(_response.raw_body)
196
+ _errors = APIHelper.map_response(decoded, ['errors'])
197
+ ApiResponse.new(_response, data: decoded, errors: _errors)
198
+ end
199
+
200
+ # Updates a single `TeamMember` object. The `TeamMember` will be returned on
201
+ # successful updates.
202
+ # Learn about [Troubleshooting the Teams
203
+ # API](https://developer.squareup.com/docs/docs/team/troubleshooting#updatet
204
+ # eammember).
205
+ # @param [String] team_member_id Required parameter: The ID of the team
206
+ # member to update.
207
+ # @param [UpdateTeamMemberRequest] body Required parameter: An object
208
+ # containing the fields to POST for the request. See the corresponding
209
+ # object definition for field details.
210
+ # @return [UpdateTeamMemberResponse Hash] response from the API call
211
+ def update_team_member(team_member_id:,
212
+ body:)
213
+ # Prepare query url.
214
+ _query_builder = config.get_base_uri
215
+ _query_builder << '/v2/team-members/{team_member_id}'
216
+ _query_builder = APIHelper.append_url_with_template_parameters(
217
+ _query_builder,
218
+ 'team_member_id' => team_member_id
219
+ )
220
+ _query_url = APIHelper.clean_url _query_builder
221
+
222
+ # Prepare headers.
223
+ _headers = {
224
+ 'accept' => 'application/json',
225
+ 'content-type' => 'application/json; charset=utf-8'
226
+ }
227
+
228
+ # Prepare and execute HttpRequest.
229
+ _request = config.http_client.put(
230
+ _query_url,
231
+ headers: _headers,
232
+ parameters: body.to_json
233
+ )
234
+ OAuth2.apply(config, _request)
235
+ _response = execute_request(_request)
236
+
237
+ # Return appropriate response type.
238
+ decoded = APIHelper.json_deserialize(_response.raw_body)
239
+ _errors = APIHelper.map_response(decoded, ['errors'])
240
+ ApiResponse.new(_response, data: decoded, errors: _errors)
241
+ end
242
+
243
+ # Retrieve a `WageSetting` object for a team member specified
244
+ # by `TeamMember.id`.
245
+ # Learn about [Troubleshooting the Teams
246
+ # API](https://developer.squareup.com/docs/docs/team/troubleshooting#retriev
247
+ # ewagesetting).
248
+ # @param [String] team_member_id Required parameter: The ID of the team
249
+ # member to retrieve wage setting for
250
+ # @return [RetrieveWageSettingResponse Hash] response from the API call
251
+ def retrieve_wage_setting(team_member_id:)
252
+ # Prepare query url.
253
+ _query_builder = config.get_base_uri
254
+ _query_builder << '/v2/team-members/{team_member_id}/wage-setting'
255
+ _query_builder = APIHelper.append_url_with_template_parameters(
256
+ _query_builder,
257
+ 'team_member_id' => team_member_id
258
+ )
259
+ _query_url = APIHelper.clean_url _query_builder
260
+
261
+ # Prepare headers.
262
+ _headers = {
263
+ 'accept' => 'application/json'
264
+ }
265
+
266
+ # Prepare and execute HttpRequest.
267
+ _request = config.http_client.get(
268
+ _query_url,
269
+ headers: _headers
270
+ )
271
+ OAuth2.apply(config, _request)
272
+ _response = execute_request(_request)
273
+
274
+ # Return appropriate response type.
275
+ decoded = APIHelper.json_deserialize(_response.raw_body)
276
+ _errors = APIHelper.map_response(decoded, ['errors'])
277
+ ApiResponse.new(_response, data: decoded, errors: _errors)
278
+ end
279
+
280
+ # Creates or updates a `WageSetting` object. The object is created if a
281
+ # `WageSetting` with the specified `team_member_id` does not exist.
282
+ # Otherwise,
283
+ # it fully replaces the `WageSetting` object for the team member.
284
+ # The `WageSetting` will be returned upon successful update.
285
+ # Learn about [Troubleshooting the Teams
286
+ # API](https://developer.squareup.com/docs/docs/team/troubleshooting#updatew
287
+ # agesetting).
288
+ # @param [String] team_member_id Required parameter: The ID of the team
289
+ # member to update the `WageSetting` object for.
290
+ # @param [UpdateWageSettingRequest] body Required parameter: An object
291
+ # containing the fields to POST for the request. See the corresponding
292
+ # object definition for field details.
293
+ # @return [UpdateWageSettingResponse Hash] response from the API call
294
+ def update_wage_setting(team_member_id:,
295
+ body:)
296
+ # Prepare query url.
297
+ _query_builder = config.get_base_uri
298
+ _query_builder << '/v2/team-members/{team_member_id}/wage-setting'
299
+ _query_builder = APIHelper.append_url_with_template_parameters(
300
+ _query_builder,
301
+ 'team_member_id' => team_member_id
302
+ )
303
+ _query_url = APIHelper.clean_url _query_builder
304
+
305
+ # Prepare headers.
306
+ _headers = {
307
+ 'accept' => 'application/json',
308
+ 'content-type' => 'application/json; charset=utf-8'
309
+ }
310
+
311
+ # Prepare and execute HttpRequest.
312
+ _request = config.http_client.put(
313
+ _query_url,
314
+ headers: _headers,
315
+ parameters: body.to_json
316
+ )
317
+ OAuth2.apply(config, _request)
318
+ _response = execute_request(_request)
319
+
320
+ # Return appropriate response type.
321
+ decoded = APIHelper.json_deserialize(_response.raw_body)
322
+ _errors = APIHelper.map_response(decoded, ['errors'])
323
+ ApiResponse.new(_response, data: decoded, errors: _errors)
324
+ end
325
+ end
326
+ end