square.rb 13.1.0.20210818 → 16.0.1.20211117

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +35 -22
  4. data/lib/square/api/apple_pay_api.rb +1 -1
  5. data/lib/square/api/base_api.rb +2 -4
  6. data/lib/square/api/bookings_api.rb +64 -4
  7. data/lib/square/api/cards_api.rb +1 -1
  8. data/lib/square/api/catalog_api.rb +10 -10
  9. data/lib/square/api/checkout_api.rb +1 -1
  10. data/lib/square/api/customer_groups_api.rb +3 -3
  11. data/lib/square/api/customer_segments_api.rb +1 -1
  12. data/lib/square/api/customers_api.rb +5 -5
  13. data/lib/square/api/devices_api.rb +1 -1
  14. data/lib/square/api/disputes_api.rb +1 -1
  15. data/lib/square/api/gift_card_activities_api.rb +26 -20
  16. data/lib/square/api/gift_cards_api.rb +29 -24
  17. data/lib/square/api/inventory_api.rb +6 -6
  18. data/lib/square/api/invoices_api.rb +5 -5
  19. data/lib/square/api/labor_api.rb +6 -6
  20. data/lib/square/api/locations_api.rb +2 -2
  21. data/lib/square/api/loyalty_api.rb +9 -9
  22. data/lib/square/api/mobile_authorization_api.rb +1 -1
  23. data/lib/square/api/o_auth_api.rb +22 -15
  24. data/lib/square/api/orders_api.rb +43 -6
  25. data/lib/square/api/payments_api.rb +12 -6
  26. data/lib/square/api/refunds_api.rb +1 -1
  27. data/lib/square/api/sites_api.rb +2 -1
  28. data/lib/square/api/snippets_api.rb +1 -1
  29. data/lib/square/api/subscriptions_api.rb +159 -16
  30. data/lib/square/api/team_api.rb +6 -6
  31. data/lib/square/api/terminal_api.rb +4 -4
  32. data/lib/square/api/transactions_api.rb +0 -188
  33. data/lib/square/api/v1_transactions_api.rb +2 -2
  34. data/lib/square/api_helper.rb +1 -0
  35. data/lib/square/client.rb +6 -11
  36. data/lib/square/configuration.rb +19 -20
  37. data/lib/square/http/api_response.rb +1 -1
  38. data/lib/square/http/faraday_client.rb +20 -1
  39. data/lib/square/utilities/file_wrapper.rb +1 -2
  40. data/lib/square.rb +48 -49
  41. data/test/test_helper.rb +1 -1
  42. metadata +7 -11
  43. data/lib/square/api/v1_employees_api.rb +0 -362
@@ -7,24 +7,26 @@ module Square
7
7
 
8
8
  # Lists all gift cards. You can specify optional filters to retrieve
9
9
  # a subset of the gift cards.
10
- # @param [String] type Optional parameter: If a type is provided, gift cards
11
- # of this type are returned (see [GiftCardType]($m/GiftCardType)). If no
12
- # type is provided, it returns gift cards of all types.
13
- # @param [String] state Optional parameter: If the state is provided, it
14
- # returns the gift cards in the specified state (see
15
- # [GiftCardStatus]($m/GiftCardStatus)). Otherwise, it returns the gift cards
16
- # of all states.
17
- # @param [Integer] limit Optional parameter: If a value is provided, it
18
- # returns only that number of results per page. The maximum number of
19
- # results allowed per page is 50. The default value is 30.
10
+ # @param [String] type Optional parameter: If a [type]($m/GiftCardType) is
11
+ # provided, the endpoint returns gift cards of the specified type.
12
+ # Otherwise, the endpoint returns gift cards of all types.
13
+ # @param [String] state Optional parameter: If a [state]($m/GiftCardStatus)
14
+ # is provided, the endpoint returns the gift cards in the specified state.
15
+ # Otherwise, the endpoint returns the gift cards of all states.
16
+ # @param [Integer] limit Optional parameter: If a limit is provided, the
17
+ # endpoint returns only the specified number of results per page. The
18
+ # maximum value is 50. The default value is 30. For more information, see
19
+ # [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
20
+ # ion).
20
21
  # @param [String] cursor Optional parameter: A pagination cursor returned by
21
22
  # a previous call to this endpoint. Provide this cursor to retrieve the next
22
- # set of results for the original query. If a cursor is not provided, it
23
- # returns the first page of the results. For more information, see
23
+ # set of results for the original query. If a cursor is not provided, the
24
+ # endpoint returns the first page of the results. For more information, see
24
25
  # [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
25
26
  # ion).
26
- # @param [String] customer_id Optional parameter: If a value is provided,
27
- # returns only the gift cards linked to the specified customer
27
+ # @param [String] customer_id Optional parameter: If a customer ID is
28
+ # provided, the endpoint returns only the gift cards linked to the specified
29
+ # customer.
28
30
  # @return [ListGiftCardsResponse Hash] response from the API call
29
31
  def list_gift_cards(type: nil,
30
32
  state: nil,
@@ -84,7 +86,7 @@ module Square
84
86
  # Prepare headers.
85
87
  _headers = {
86
88
  'accept' => 'application/json',
87
- 'content-type' => 'application/json; charset=utf-8'
89
+ 'Content-Type' => 'application/json'
88
90
  }
89
91
 
90
92
  # Prepare and execute HttpRequest.
@@ -118,7 +120,7 @@ module Square
118
120
  # Prepare headers.
119
121
  _headers = {
120
122
  'accept' => 'application/json',
121
- 'content-type' => 'application/json; charset=utf-8'
123
+ 'Content-Type' => 'application/json'
122
124
  }
123
125
 
124
126
  # Prepare and execute HttpRequest.
@@ -138,7 +140,7 @@ module Square
138
140
  )
139
141
  end
140
142
 
141
- # Retrieves a gift card using a nonce (a secure token) that represents the
143
+ # Retrieves a gift card using a secure payment token that represents the
142
144
  # gift card.
143
145
  # @param [RetrieveGiftCardFromNonceRequest] body Required parameter: An
144
146
  # object containing the fields to POST for the request. See the
@@ -153,7 +155,7 @@ module Square
153
155
  # Prepare headers.
154
156
  _headers = {
155
157
  'accept' => 'application/json',
156
- 'content-type' => 'application/json; charset=utf-8'
158
+ 'Content-Type' => 'application/json'
157
159
  }
158
160
 
159
161
  # Prepare and execute HttpRequest.
@@ -173,9 +175,10 @@ module Square
173
175
  )
174
176
  end
175
177
 
176
- # Links a customer to a gift card
178
+ # Links a customer to a gift card, which is also referred to as adding a
179
+ # card on file.
177
180
  # @param [String] gift_card_id Required parameter: The ID of the gift card
178
- # to link.
181
+ # to be linked.
179
182
  # @param [LinkCustomerToGiftCardRequest] body Required parameter: An object
180
183
  # containing the fields to POST for the request. See the corresponding
181
184
  # object definition for field details.
@@ -194,7 +197,7 @@ module Square
194
197
  # Prepare headers.
195
198
  _headers = {
196
199
  'accept' => 'application/json',
197
- 'content-type' => 'application/json; charset=utf-8'
200
+ 'Content-Type' => 'application/json'
198
201
  }
199
202
 
200
203
  # Prepare and execute HttpRequest.
@@ -214,8 +217,10 @@ module Square
214
217
  )
215
218
  end
216
219
 
217
- # Unlinks a customer from a gift card
218
- # @param [String] gift_card_id Required parameter: Example:
220
+ # Unlinks a customer from a gift card, which is also referred to as removing
221
+ # a card on file.
222
+ # @param [String] gift_card_id Required parameter: The ID of the gift card
223
+ # to be unlinked.
219
224
  # @param [UnlinkCustomerFromGiftCardRequest] body Required parameter: An
220
225
  # object containing the fields to POST for the request. See the
221
226
  # corresponding object definition for field details.
@@ -234,7 +239,7 @@ module Square
234
239
  # Prepare headers.
235
240
  _headers = {
236
241
  'accept' => 'application/json',
237
- 'content-type' => 'application/json; charset=utf-8'
242
+ 'Content-Type' => 'application/json'
238
243
  }
239
244
 
240
245
  # Prepare and execute HttpRequest.
@@ -100,7 +100,7 @@ module Square
100
100
  # Prepare headers.
101
101
  _headers = {
102
102
  'accept' => 'application/json',
103
- 'content-type' => 'application/json; charset=utf-8'
103
+ 'Content-Type' => 'application/json'
104
104
  }
105
105
 
106
106
  # Prepare and execute HttpRequest.
@@ -139,7 +139,7 @@ module Square
139
139
  # Prepare headers.
140
140
  _headers = {
141
141
  'accept' => 'application/json',
142
- 'content-type' => 'application/json; charset=utf-8'
142
+ 'Content-Type' => 'application/json'
143
143
  }
144
144
 
145
145
  # Prepare and execute HttpRequest.
@@ -178,7 +178,7 @@ module Square
178
178
  # Prepare headers.
179
179
  _headers = {
180
180
  'accept' => 'application/json',
181
- 'content-type' => 'application/json; charset=utf-8'
181
+ 'Content-Type' => 'application/json'
182
182
  }
183
183
 
184
184
  # Prepare and execute HttpRequest.
@@ -215,7 +215,7 @@ module Square
215
215
  # Prepare headers.
216
216
  _headers = {
217
217
  'accept' => 'application/json',
218
- 'content-type' => 'application/json; charset=utf-8'
218
+ 'Content-Type' => 'application/json'
219
219
  }
220
220
 
221
221
  # Prepare and execute HttpRequest.
@@ -254,7 +254,7 @@ module Square
254
254
  # Prepare headers.
255
255
  _headers = {
256
256
  'accept' => 'application/json',
257
- 'content-type' => 'application/json; charset=utf-8'
257
+ 'Content-Type' => 'application/json'
258
258
  }
259
259
 
260
260
  # Prepare and execute HttpRequest.
@@ -297,7 +297,7 @@ module Square
297
297
  # Prepare headers.
298
298
  _headers = {
299
299
  'accept' => 'application/json',
300
- 'content-type' => 'application/json; charset=utf-8'
300
+ 'Content-Type' => 'application/json'
301
301
  }
302
302
 
303
303
  # Prepare and execute HttpRequest.
@@ -72,7 +72,7 @@ module Square
72
72
  # Prepare headers.
73
73
  _headers = {
74
74
  'accept' => 'application/json',
75
- 'content-type' => 'application/json; charset=utf-8'
75
+ 'Content-Type' => 'application/json'
76
76
  }
77
77
 
78
78
  # Prepare and execute HttpRequest.
@@ -112,7 +112,7 @@ module Square
112
112
  # Prepare headers.
113
113
  _headers = {
114
114
  'accept' => 'application/json',
115
- 'content-type' => 'application/json; charset=utf-8'
115
+ 'Content-Type' => 'application/json'
116
116
  }
117
117
 
118
118
  # Prepare and execute HttpRequest.
@@ -242,7 +242,7 @@ module Square
242
242
  # Prepare headers.
243
243
  _headers = {
244
244
  'accept' => 'application/json',
245
- 'content-type' => 'application/json; charset=utf-8'
245
+ 'Content-Type' => 'application/json'
246
246
  }
247
247
 
248
248
  # Prepare and execute HttpRequest.
@@ -286,7 +286,7 @@ module Square
286
286
  # Prepare headers.
287
287
  _headers = {
288
288
  'accept' => 'application/json',
289
- 'content-type' => 'application/json; charset=utf-8'
289
+ 'Content-Type' => 'application/json'
290
290
  }
291
291
 
292
292
  # Prepare and execute HttpRequest.
@@ -339,7 +339,7 @@ module Square
339
339
  # Prepare headers.
340
340
  _headers = {
341
341
  'accept' => 'application/json',
342
- 'content-type' => 'application/json; charset=utf-8'
342
+ 'Content-Type' => 'application/json'
343
343
  }
344
344
 
345
345
  # Prepare and execute HttpRequest.
@@ -76,7 +76,7 @@ module Square
76
76
  # Prepare headers.
77
77
  _headers = {
78
78
  'accept' => 'application/json',
79
- 'content-type' => 'application/json; charset=utf-8'
79
+ 'Content-Type' => 'application/json'
80
80
  }
81
81
 
82
82
  # Prepare and execute HttpRequest.
@@ -188,7 +188,7 @@ module Square
188
188
  # Prepare headers.
189
189
  _headers = {
190
190
  'accept' => 'application/json',
191
- 'content-type' => 'application/json; charset=utf-8'
191
+ 'Content-Type' => 'application/json'
192
192
  }
193
193
 
194
194
  # Prepare and execute HttpRequest.
@@ -319,7 +319,7 @@ module Square
319
319
  # Prepare headers.
320
320
  _headers = {
321
321
  'accept' => 'application/json',
322
- 'content-type' => 'application/json; charset=utf-8'
322
+ 'Content-Type' => 'application/json'
323
323
  }
324
324
 
325
325
  # Prepare and execute HttpRequest.
@@ -365,7 +365,7 @@ module Square
365
365
  # Prepare headers.
366
366
  _headers = {
367
367
  'accept' => 'application/json',
368
- 'content-type' => 'application/json; charset=utf-8'
368
+ 'Content-Type' => 'application/json'
369
369
  }
370
370
 
371
371
  # Prepare and execute HttpRequest.
@@ -482,7 +482,7 @@ module Square
482
482
  # Prepare headers.
483
483
  _headers = {
484
484
  'accept' => 'application/json',
485
- 'content-type' => 'application/json; charset=utf-8'
485
+ 'Content-Type' => 'application/json'
486
486
  }
487
487
 
488
488
  # Prepare and execute HttpRequest.
@@ -641,7 +641,7 @@ module Square
641
641
  # Prepare headers.
642
642
  _headers = {
643
643
  'accept' => 'application/json',
644
- 'content-type' => 'application/json; charset=utf-8'
644
+ 'Content-Type' => 'application/json'
645
645
  }
646
646
 
647
647
  # Prepare and execute HttpRequest.
@@ -51,7 +51,7 @@ module Square
51
51
  # Prepare headers.
52
52
  _headers = {
53
53
  'accept' => 'application/json',
54
- 'content-type' => 'application/json; charset=utf-8'
54
+ 'Content-Type' => 'application/json'
55
55
  }
56
56
 
57
57
  # Prepare and execute HttpRequest.
@@ -130,7 +130,7 @@ module Square
130
130
  # Prepare headers.
131
131
  _headers = {
132
132
  'accept' => 'application/json',
133
- 'content-type' => 'application/json; charset=utf-8'
133
+ 'Content-Type' => 'application/json'
134
134
  }
135
135
 
136
136
  # Prepare and execute HttpRequest.
@@ -20,7 +20,7 @@ module Square
20
20
  # Prepare headers.
21
21
  _headers = {
22
22
  'accept' => 'application/json',
23
- 'content-type' => 'application/json; charset=utf-8'
23
+ 'Content-Type' => 'application/json'
24
24
  }
25
25
 
26
26
  # Prepare and execute HttpRequest.
@@ -58,7 +58,7 @@ module Square
58
58
  # Prepare headers.
59
59
  _headers = {
60
60
  'accept' => 'application/json',
61
- 'content-type' => 'application/json; charset=utf-8'
61
+ 'Content-Type' => 'application/json'
62
62
  }
63
63
 
64
64
  # Prepare and execute HttpRequest.
@@ -150,7 +150,7 @@ module Square
150
150
  # Prepare headers.
151
151
  _headers = {
152
152
  'accept' => 'application/json',
153
- 'content-type' => 'application/json; charset=utf-8'
153
+ 'Content-Type' => 'application/json'
154
154
  }
155
155
 
156
156
  # Prepare and execute HttpRequest.
@@ -195,7 +195,7 @@ module Square
195
195
  # Prepare headers.
196
196
  _headers = {
197
197
  'accept' => 'application/json',
198
- 'content-type' => 'application/json; charset=utf-8'
198
+ 'Content-Type' => 'application/json'
199
199
  }
200
200
 
201
201
  # Prepare and execute HttpRequest.
@@ -236,7 +236,7 @@ module Square
236
236
  # Prepare headers.
237
237
  _headers = {
238
238
  'accept' => 'application/json',
239
- 'content-type' => 'application/json; charset=utf-8'
239
+ 'Content-Type' => 'application/json'
240
240
  }
241
241
 
242
242
  # Prepare and execute HttpRequest.
@@ -372,7 +372,7 @@ module Square
372
372
  # Prepare headers.
373
373
  _headers = {
374
374
  'accept' => 'application/json',
375
- 'content-type' => 'application/json; charset=utf-8'
375
+ 'Content-Type' => 'application/json'
376
376
  }
377
377
 
378
378
  # Prepare and execute HttpRequest.
@@ -413,7 +413,7 @@ module Square
413
413
  # Prepare headers.
414
414
  _headers = {
415
415
  'accept' => 'application/json',
416
- 'content-type' => 'application/json; charset=utf-8'
416
+ 'Content-Type' => 'application/json'
417
417
  }
418
418
 
419
419
  # Prepare and execute HttpRequest.
@@ -452,7 +452,7 @@ module Square
452
452
  # Prepare headers.
453
453
  _headers = {
454
454
  'accept' => 'application/json',
455
- 'content-type' => 'application/json; charset=utf-8'
455
+ 'Content-Type' => 'application/json'
456
456
  }
457
457
 
458
458
  # Prepare and execute HttpRequest.
@@ -576,7 +576,7 @@ module Square
576
576
  # Prepare headers.
577
577
  _headers = {
578
578
  'accept' => 'application/json',
579
- 'content-type' => 'application/json; charset=utf-8'
579
+ 'Content-Type' => 'application/json'
580
580
  }
581
581
 
582
582
  # Prepare and execute HttpRequest.
@@ -31,7 +31,7 @@ module Square
31
31
  # Prepare headers.
32
32
  _headers = {
33
33
  'accept' => 'application/json',
34
- 'content-type' => 'application/json; charset=utf-8'
34
+ 'Content-Type' => 'application/json'
35
35
  }
36
36
 
37
37
  # Prepare and execute HttpRequest.
@@ -27,8 +27,8 @@ module Square
27
27
  # Credentials
28
28
  # page in the [developer dashboard](https://developer.squareup.com/apps).
29
29
  # @param [String] client_id Required parameter: Your application ID,
30
- # available from the [developer
31
- # dashboard](https://developer.squareup.com/apps).
30
+ # available from the OAuth page for your application on the Developer
31
+ # Dashboard.
32
32
  # @param [RenewTokenRequest] body Required parameter: An object containing
33
33
  # the fields to POST for the request. See the corresponding object
34
34
  # definition for field details.
@@ -51,7 +51,7 @@ module Square
51
51
  # Prepare headers.
52
52
  _headers = {
53
53
  'accept' => 'application/json',
54
- 'content-type' => 'application/json; charset=utf-8',
54
+ 'Content-Type' => 'application/json',
55
55
  'Authorization' => authorization
56
56
  }
57
57
 
@@ -84,7 +84,7 @@ module Square
84
84
  # Authorization: Client APPLICATION_SECRET
85
85
  # ```
86
86
  # Replace `APPLICATION_SECRET` with the application secret on the OAuth
87
- # page in the [developer dashboard](https://developer.squareup.com/apps).
87
+ # page for your application on the Developer Dashboard.
88
88
  # @param [RevokeTokenRequest] body Required parameter: An object containing
89
89
  # the fields to POST for the request. See the corresponding object
90
90
  # definition for field details.
@@ -101,7 +101,7 @@ module Square
101
101
  # Prepare headers.
102
102
  _headers = {
103
103
  'accept' => 'application/json',
104
- 'content-type' => 'application/json; charset=utf-8',
104
+ 'Content-Type' => 'application/json',
105
105
  'Authorization' => authorization
106
106
  }
107
107
 
@@ -121,15 +121,22 @@ module Square
121
121
  )
122
122
  end
123
123
 
124
- # Returns an OAuth access token.
125
- # The endpoint supports distinct methods of obtaining OAuth access tokens.
126
- # Applications specify a method by adding the `grant_type` parameter
127
- # in the request and also provide relevant information.
128
- # __Note:__ Regardless of the method application specified,
129
- # the endpoint always returns two items; an OAuth access token and
130
- # a refresh token in the response.
131
- # __OAuth tokens should only live on secure servers. Application clients
132
- # should never interact directly with OAuth tokens__.
124
+ # Returns an OAuth access token and a refresh token unless the
125
+ # `short_lived` parameter is set to `true`, in which case the endpoint
126
+ # returns only an access token.
127
+ # The `grant_type` parameter specifies the type of OAuth request. If
128
+ # `grant_type` is `authorization_code`, you must include the authorization
129
+ # code you received when a seller granted you authorization. If `grant_type`
130
+ # is `refresh_token`, you must provide a valid refresh token. If you are
131
+ # using
132
+ # an old version of the Square APIs (prior to March 13, 2019), `grant_type`
133
+ # can be `migration_token` and you must provide a valid migration token.
134
+ # You can use the `scopes` parameter to limit the set of permissions granted
135
+ # to the access token and refresh token. You can use the `short_lived`
136
+ # parameter
137
+ # to create an access token that expires in 24 hours.
138
+ # __Note:__ OAuth tokens should be encrypted and stored on a secure server.
139
+ # Application clients should never interact directly with OAuth tokens.
133
140
  # @param [ObtainTokenRequest] body Required parameter: An object containing
134
141
  # the fields to POST for the request. See the corresponding object
135
142
  # definition for field details.
@@ -143,7 +150,7 @@ module Square
143
150
  # Prepare headers.
144
151
  _headers = {
145
152
  'accept' => 'application/json',
146
- 'content-type' => 'application/json; charset=utf-8'
153
+ 'Content-Type' => 'application/json'
147
154
  }
148
155
 
149
156
  # Prepare and execute HttpRequest.
@@ -26,7 +26,7 @@ module Square
26
26
  # Prepare headers.
27
27
  _headers = {
28
28
  'accept' => 'application/json',
29
- 'content-type' => 'application/json; charset=utf-8'
29
+ 'Content-Type' => 'application/json'
30
30
  }
31
31
 
32
32
  # Prepare and execute HttpRequest.
@@ -62,7 +62,7 @@ module Square
62
62
  # Prepare headers.
63
63
  _headers = {
64
64
  'accept' => 'application/json',
65
- 'content-type' => 'application/json; charset=utf-8'
65
+ 'Content-Type' => 'application/json'
66
66
  }
67
67
 
68
68
  # Prepare and execute HttpRequest.
@@ -96,7 +96,44 @@ module Square
96
96
  # Prepare headers.
97
97
  _headers = {
98
98
  'accept' => 'application/json',
99
- 'content-type' => 'application/json; charset=utf-8'
99
+ 'Content-Type' => 'application/json'
100
+ }
101
+
102
+ # Prepare and execute HttpRequest.
103
+ _request = config.http_client.post(
104
+ _query_url,
105
+ headers: _headers,
106
+ parameters: body.to_json
107
+ )
108
+ OAuth2.apply(config, _request)
109
+ _response = execute_request(_request)
110
+
111
+ # Return appropriate response type.
112
+ decoded = APIHelper.json_deserialize(_response.raw_body)
113
+ _errors = APIHelper.map_response(decoded, ['errors'])
114
+ ApiResponse.new(
115
+ _response, data: decoded, errors: _errors
116
+ )
117
+ end
118
+
119
+ # Creates a new order, in the `DRAFT` state, by duplicating an existing
120
+ # order. The newly created order has
121
+ # only the core fields (such as line items, taxes, and discounts) copied
122
+ # from the original order.
123
+ # @param [CloneOrderRequest] body Required parameter: An object containing
124
+ # the fields to POST for the request. See the corresponding object
125
+ # definition for field details.
126
+ # @return [CloneOrderResponse Hash] response from the API call
127
+ def clone_order(body:)
128
+ # Prepare query url.
129
+ _query_builder = config.get_base_uri
130
+ _query_builder << '/v2/orders/clone'
131
+ _query_url = APIHelper.clean_url _query_builder
132
+
133
+ # Prepare headers.
134
+ _headers = {
135
+ 'accept' => 'application/json',
136
+ 'Content-Type' => 'application/json'
100
137
  }
101
138
 
102
139
  # Prepare and execute HttpRequest.
@@ -146,7 +183,7 @@ module Square
146
183
  # Prepare headers.
147
184
  _headers = {
148
185
  'accept' => 'application/json',
149
- 'content-type' => 'application/json; charset=utf-8'
186
+ 'Content-Type' => 'application/json'
150
187
  }
151
188
 
152
189
  # Prepare and execute HttpRequest.
@@ -239,7 +276,7 @@ module Square
239
276
  # Prepare headers.
240
277
  _headers = {
241
278
  'accept' => 'application/json',
242
- 'content-type' => 'application/json; charset=utf-8'
279
+ 'Content-Type' => 'application/json'
243
280
  }
244
281
 
245
282
  # Prepare and execute HttpRequest.
@@ -298,7 +335,7 @@ module Square
298
335
  # Prepare headers.
299
336
  _headers = {
300
337
  'accept' => 'application/json',
301
- 'content-type' => 'application/json; charset=utf-8'
338
+ 'Content-Type' => 'application/json'
302
339
  }
303
340
 
304
341
  # Prepare and execute HttpRequest.
@@ -107,7 +107,7 @@ module Square
107
107
  # Prepare headers.
108
108
  _headers = {
109
109
  'accept' => 'application/json',
110
- 'content-type' => 'application/json; charset=utf-8'
110
+ 'Content-Type' => 'application/json'
111
111
  }
112
112
 
113
113
  # Prepare and execute HttpRequest.
@@ -155,7 +155,7 @@ module Square
155
155
  # Prepare headers.
156
156
  _headers = {
157
157
  'accept' => 'application/json',
158
- 'content-type' => 'application/json; charset=utf-8'
158
+ 'Content-Type' => 'application/json'
159
159
  }
160
160
 
161
161
  # Prepare and execute HttpRequest.
@@ -232,7 +232,7 @@ module Square
232
232
  # Prepare headers.
233
233
  _headers = {
234
234
  'accept' => 'application/json',
235
- 'content-type' => 'application/json; charset=utf-8'
235
+ 'Content-Type' => 'application/json'
236
236
  }
237
237
 
238
238
  # Prepare and execute HttpRequest.
@@ -296,8 +296,12 @@ module Square
296
296
  # `status`.
297
297
  # @param [String] payment_id Required parameter: The unique ID identifying
298
298
  # the payment to be completed.
299
+ # @param [CompletePaymentRequest] body Required parameter: An object
300
+ # containing the fields to POST for the request. See the corresponding
301
+ # object definition for field details.
299
302
  # @return [CompletePaymentResponse Hash] response from the API call
300
- def complete_payment(payment_id:)
303
+ def complete_payment(payment_id:,
304
+ body:)
301
305
  # Prepare query url.
302
306
  _query_builder = config.get_base_uri
303
307
  _query_builder << '/v2/payments/{payment_id}/complete'
@@ -309,13 +313,15 @@ module Square
309
313
 
310
314
  # Prepare headers.
311
315
  _headers = {
312
- 'accept' => 'application/json'
316
+ 'accept' => 'application/json',
317
+ 'Content-Type' => 'application/json'
313
318
  }
314
319
 
315
320
  # Prepare and execute HttpRequest.
316
321
  _request = config.http_client.post(
317
322
  _query_url,
318
- headers: _headers
323
+ headers: _headers,
324
+ parameters: body.to_json
319
325
  )
320
326
  OAuth2.apply(config, _request)
321
327
  _response = execute_request(_request)
@@ -105,7 +105,7 @@ module Square
105
105
  # Prepare headers.
106
106
  _headers = {
107
107
  'accept' => 'application/json',
108
- 'content-type' => 'application/json; charset=utf-8'
108
+ 'Content-Type' => 'application/json'
109
109
  }
110
110
 
111
111
  # Prepare and execute HttpRequest.
@@ -5,7 +5,8 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Lists the Square Online sites that belong to a seller.
8
+ # Lists the Square Online sites that belong to a seller. Sites are listed in
9
+ # descending order by the `created_at` date.
9
10
  # __Note:__ Square Online APIs are publicly available as part of an early
10
11
  # access program. For more information, see [Early access program for Square
11
12
  # Online
@@ -123,7 +123,7 @@ module Square
123
123
  # Prepare headers.
124
124
  _headers = {
125
125
  'accept' => 'application/json',
126
- 'content-type' => 'application/json; charset=utf-8'
126
+ 'Content-Type' => 'application/json'
127
127
  }
128
128
 
129
129
  # Prepare and execute HttpRequest.