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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +35 -22
- data/lib/square/api/apple_pay_api.rb +1 -1
- data/lib/square/api/base_api.rb +2 -4
- data/lib/square/api/bookings_api.rb +64 -4
- data/lib/square/api/cards_api.rb +1 -1
- data/lib/square/api/catalog_api.rb +10 -10
- data/lib/square/api/checkout_api.rb +1 -1
- data/lib/square/api/customer_groups_api.rb +3 -3
- data/lib/square/api/customer_segments_api.rb +1 -1
- data/lib/square/api/customers_api.rb +5 -5
- data/lib/square/api/devices_api.rb +1 -1
- data/lib/square/api/disputes_api.rb +1 -1
- data/lib/square/api/gift_card_activities_api.rb +26 -20
- data/lib/square/api/gift_cards_api.rb +29 -24
- data/lib/square/api/inventory_api.rb +6 -6
- data/lib/square/api/invoices_api.rb +5 -5
- data/lib/square/api/labor_api.rb +6 -6
- data/lib/square/api/locations_api.rb +2 -2
- data/lib/square/api/loyalty_api.rb +9 -9
- data/lib/square/api/mobile_authorization_api.rb +1 -1
- data/lib/square/api/o_auth_api.rb +22 -15
- data/lib/square/api/orders_api.rb +43 -6
- data/lib/square/api/payments_api.rb +12 -6
- data/lib/square/api/refunds_api.rb +1 -1
- data/lib/square/api/sites_api.rb +2 -1
- data/lib/square/api/snippets_api.rb +1 -1
- data/lib/square/api/subscriptions_api.rb +159 -16
- data/lib/square/api/team_api.rb +6 -6
- data/lib/square/api/terminal_api.rb +4 -4
- data/lib/square/api/transactions_api.rb +0 -188
- data/lib/square/api/v1_transactions_api.rb +2 -2
- data/lib/square/api_helper.rb +1 -0
- data/lib/square/client.rb +6 -11
- data/lib/square/configuration.rb +19 -20
- data/lib/square/http/api_response.rb +1 -1
- data/lib/square/http/faraday_client.rb +20 -1
- data/lib/square/utilities/file_wrapper.rb +1 -2
- data/lib/square.rb +48 -49
- data/test/test_helper.rb +1 -1
- metadata +7 -11
- 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
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# @param [String] state Optional parameter: If
|
14
|
-
# returns the gift cards in the specified state
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
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,
|
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
|
27
|
-
# returns only the gift cards linked to the specified
|
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
|
-
'
|
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
|
-
'
|
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
|
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
|
-
'
|
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
|
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
|
-
'
|
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
|
-
#
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
342
|
+
'Content-Type' => 'application/json'
|
343
343
|
}
|
344
344
|
|
345
345
|
# Prepare and execute HttpRequest.
|
data/lib/square/api/labor_api.rb
CHANGED
@@ -76,7 +76,7 @@ module Square
|
|
76
76
|
# Prepare headers.
|
77
77
|
_headers = {
|
78
78
|
'accept' => 'application/json',
|
79
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
579
|
+
'Content-Type' => 'application/json'
|
580
580
|
}
|
581
581
|
|
582
582
|
# 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
|
31
|
-
#
|
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
|
-
'
|
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
|
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
|
-
'
|
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
|
-
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
# a refresh token
|
131
|
-
#
|
132
|
-
#
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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
|
-
'
|
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)
|
data/lib/square/api/sites_api.rb
CHANGED
@@ -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
|