square.rb 6.4.0.20200923 → 9.0.0.20210226
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/LICENSE +1 -1
- data/README.md +43 -31
- data/lib/square.rb +60 -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 +308 -0
- data/lib/square/api/cash_drawers_api.rb +13 -6
- data/lib/square/api/catalog_api.rb +71 -35
- 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 +70 -54
- data/lib/square/api/employees_api.rb +7 -3
- data/lib/square/api/inventory_api.rb +27 -13
- data/lib/square/api/invoices_api.rb +44 -25
- data/lib/square/api/labor_api.rb +57 -25
- 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 +55 -8
- data/lib/square/api/payments_api.rb +68 -55
- data/lib/square/api/refunds_api.rb +32 -26
- data/lib/square/api/subscriptions_api.rb +26 -14
- 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 +27 -389
- data/lib/square/api/v1_transactions_api.rb +42 -101
- data/lib/square/api_helper.rb +14 -9
- data/lib/square/client.rb +10 -14
- data/lib/square/configuration.rb +21 -6
- 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/test_locations_api.rb +1 -1
- metadata +5 -6
- data/lib/square/api/v1_items_api.rb +0 -1686
- data/lib/square/api/v1_locations_api.rb +0 -65
@@ -57,11 +57,14 @@ module Square
|
|
57
57
|
# Return appropriate response type.
|
58
58
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
59
59
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
60
|
-
ApiResponse.new(
|
60
|
+
ApiResponse.new(
|
61
|
+
_response, data: decoded, errors: _errors
|
62
|
+
)
|
61
63
|
end
|
62
64
|
|
63
65
|
# Provides the summary details for a single cash drawer shift. See
|
64
|
-
#
|
66
|
+
# [ListCashDrawerShiftEvents](#endpoint-CashDrawers-ListCashDrawerShiftEvent
|
67
|
+
# s) for a list of cash drawer shift events.
|
65
68
|
# @param [String] location_id Required parameter: The ID of the location to
|
66
69
|
# retrieve cash drawer shifts from.
|
67
70
|
# @param [String] shift_id Required parameter: The shift ID.
|
@@ -73,7 +76,7 @@ module Square
|
|
73
76
|
_query_builder << '/v2/cash-drawers/shifts/{shift_id}'
|
74
77
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
75
78
|
_query_builder,
|
76
|
-
'shift_id' => shift_id
|
79
|
+
'shift_id' => { 'value' => shift_id, 'encode' => true }
|
77
80
|
)
|
78
81
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
79
82
|
_query_builder,
|
@@ -97,7 +100,9 @@ module Square
|
|
97
100
|
# Return appropriate response type.
|
98
101
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
99
102
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
100
|
-
ApiResponse.new(
|
103
|
+
ApiResponse.new(
|
104
|
+
_response, data: decoded, errors: _errors
|
105
|
+
)
|
101
106
|
end
|
102
107
|
|
103
108
|
# Provides a paginated list of events for a single cash drawer shift.
|
@@ -118,7 +123,7 @@ module Square
|
|
118
123
|
_query_builder << '/v2/cash-drawers/shifts/{shift_id}/events'
|
119
124
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
120
125
|
_query_builder,
|
121
|
-
'shift_id' => shift_id
|
126
|
+
'shift_id' => { 'value' => shift_id, 'encode' => true }
|
122
127
|
)
|
123
128
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
124
129
|
_query_builder,
|
@@ -144,7 +149,9 @@ module Square
|
|
144
149
|
# Return appropriate response type.
|
145
150
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
146
151
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
147
|
-
ApiResponse.new(
|
152
|
+
ApiResponse.new(
|
153
|
+
_response, data: decoded, errors: _errors
|
154
|
+
)
|
148
155
|
end
|
149
156
|
end
|
150
157
|
end
|
@@ -44,7 +44,9 @@ module Square
|
|
44
44
|
# Return appropriate response type.
|
45
45
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
46
46
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
47
|
-
ApiResponse.new(
|
47
|
+
ApiResponse.new(
|
48
|
+
_response, data: decoded, errors: _errors
|
49
|
+
)
|
48
50
|
end
|
49
51
|
|
50
52
|
# Returns a set of objects based on the provided ID.
|
@@ -83,7 +85,9 @@ module Square
|
|
83
85
|
# Return appropriate response type.
|
84
86
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
85
87
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
86
|
-
ApiResponse.new(
|
88
|
+
ApiResponse.new(
|
89
|
+
_response, data: decoded, errors: _errors
|
90
|
+
)
|
87
91
|
end
|
88
92
|
|
89
93
|
# Creates or updates up to 10,000 target objects based on the provided
|
@@ -128,10 +132,12 @@ module Square
|
|
128
132
|
# Return appropriate response type.
|
129
133
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
130
134
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
131
|
-
ApiResponse.new(
|
135
|
+
ApiResponse.new(
|
136
|
+
_response, data: decoded, errors: _errors
|
137
|
+
)
|
132
138
|
end
|
133
139
|
|
134
|
-
# Uploads an image file to be represented by
|
140
|
+
# Uploads an image file to be represented by a
|
135
141
|
# [CatalogImage](#type-catalogimage) object linked to an existing
|
136
142
|
# [CatalogObject](#type-catalogobject) instance. A call to this endpoint can
|
137
143
|
# upload an image, link an image to
|
@@ -139,10 +145,6 @@ module Square
|
|
139
145
|
# This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data
|
140
146
|
# requests with a JSON part and an image file part in
|
141
147
|
# JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
|
142
|
-
# Additional information and an example cURL request can be found in the
|
143
|
-
# [Create a Catalog Image
|
144
|
-
# recipe](https://developer.squareup.com/docs/more-apis/catalog/cookbook/cre
|
145
|
-
# ate-catalog-images).
|
146
148
|
# @param [CreateCatalogImageRequest] request Optional parameter: Example:
|
147
149
|
# @param [File | UploadIO] image_file Optional parameter: Example:
|
148
150
|
# @return [CreateCatalogImageResponse Hash] response from the API call
|
@@ -191,7 +193,9 @@ module Square
|
|
191
193
|
# Return appropriate response type.
|
192
194
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
193
195
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
194
|
-
ApiResponse.new(
|
196
|
+
ApiResponse.new(
|
197
|
+
_response, data: decoded, errors: _errors
|
198
|
+
)
|
195
199
|
end
|
196
200
|
|
197
201
|
# Retrieves information about the Square Catalog API, such as batch size
|
@@ -219,7 +223,9 @@ module Square
|
|
219
223
|
# Return appropriate response type.
|
220
224
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
221
225
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
222
|
-
ApiResponse.new(
|
226
|
+
ApiResponse.new(
|
227
|
+
_response, data: decoded, errors: _errors
|
228
|
+
)
|
223
229
|
end
|
224
230
|
|
225
231
|
# Returns a list of [CatalogObject](#type-catalogobject)s that includes
|
@@ -233,9 +239,9 @@ module Square
|
|
233
239
|
# `DISCOUNT`, `TAX`, `IMAGE`.
|
234
240
|
# __Important:__ ListCatalog does not return deleted catalog items. To
|
235
241
|
# retrieve
|
236
|
-
# deleted catalog items, use
|
237
|
-
#
|
238
|
-
# to `true`.
|
242
|
+
# deleted catalog items, use
|
243
|
+
# [SearchCatalogObjects](#endpoint-Catalog-SearchCatalogObjects)
|
244
|
+
# and set the `include_deleted_objects` attribute value to `true`.
|
239
245
|
# @param [String] cursor Optional parameter: The pagination cursor returned
|
240
246
|
# in the previous response. Leave unset for an initial request. See
|
241
247
|
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
@@ -245,16 +251,23 @@ module Square
|
|
245
251
|
# `ITEM,ITEM_VARIATION,CATEGORY,IMAGE`. The legal values are taken from the
|
246
252
|
# CatalogObjectType enum: `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`,
|
247
253
|
# `TAX`, `MODIFIER`, `MODIFIER_LIST`, or `IMAGE`.
|
254
|
+
# @param [Long] catalog_version Optional parameter: The specific version of
|
255
|
+
# the catalog objects to be included in the response. This allows you to
|
256
|
+
# retrieve historical versions of objects. The specified version value is
|
257
|
+
# matched against the [CatalogObject](#type-catalogobject)s' `version`
|
258
|
+
# attribute.
|
248
259
|
# @return [ListCatalogResponse Hash] response from the API call
|
249
260
|
def list_catalog(cursor: nil,
|
250
|
-
types: nil
|
261
|
+
types: nil,
|
262
|
+
catalog_version: nil)
|
251
263
|
# Prepare query url.
|
252
264
|
_query_builder = config.get_base_uri
|
253
265
|
_query_builder << '/v2/catalog/list'
|
254
266
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
255
267
|
_query_builder,
|
256
268
|
'cursor' => cursor,
|
257
|
-
'types' => types
|
269
|
+
'types' => types,
|
270
|
+
'catalog_version' => catalog_version
|
258
271
|
)
|
259
272
|
_query_url = APIHelper.clean_url _query_builder
|
260
273
|
|
@@ -274,7 +287,9 @@ module Square
|
|
274
287
|
# Return appropriate response type.
|
275
288
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
276
289
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
277
|
-
ApiResponse.new(
|
290
|
+
ApiResponse.new(
|
291
|
+
_response, data: decoded, errors: _errors
|
292
|
+
)
|
278
293
|
end
|
279
294
|
|
280
295
|
# Creates or updates the target [CatalogObject](#type-catalogobject).
|
@@ -306,7 +321,9 @@ module Square
|
|
306
321
|
# Return appropriate response type.
|
307
322
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
308
323
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
309
|
-
ApiResponse.new(
|
324
|
+
ApiResponse.new(
|
325
|
+
_response, data: decoded, errors: _errors
|
326
|
+
)
|
310
327
|
end
|
311
328
|
|
312
329
|
# Deletes a single [CatalogObject](#type-catalogobject) based on the
|
@@ -328,7 +345,7 @@ module Square
|
|
328
345
|
_query_builder << '/v2/catalog/object/{object_id}'
|
329
346
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
330
347
|
_query_builder,
|
331
|
-
'object_id' => object_id
|
348
|
+
'object_id' => { 'value' => object_id, 'encode' => true }
|
332
349
|
)
|
333
350
|
_query_url = APIHelper.clean_url _query_builder
|
334
351
|
|
@@ -348,7 +365,9 @@ module Square
|
|
348
365
|
# Return appropriate response type.
|
349
366
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
350
367
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
351
|
-
ApiResponse.new(
|
368
|
+
ApiResponse.new(
|
369
|
+
_response, data: decoded, errors: _errors
|
370
|
+
)
|
352
371
|
end
|
353
372
|
|
354
373
|
# Returns a single [CatalogItem](#type-catalogitem) as a
|
@@ -364,25 +383,32 @@ module Square
|
|
364
383
|
# @param [Boolean] include_related_objects Optional parameter: If `true`,
|
365
384
|
# the response will include additional objects that are related to the
|
366
385
|
# requested object, as follows: If the `object` field of the response
|
367
|
-
# contains a CatalogItem
|
368
|
-
#
|
386
|
+
# contains a `CatalogItem`, its associated `CatalogCategory`, `CatalogTax`,
|
387
|
+
# `CatalogImage` and `CatalogModifierList` objects will be returned in the
|
369
388
|
# `related_objects` field of the response. If the `object` field of the
|
370
|
-
# response contains a CatalogItemVariation
|
371
|
-
# returned in the `related_objects` field of the response. Default
|
372
|
-
# `false`
|
389
|
+
# response contains a `CatalogItemVariation`, its parent `CatalogItem` will
|
390
|
+
# be returned in the `related_objects` field of the response. Default
|
391
|
+
# value: `false`
|
392
|
+
# @param [Long] catalog_version Optional parameter: Requests objects as of a
|
393
|
+
# specific version of the catalog. This allows you to retrieve historical
|
394
|
+
# versions of objects. The value to retrieve a specific version of an object
|
395
|
+
# can be found in the version field of
|
396
|
+
# [CatalogObject](#type-catalogobject)s.
|
373
397
|
# @return [RetrieveCatalogObjectResponse Hash] response from the API call
|
374
398
|
def retrieve_catalog_object(object_id:,
|
375
|
-
include_related_objects: false
|
399
|
+
include_related_objects: false,
|
400
|
+
catalog_version: nil)
|
376
401
|
# Prepare query url.
|
377
402
|
_query_builder = config.get_base_uri
|
378
403
|
_query_builder << '/v2/catalog/object/{object_id}'
|
379
404
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
380
405
|
_query_builder,
|
381
|
-
'object_id' => object_id
|
406
|
+
'object_id' => { 'value' => object_id, 'encode' => true }
|
382
407
|
)
|
383
408
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
384
409
|
_query_builder,
|
385
|
-
'include_related_objects' => include_related_objects
|
410
|
+
'include_related_objects' => include_related_objects,
|
411
|
+
'catalog_version' => catalog_version
|
386
412
|
)
|
387
413
|
_query_url = APIHelper.clean_url _query_builder
|
388
414
|
|
@@ -402,13 +428,15 @@ module Square
|
|
402
428
|
# Return appropriate response type.
|
403
429
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
404
430
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
405
|
-
ApiResponse.new(
|
431
|
+
ApiResponse.new(
|
432
|
+
_response, data: decoded, errors: _errors
|
433
|
+
)
|
406
434
|
end
|
407
435
|
|
408
|
-
# Searches for [CatalogObject](#type-CatalogObject) of any
|
436
|
+
# Searches for [CatalogObject](#type-CatalogObject) of any type by matching
|
409
437
|
# supported search attribute values,
|
410
438
|
# excluding custom attribute values on items or item variations, against one
|
411
|
-
# or more of the specified query expressions
|
439
|
+
# or more of the specified query expressions.
|
412
440
|
# This (`SearchCatalogObjects`) endpoint differs from the
|
413
441
|
# [SearchCatalogItems](#endpoint-Catalog-SearchCatalogItems)
|
414
442
|
# endpoint in the following aspects:
|
@@ -450,13 +478,15 @@ module Square
|
|
450
478
|
# Return appropriate response type.
|
451
479
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
452
480
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
453
|
-
ApiResponse.new(
|
481
|
+
ApiResponse.new(
|
482
|
+
_response, data: decoded, errors: _errors
|
483
|
+
)
|
454
484
|
end
|
455
485
|
|
456
486
|
# Searches for catalog items or item variations by matching supported search
|
457
487
|
# attribute values, including
|
458
488
|
# custom attribute values, against one or more of the specified query
|
459
|
-
# expressions
|
489
|
+
# expressions.
|
460
490
|
# This (`SearchCatalogItems`) endpoint differs from the
|
461
491
|
# [SearchCatalogObjects](#endpoint-Catalog-SearchCatalogObjects)
|
462
492
|
# endpoint in the following aspects:
|
@@ -498,7 +528,9 @@ module Square
|
|
498
528
|
# Return appropriate response type.
|
499
529
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
500
530
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
501
|
-
ApiResponse.new(
|
531
|
+
ApiResponse.new(
|
532
|
+
_response, data: decoded, errors: _errors
|
533
|
+
)
|
502
534
|
end
|
503
535
|
|
504
536
|
# Updates the [CatalogModifierList](#type-catalogmodifierlist) objects
|
@@ -532,7 +564,9 @@ module Square
|
|
532
564
|
# Return appropriate response type.
|
533
565
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
534
566
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
535
|
-
ApiResponse.new(
|
567
|
+
ApiResponse.new(
|
568
|
+
_response, data: decoded, errors: _errors
|
569
|
+
)
|
536
570
|
end
|
537
571
|
|
538
572
|
# Updates the [CatalogTax](#type-catalogtax) objects that apply to the
|
@@ -566,7 +600,9 @@ module Square
|
|
566
600
|
# Return appropriate response type.
|
567
601
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
568
602
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
569
|
-
ApiResponse.new(
|
603
|
+
ApiResponse.new(
|
604
|
+
_response, data: decoded, errors: _errors
|
605
|
+
)
|
570
606
|
end
|
571
607
|
end
|
572
608
|
end
|
@@ -21,7 +21,7 @@ module Square
|
|
21
21
|
_query_builder << '/v2/locations/{location_id}/checkouts'
|
22
22
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
23
23
|
_query_builder,
|
24
|
-
'location_id' => location_id
|
24
|
+
'location_id' => { 'value' => location_id, 'encode' => true }
|
25
25
|
)
|
26
26
|
_query_url = APIHelper.clean_url _query_builder
|
27
27
|
|
@@ -43,7 +43,9 @@ module Square
|
|
43
43
|
# Return appropriate response type.
|
44
44
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
45
45
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
46
|
-
ApiResponse.new(
|
46
|
+
ApiResponse.new(
|
47
|
+
_response, data: decoded, errors: _errors
|
48
|
+
)
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
@@ -38,7 +38,9 @@ module Square
|
|
38
38
|
# Return appropriate response type.
|
39
39
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
40
40
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
41
|
-
ApiResponse.new(
|
41
|
+
ApiResponse.new(
|
42
|
+
_response, data: decoded, errors: _errors
|
43
|
+
)
|
42
44
|
end
|
43
45
|
|
44
46
|
# Creates a new customer group for a business.
|
@@ -71,7 +73,9 @@ module Square
|
|
71
73
|
# Return appropriate response type.
|
72
74
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
73
75
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
74
|
-
ApiResponse.new(
|
76
|
+
ApiResponse.new(
|
77
|
+
_response, data: decoded, errors: _errors
|
78
|
+
)
|
75
79
|
end
|
76
80
|
|
77
81
|
# Deletes a customer group as identified by the `group_id` value.
|
@@ -84,7 +88,7 @@ module Square
|
|
84
88
|
_query_builder << '/v2/customers/groups/{group_id}'
|
85
89
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
86
90
|
_query_builder,
|
87
|
-
'group_id' => group_id
|
91
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
88
92
|
)
|
89
93
|
_query_url = APIHelper.clean_url _query_builder
|
90
94
|
|
@@ -104,7 +108,9 @@ module Square
|
|
104
108
|
# Return appropriate response type.
|
105
109
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
106
110
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
107
|
-
ApiResponse.new(
|
111
|
+
ApiResponse.new(
|
112
|
+
_response, data: decoded, errors: _errors
|
113
|
+
)
|
108
114
|
end
|
109
115
|
|
110
116
|
# Retrieves a specific customer group as identified by the `group_id` value.
|
@@ -117,7 +123,7 @@ module Square
|
|
117
123
|
_query_builder << '/v2/customers/groups/{group_id}'
|
118
124
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
119
125
|
_query_builder,
|
120
|
-
'group_id' => group_id
|
126
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
121
127
|
)
|
122
128
|
_query_url = APIHelper.clean_url _query_builder
|
123
129
|
|
@@ -137,7 +143,9 @@ module Square
|
|
137
143
|
# Return appropriate response type.
|
138
144
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
139
145
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
140
|
-
ApiResponse.new(
|
146
|
+
ApiResponse.new(
|
147
|
+
_response, data: decoded, errors: _errors
|
148
|
+
)
|
141
149
|
end
|
142
150
|
|
143
151
|
# Updates a customer group as identified by the `group_id` value.
|
@@ -154,7 +162,7 @@ module Square
|
|
154
162
|
_query_builder << '/v2/customers/groups/{group_id}'
|
155
163
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
156
164
|
_query_builder,
|
157
|
-
'group_id' => group_id
|
165
|
+
'group_id' => { 'value' => group_id, 'encode' => true }
|
158
166
|
)
|
159
167
|
_query_url = APIHelper.clean_url _query_builder
|
160
168
|
|
@@ -176,7 +184,9 @@ module Square
|
|
176
184
|
# Return appropriate response type.
|
177
185
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
178
186
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
179
|
-
ApiResponse.new(
|
187
|
+
ApiResponse.new(
|
188
|
+
_response, data: decoded, errors: _errors
|
189
|
+
)
|
180
190
|
end
|
181
191
|
end
|
182
192
|
end
|
@@ -9,8 +9,8 @@ module Square
|
|
9
9
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
10
10
|
# previous calls to __ListCustomerSegments__. Used to retrieve the next set
|
11
11
|
# of query results. See the [Pagination
|
12
|
-
# guide](https://developer.squareup.com/docs/
|
13
|
-
#
|
12
|
+
# guide](https://developer.squareup.com/docs/working-with-apis/pagination)
|
13
|
+
# for more information.
|
14
14
|
# @return [ListCustomerSegmentsResponse Hash] response from the API call
|
15
15
|
def list_customer_segments(cursor: nil)
|
16
16
|
# Prepare query url.
|
@@ -38,7 +38,9 @@ module Square
|
|
38
38
|
# Return appropriate response type.
|
39
39
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
40
40
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
41
|
-
ApiResponse.new(
|
41
|
+
ApiResponse.new(
|
42
|
+
_response, data: decoded, errors: _errors
|
43
|
+
)
|
42
44
|
end
|
43
45
|
|
44
46
|
# Retrieves a specific customer segment as identified by the `segment_id`
|
@@ -52,7 +54,7 @@ module Square
|
|
52
54
|
_query_builder << '/v2/customers/segments/{segment_id}'
|
53
55
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
54
56
|
_query_builder,
|
55
|
-
'segment_id' => segment_id
|
57
|
+
'segment_id' => { 'value' => segment_id, 'encode' => true }
|
56
58
|
)
|
57
59
|
_query_url = APIHelper.clean_url _query_builder
|
58
60
|
|
@@ -72,7 +74,9 @@ module Square
|
|
72
74
|
# Return appropriate response type.
|
73
75
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
74
76
|
_errors = APIHelper.map_response(decoded, ['errors'])
|
75
|
-
ApiResponse.new(
|
77
|
+
ApiResponse.new(
|
78
|
+
_response, data: decoded, errors: _errors
|
79
|
+
)
|
76
80
|
end
|
77
81
|
end
|
78
82
|
end
|