square.rb 26.2.0.20230315 → 28.0.0.20230517
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/booking_custom_attributes_api.rb +7 -7
- data/lib/square/api/bookings_api.rb +7 -5
- data/lib/square/api/cards_api.rb +2 -2
- data/lib/square/api/catalog_api.rb +3 -3
- data/lib/square/api/checkout_api.rb +1 -1
- data/lib/square/api/customer_custom_attributes_api.rb +7 -7
- data/lib/square/api/disputes_api.rb +2 -2
- data/lib/square/api/gift_card_activities_api.rb +1 -1
- data/lib/square/api/gift_cards_api.rb +6 -5
- data/lib/square/api/inventory_api.rb +25 -25
- data/lib/square/api/invoices_api.rb +6 -6
- data/lib/square/api/location_custom_attributes_api.rb +7 -7
- data/lib/square/api/loyalty_api.rb +24 -23
- data/lib/square/api/merchant_custom_attributes_api.rb +419 -0
- data/lib/square/api/order_custom_attributes_api.rb +6 -6
- data/lib/square/api/payments_api.rb +12 -9
- data/lib/square/api/payouts_api.rb +7 -7
- data/lib/square/api/refunds_api.rb +13 -11
- data/lib/square/api/transactions_api.rb +2 -2
- data/lib/square/api/vendors_api.rb +1 -1
- data/lib/square/api/webhook_subscriptions_api.rb +11 -11
- data/lib/square/client.rb +8 -2
- data/lib/square/configuration.rb +1 -1
- data/lib/square.rb +1 -0
- metadata +3 -2
@@ -0,0 +1,419 @@
|
|
1
|
+
module Square
|
2
|
+
# MerchantCustomAttributesApi
|
3
|
+
class MerchantCustomAttributesApi < BaseApi
|
4
|
+
# Lists the merchant-related [custom attribute
|
5
|
+
# definitions]($m/CustomAttributeDefinition) that belong to a Square seller
|
6
|
+
# account.
|
7
|
+
# When all response pages are retrieved, the results include all custom
|
8
|
+
# attribute definitions
|
9
|
+
# that are visible to the requesting application, including those that are
|
10
|
+
# created by other
|
11
|
+
# applications and set to `VISIBILITY_READ_ONLY` or
|
12
|
+
# `VISIBILITY_READ_WRITE_VALUES`.
|
13
|
+
# @param [VisibilityFilter] visibility_filter Optional parameter: Filters
|
14
|
+
# the `CustomAttributeDefinition` results by their `visibility` values.
|
15
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
16
|
+
# to return in a single paged response. This limit is advisory. The response
|
17
|
+
# might contain more or fewer results. The minimum value is 1 and the
|
18
|
+
# maximum value is 100. The default value is 20. For more information, see
|
19
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
20
|
+
# atterns/pagination).
|
21
|
+
# @param [String] cursor Optional parameter: The cursor returned in the
|
22
|
+
# paged response from the previous call to this endpoint. Provide this
|
23
|
+
# cursor to retrieve the next page of results for your original request. For
|
24
|
+
# more information, see
|
25
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
26
|
+
# atterns/pagination).
|
27
|
+
# @return [ListMerchantCustomAttributeDefinitionsResponse Hash] response from the API call
|
28
|
+
def list_merchant_custom_attribute_definitions(visibility_filter: nil,
|
29
|
+
limit: nil,
|
30
|
+
cursor: nil)
|
31
|
+
new_api_call_builder
|
32
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
33
|
+
'/v2/merchants/custom-attribute-definitions',
|
34
|
+
'default')
|
35
|
+
.query_param(new_parameter(visibility_filter, key: 'visibility_filter'))
|
36
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
37
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
38
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
39
|
+
.auth(Single.new('global')))
|
40
|
+
.response(new_response_handler
|
41
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
42
|
+
.is_api_response(true)
|
43
|
+
.convertor(ApiResponse.method(:create)))
|
44
|
+
.execute
|
45
|
+
end
|
46
|
+
|
47
|
+
# Creates a merchant-related [custom attribute
|
48
|
+
# definition]($m/CustomAttributeDefinition) for a Square seller account.
|
49
|
+
# Use this endpoint to define a custom attribute that can be associated with
|
50
|
+
# a merchant connecting to your application.
|
51
|
+
# A custom attribute definition specifies the `key`, `visibility`, `schema`,
|
52
|
+
# and other properties
|
53
|
+
# for a custom attribute. After the definition is created, you can call
|
54
|
+
# [UpsertMerchantCustomAttribute]($e/MerchantCustomAttributes/UpsertMerchant
|
55
|
+
# CustomAttribute) or
|
56
|
+
# [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpser
|
57
|
+
# tMerchantCustomAttributes)
|
58
|
+
# to set the custom attribute for a merchant.
|
59
|
+
# @param [CreateMerchantCustomAttributeDefinitionRequest] body Required
|
60
|
+
# parameter: An object containing the fields to POST for the request. See
|
61
|
+
# the corresponding object definition for field details.
|
62
|
+
# @return [CreateMerchantCustomAttributeDefinitionResponse Hash] response from the API call
|
63
|
+
def create_merchant_custom_attribute_definition(body:)
|
64
|
+
new_api_call_builder
|
65
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
66
|
+
'/v2/merchants/custom-attribute-definitions',
|
67
|
+
'default')
|
68
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
69
|
+
.body_param(new_parameter(body))
|
70
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
71
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
72
|
+
.auth(Single.new('global')))
|
73
|
+
.response(new_response_handler
|
74
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
75
|
+
.is_api_response(true)
|
76
|
+
.convertor(ApiResponse.method(:create)))
|
77
|
+
.execute
|
78
|
+
end
|
79
|
+
|
80
|
+
# Deletes a merchant-related [custom attribute
|
81
|
+
# definition]($m/CustomAttributeDefinition) from a Square seller account.
|
82
|
+
# Deleting a custom attribute definition also deletes the corresponding
|
83
|
+
# custom attribute from
|
84
|
+
# the merchant.
|
85
|
+
# Only the definition owner can delete a custom attribute definition.
|
86
|
+
# @param [String] key Required parameter: The key of the custom attribute
|
87
|
+
# definition to delete.
|
88
|
+
# @return [DeleteMerchantCustomAttributeDefinitionResponse Hash] response from the API call
|
89
|
+
def delete_merchant_custom_attribute_definition(key:)
|
90
|
+
new_api_call_builder
|
91
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
92
|
+
'/v2/merchants/custom-attribute-definitions/{key}',
|
93
|
+
'default')
|
94
|
+
.template_param(new_parameter(key, key: 'key')
|
95
|
+
.should_encode(true))
|
96
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
97
|
+
.auth(Single.new('global')))
|
98
|
+
.response(new_response_handler
|
99
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
100
|
+
.is_api_response(true)
|
101
|
+
.convertor(ApiResponse.method(:create)))
|
102
|
+
.execute
|
103
|
+
end
|
104
|
+
|
105
|
+
# Retrieves a merchant-related [custom attribute
|
106
|
+
# definition]($m/CustomAttributeDefinition) from a Square seller account.
|
107
|
+
# To retrieve a custom attribute definition created by another application,
|
108
|
+
# the `visibility`
|
109
|
+
# setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
|
110
|
+
# @param [String] key Required parameter: The key of the custom attribute
|
111
|
+
# definition to retrieve. If the requesting application is not the
|
112
|
+
# definition owner, you must use the qualified key.
|
113
|
+
# @param [Integer] version Optional parameter: The current version of the
|
114
|
+
# custom attribute definition, which is used for strongly consistent reads
|
115
|
+
# to guarantee that you receive the most up-to-date data. When included in
|
116
|
+
# the request, Square returns the specified version or a higher version if
|
117
|
+
# one exists. If the specified version is higher than the current version,
|
118
|
+
# Square returns a `BAD_REQUEST` error.
|
119
|
+
# @return [RetrieveMerchantCustomAttributeDefinitionResponse Hash] response from the API call
|
120
|
+
def retrieve_merchant_custom_attribute_definition(key:,
|
121
|
+
version: nil)
|
122
|
+
new_api_call_builder
|
123
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
124
|
+
'/v2/merchants/custom-attribute-definitions/{key}',
|
125
|
+
'default')
|
126
|
+
.template_param(new_parameter(key, key: 'key')
|
127
|
+
.should_encode(true))
|
128
|
+
.query_param(new_parameter(version, key: 'version'))
|
129
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
130
|
+
.auth(Single.new('global')))
|
131
|
+
.response(new_response_handler
|
132
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
133
|
+
.is_api_response(true)
|
134
|
+
.convertor(ApiResponse.method(:create)))
|
135
|
+
.execute
|
136
|
+
end
|
137
|
+
|
138
|
+
# Updates a merchant-related [custom attribute
|
139
|
+
# definition]($m/CustomAttributeDefinition) for a Square seller account.
|
140
|
+
# Use this endpoint to update the following fields: `name`, `description`,
|
141
|
+
# `visibility`, or the
|
142
|
+
# `schema` for a `Selection` data type.
|
143
|
+
# Only the definition owner can update a custom attribute definition.
|
144
|
+
# @param [String] key Required parameter: The key of the custom attribute
|
145
|
+
# definition to update.
|
146
|
+
# @param [UpdateMerchantCustomAttributeDefinitionRequest] body Required
|
147
|
+
# parameter: An object containing the fields to POST for the request. See
|
148
|
+
# the corresponding object definition for field details.
|
149
|
+
# @return [UpdateMerchantCustomAttributeDefinitionResponse Hash] response from the API call
|
150
|
+
def update_merchant_custom_attribute_definition(key:,
|
151
|
+
body:)
|
152
|
+
new_api_call_builder
|
153
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
154
|
+
'/v2/merchants/custom-attribute-definitions/{key}',
|
155
|
+
'default')
|
156
|
+
.template_param(new_parameter(key, key: 'key')
|
157
|
+
.should_encode(true))
|
158
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
159
|
+
.body_param(new_parameter(body))
|
160
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
161
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
162
|
+
.auth(Single.new('global')))
|
163
|
+
.response(new_response_handler
|
164
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
165
|
+
.is_api_response(true)
|
166
|
+
.convertor(ApiResponse.method(:create)))
|
167
|
+
.execute
|
168
|
+
end
|
169
|
+
|
170
|
+
# Deletes [custom attributes]($m/CustomAttribute) for a merchant as a bulk
|
171
|
+
# operation.
|
172
|
+
# To delete a custom attribute owned by another application, the
|
173
|
+
# `visibility` setting must be
|
174
|
+
# `VISIBILITY_READ_WRITE_VALUES`.
|
175
|
+
# @param [BulkDeleteMerchantCustomAttributesRequest] body Required
|
176
|
+
# parameter: An object containing the fields to POST for the request. See
|
177
|
+
# the corresponding object definition for field details.
|
178
|
+
# @return [BulkDeleteMerchantCustomAttributesResponse Hash] response from the API call
|
179
|
+
def bulk_delete_merchant_custom_attributes(body:)
|
180
|
+
new_api_call_builder
|
181
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
182
|
+
'/v2/merchants/custom-attributes/bulk-delete',
|
183
|
+
'default')
|
184
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
185
|
+
.body_param(new_parameter(body))
|
186
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
187
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
188
|
+
.auth(Single.new('global')))
|
189
|
+
.response(new_response_handler
|
190
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
191
|
+
.is_api_response(true)
|
192
|
+
.convertor(ApiResponse.method(:create)))
|
193
|
+
.execute
|
194
|
+
end
|
195
|
+
|
196
|
+
# Creates or updates [custom attributes]($m/CustomAttribute) for a merchant
|
197
|
+
# as a bulk operation.
|
198
|
+
# Use this endpoint to set the value of one or more custom attributes for a
|
199
|
+
# merchant.
|
200
|
+
# A custom attribute is based on a custom attribute definition in a Square
|
201
|
+
# seller account, which is
|
202
|
+
# created using the
|
203
|
+
# [CreateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/Crea
|
204
|
+
# teMerchantCustomAttributeDefinition) endpoint.
|
205
|
+
# This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to
|
206
|
+
# 25 individual upsert
|
207
|
+
# requests and returns a map of individual upsert responses. Each upsert
|
208
|
+
# request has a unique ID
|
209
|
+
# and provides a merchant ID and custom attribute. Each upsert response is
|
210
|
+
# returned with the ID
|
211
|
+
# of the corresponding request.
|
212
|
+
# To create or update a custom attribute owned by another application, the
|
213
|
+
# `visibility` setting
|
214
|
+
# must be `VISIBILITY_READ_WRITE_VALUES`.
|
215
|
+
# @param [BulkUpsertMerchantCustomAttributesRequest] body Required
|
216
|
+
# parameter: An object containing the fields to POST for the request. See
|
217
|
+
# the corresponding object definition for field details.
|
218
|
+
# @return [BulkUpsertMerchantCustomAttributesResponse Hash] response from the API call
|
219
|
+
def bulk_upsert_merchant_custom_attributes(body:)
|
220
|
+
new_api_call_builder
|
221
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
222
|
+
'/v2/merchants/custom-attributes/bulk-upsert',
|
223
|
+
'default')
|
224
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
225
|
+
.body_param(new_parameter(body))
|
226
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
227
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
228
|
+
.auth(Single.new('global')))
|
229
|
+
.response(new_response_handler
|
230
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
231
|
+
.is_api_response(true)
|
232
|
+
.convertor(ApiResponse.method(:create)))
|
233
|
+
.execute
|
234
|
+
end
|
235
|
+
|
236
|
+
# Lists the [custom attributes]($m/CustomAttribute) associated with a
|
237
|
+
# merchant.
|
238
|
+
# You can use the `with_definitions` query parameter to also retrieve custom
|
239
|
+
# attribute definitions
|
240
|
+
# in the same call.
|
241
|
+
# When all response pages are retrieved, the results include all custom
|
242
|
+
# attributes that are
|
243
|
+
# visible to the requesting application, including those that are owned by
|
244
|
+
# other applications
|
245
|
+
# and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
|
246
|
+
# @param [String] merchant_id Required parameter: The ID of the target
|
247
|
+
# [merchant](entity:Merchant).
|
248
|
+
# @param [VisibilityFilter] visibility_filter Optional parameter: Filters
|
249
|
+
# the `CustomAttributeDefinition` results by their `visibility` values.
|
250
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
251
|
+
# to return in a single paged response. This limit is advisory. The response
|
252
|
+
# might contain more or fewer results. The minimum value is 1 and the
|
253
|
+
# maximum value is 100. The default value is 20. For more information, see
|
254
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
255
|
+
# atterns/pagination).
|
256
|
+
# @param [String] cursor Optional parameter: The cursor returned in the
|
257
|
+
# paged response from the previous call to this endpoint. Provide this
|
258
|
+
# cursor to retrieve the next page of results for your original request. For
|
259
|
+
# more information, see
|
260
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
261
|
+
# atterns/pagination).
|
262
|
+
# @param [TrueClass|FalseClass] with_definitions Optional parameter:
|
263
|
+
# Indicates whether to return the [custom attribute
|
264
|
+
# definition](entity:CustomAttributeDefinition) in the `definition` field of
|
265
|
+
# each custom attribute. Set this parameter to `true` to get the name and
|
266
|
+
# description of each custom attribute, information about the data type, or
|
267
|
+
# other definition details. The default value is `false`.
|
268
|
+
# @return [ListMerchantCustomAttributesResponse Hash] response from the API call
|
269
|
+
def list_merchant_custom_attributes(merchant_id:,
|
270
|
+
visibility_filter: nil,
|
271
|
+
limit: nil,
|
272
|
+
cursor: nil,
|
273
|
+
with_definitions: false)
|
274
|
+
new_api_call_builder
|
275
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
276
|
+
'/v2/merchants/{merchant_id}/custom-attributes',
|
277
|
+
'default')
|
278
|
+
.template_param(new_parameter(merchant_id, key: 'merchant_id')
|
279
|
+
.should_encode(true))
|
280
|
+
.query_param(new_parameter(visibility_filter, key: 'visibility_filter'))
|
281
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
282
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
283
|
+
.query_param(new_parameter(with_definitions, key: 'with_definitions'))
|
284
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
285
|
+
.auth(Single.new('global')))
|
286
|
+
.response(new_response_handler
|
287
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
288
|
+
.is_api_response(true)
|
289
|
+
.convertor(ApiResponse.method(:create)))
|
290
|
+
.execute
|
291
|
+
end
|
292
|
+
|
293
|
+
# Deletes a [custom attribute]($m/CustomAttribute) associated with a
|
294
|
+
# merchant.
|
295
|
+
# To delete a custom attribute owned by another application, the
|
296
|
+
# `visibility` setting must be
|
297
|
+
# `VISIBILITY_READ_WRITE_VALUES`.
|
298
|
+
# @param [String] merchant_id Required parameter: The ID of the target
|
299
|
+
# [merchant](entity:Merchant).
|
300
|
+
# @param [String] key Required parameter: The key of the custom attribute to
|
301
|
+
# delete. This key must match the `key` of a custom attribute definition in
|
302
|
+
# the Square seller account. If the requesting application is not the
|
303
|
+
# definition owner, you must use the qualified key.
|
304
|
+
# @return [DeleteMerchantCustomAttributeResponse Hash] response from the API call
|
305
|
+
def delete_merchant_custom_attribute(merchant_id:,
|
306
|
+
key:)
|
307
|
+
new_api_call_builder
|
308
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
309
|
+
'/v2/merchants/{merchant_id}/custom-attributes/{key}',
|
310
|
+
'default')
|
311
|
+
.template_param(new_parameter(merchant_id, key: 'merchant_id')
|
312
|
+
.should_encode(true))
|
313
|
+
.template_param(new_parameter(key, key: 'key')
|
314
|
+
.should_encode(true))
|
315
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
316
|
+
.auth(Single.new('global')))
|
317
|
+
.response(new_response_handler
|
318
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
319
|
+
.is_api_response(true)
|
320
|
+
.convertor(ApiResponse.method(:create)))
|
321
|
+
.execute
|
322
|
+
end
|
323
|
+
|
324
|
+
# Retrieves a [custom attribute]($m/CustomAttribute) associated with a
|
325
|
+
# merchant.
|
326
|
+
# You can use the `with_definition` query parameter to also retrieve the
|
327
|
+
# custom attribute definition
|
328
|
+
# in the same call.
|
329
|
+
# To retrieve a custom attribute owned by another application, the
|
330
|
+
# `visibility` setting must be
|
331
|
+
# `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
|
332
|
+
# @param [String] merchant_id Required parameter: The ID of the target
|
333
|
+
# [merchant](entity:Merchant).
|
334
|
+
# @param [String] key Required parameter: The key of the custom attribute to
|
335
|
+
# retrieve. This key must match the `key` of a custom attribute definition
|
336
|
+
# in the Square seller account. If the requesting application is not the
|
337
|
+
# definition owner, you must use the qualified key.
|
338
|
+
# @param [TrueClass|FalseClass] with_definition Optional parameter:
|
339
|
+
# Indicates whether to return the [custom attribute
|
340
|
+
# definition](entity:CustomAttributeDefinition) in the `definition` field of
|
341
|
+
# the custom attribute. Set this parameter to `true` to get the name and
|
342
|
+
# description of the custom attribute, information about the data type, or
|
343
|
+
# other definition details. The default value is `false`.
|
344
|
+
# @param [Integer] version Optional parameter: The current version of the
|
345
|
+
# custom attribute, which is used for strongly consistent reads to guarantee
|
346
|
+
# that you receive the most up-to-date data. When included in the request,
|
347
|
+
# Square returns the specified version or a higher version if one exists. If
|
348
|
+
# the specified version is higher than the current version, Square returns a
|
349
|
+
# `BAD_REQUEST` error.
|
350
|
+
# @return [RetrieveMerchantCustomAttributeResponse Hash] response from the API call
|
351
|
+
def retrieve_merchant_custom_attribute(merchant_id:,
|
352
|
+
key:,
|
353
|
+
with_definition: false,
|
354
|
+
version: nil)
|
355
|
+
new_api_call_builder
|
356
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
357
|
+
'/v2/merchants/{merchant_id}/custom-attributes/{key}',
|
358
|
+
'default')
|
359
|
+
.template_param(new_parameter(merchant_id, key: 'merchant_id')
|
360
|
+
.should_encode(true))
|
361
|
+
.template_param(new_parameter(key, key: 'key')
|
362
|
+
.should_encode(true))
|
363
|
+
.query_param(new_parameter(with_definition, key: 'with_definition'))
|
364
|
+
.query_param(new_parameter(version, key: 'version'))
|
365
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
366
|
+
.auth(Single.new('global')))
|
367
|
+
.response(new_response_handler
|
368
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
369
|
+
.is_api_response(true)
|
370
|
+
.convertor(ApiResponse.method(:create)))
|
371
|
+
.execute
|
372
|
+
end
|
373
|
+
|
374
|
+
# Creates or updates a [custom attribute]($m/CustomAttribute) for a
|
375
|
+
# merchant.
|
376
|
+
# Use this endpoint to set the value of a custom attribute for a specified
|
377
|
+
# merchant.
|
378
|
+
# A custom attribute is based on a custom attribute definition in a Square
|
379
|
+
# seller account, which
|
380
|
+
# is created using the
|
381
|
+
# [CreateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/Crea
|
382
|
+
# teMerchantCustomAttributeDefinition) endpoint.
|
383
|
+
# To create or update a custom attribute owned by another application, the
|
384
|
+
# `visibility` setting
|
385
|
+
# must be `VISIBILITY_READ_WRITE_VALUES`.
|
386
|
+
# @param [String] merchant_id Required parameter: The ID of the target
|
387
|
+
# [merchant](entity:Merchant).
|
388
|
+
# @param [String] key Required parameter: The key of the custom attribute to
|
389
|
+
# create or update. This key must match the `key` of a custom attribute
|
390
|
+
# definition in the Square seller account. If the requesting application is
|
391
|
+
# not the definition owner, you must use the qualified key.
|
392
|
+
# @param [UpsertMerchantCustomAttributeRequest] body Required parameter: An
|
393
|
+
# object containing the fields to POST for the request. See the
|
394
|
+
# corresponding object definition for field details.
|
395
|
+
# @return [UpsertMerchantCustomAttributeResponse Hash] response from the API call
|
396
|
+
def upsert_merchant_custom_attribute(merchant_id:,
|
397
|
+
key:,
|
398
|
+
body:)
|
399
|
+
new_api_call_builder
|
400
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
401
|
+
'/v2/merchants/{merchant_id}/custom-attributes/{key}',
|
402
|
+
'default')
|
403
|
+
.template_param(new_parameter(merchant_id, key: 'merchant_id')
|
404
|
+
.should_encode(true))
|
405
|
+
.template_param(new_parameter(key, key: 'key')
|
406
|
+
.should_encode(true))
|
407
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
408
|
+
.body_param(new_parameter(body))
|
409
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
410
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
411
|
+
.auth(Single.new('global')))
|
412
|
+
.response(new_response_handler
|
413
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
414
|
+
.is_api_response(true)
|
415
|
+
.convertor(ApiResponse.method(:create)))
|
416
|
+
.execute
|
417
|
+
end
|
418
|
+
end
|
419
|
+
end
|
@@ -257,7 +257,7 @@ module Square
|
|
257
257
|
# other applications
|
258
258
|
# and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
|
259
259
|
# @param [String] order_id Required parameter: The ID of the target
|
260
|
-
# [order](
|
260
|
+
# [order](entity:Order).
|
261
261
|
# @param [VisibilityFilter] visibility_filter Optional parameter: Requests
|
262
262
|
# that all of the custom attributes be returned, or only those that are
|
263
263
|
# read-only or read-write.
|
@@ -276,7 +276,7 @@ module Square
|
|
276
276
|
# ion).
|
277
277
|
# @param [TrueClass|FalseClass] with_definitions Optional parameter:
|
278
278
|
# Indicates whether to return the [custom attribute
|
279
|
-
# definition](
|
279
|
+
# definition](entity:CustomAttributeDefinition) in the `definition` field of
|
280
280
|
# each custom attribute. Set this parameter to `true` to get the name and
|
281
281
|
# description of each custom attribute, information about the data type, or
|
282
282
|
# other definition details. The default value is `false`.
|
@@ -313,7 +313,7 @@ module Square
|
|
313
313
|
# (also known as custom fields) are always set to
|
314
314
|
# `VISIBILITY_READ_WRITE_VALUES`.
|
315
315
|
# @param [String] order_id Required parameter: The ID of the target
|
316
|
-
# [order](
|
316
|
+
# [order](entity:Order).
|
317
317
|
# @param [String] custom_attribute_key Required parameter: The key of the
|
318
318
|
# custom attribute to delete. This key must match the key of an existing
|
319
319
|
# custom attribute definition.
|
@@ -349,7 +349,7 @@ module Square
|
|
349
349
|
# also known as custom fields) are always set to
|
350
350
|
# `VISIBILITY_READ_WRITE_VALUES`.
|
351
351
|
# @param [String] order_id Required parameter: The ID of the target
|
352
|
-
# [order](
|
352
|
+
# [order](entity:Order).
|
353
353
|
# @param [String] custom_attribute_key Required parameter: The key of the
|
354
354
|
# custom attribute to retrieve. This key must match the key of an existing
|
355
355
|
# custom attribute definition.
|
@@ -359,7 +359,7 @@ module Square
|
|
359
359
|
# specify the current version of the custom attribute.
|
360
360
|
# @param [TrueClass|FalseClass] with_definition Optional parameter:
|
361
361
|
# Indicates whether to return the [custom attribute
|
362
|
-
# definition](
|
362
|
+
# definition](entity:CustomAttributeDefinition) in the `definition` field of
|
363
363
|
# each custom attribute. Set this parameter to `true` to get the name and
|
364
364
|
# description of each custom attribute, information about the data type, or
|
365
365
|
# other definition details. The default value is `false`.
|
@@ -402,7 +402,7 @@ module Square
|
|
402
402
|
# (also known as custom fields) are always set to
|
403
403
|
# `VISIBILITY_READ_WRITE_VALUES`.
|
404
404
|
# @param [String] order_id Required parameter: The ID of the target
|
405
|
-
# [order](
|
405
|
+
# [order](entity:Order).
|
406
406
|
# @param [String] custom_attribute_key Required parameter: The key of the
|
407
407
|
# custom attribute to create or update. This key must match the key of an
|
408
408
|
# existing custom attribute definition.
|
@@ -6,19 +6,22 @@ module Square
|
|
6
6
|
# might take several
|
7
7
|
# seconds to appear.
|
8
8
|
# The maximum results per page is 100.
|
9
|
-
# @param [String] begin_time Optional parameter:
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
9
|
+
# @param [String] begin_time Optional parameter: Indicates the start of the
|
10
|
+
# time range to retrieve payments for, in RFC 3339 format. The range is
|
11
|
+
# determined using the `created_at` field for each Payment. Inclusive.
|
12
|
+
# Default: The current time minus one year.
|
13
|
+
# @param [String] end_time Optional parameter: Indicates the end of the time
|
14
|
+
# range to retrieve payments for, in RFC 3339 format. The range is
|
15
|
+
# determined using the `created_at` field for each Payment. Default: The
|
16
|
+
# current time.
|
14
17
|
# @param [String] sort_order Optional parameter: The order in which results
|
15
|
-
# are listed
|
16
|
-
# (default).
|
18
|
+
# are listed by `Payment.created_at`: - `ASC` - Oldest to newest. - `DESC` -
|
19
|
+
# Newest to oldest (default).
|
17
20
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
18
21
|
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
19
22
|
# set of results for the original query. For more information, see
|
20
|
-
# [Pagination](https://developer.squareup.com/docs/basics/
|
21
|
-
# .
|
23
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
24
|
+
# atterns/pagination).
|
22
25
|
# @param [String] location_id Optional parameter: Limit results to the
|
23
26
|
# location supplied. By default, results are returned for the default (main)
|
24
27
|
# location associated with the seller.
|
@@ -6,7 +6,7 @@ module Square
|
|
6
6
|
# in ascending or descending order.
|
7
7
|
# To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
|
8
8
|
# @param [String] location_id Optional parameter: The ID of the location for
|
9
|
-
# which to list the payouts.
|
9
|
+
# which to list the payouts. By default, payouts are returned for the
|
10
10
|
# default (main) location associated with the seller.
|
11
11
|
# @param [PayoutStatus] status Optional parameter: If provided, only payouts
|
12
12
|
# with the given status are returned.
|
@@ -20,9 +20,9 @@ module Square
|
|
20
20
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
21
21
|
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
22
22
|
# set of results for the original query. For more information, see
|
23
|
-
# [Pagination](https://developer.squareup.com/docs/basics/
|
24
|
-
# . If request parameters change between requests,
|
25
|
-
# contain duplicates or missing records.
|
23
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
24
|
+
# atterns/pagination). If request parameters change between requests,
|
25
|
+
# subsequent results may contain duplicates or missing records.
|
26
26
|
# @param [Integer] limit Optional parameter: The maximum number of results
|
27
27
|
# to be returned in a single page. It is possible to receive fewer results
|
28
28
|
# than the specified limit on a given page. The default value of 100 is also
|
@@ -86,9 +86,9 @@ module Square
|
|
86
86
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
87
87
|
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
88
88
|
# set of results for the original query. For more information, see
|
89
|
-
# [Pagination](https://developer.squareup.com/docs/basics/
|
90
|
-
# . If request parameters change between requests,
|
91
|
-
# contain duplicates or missing records.
|
89
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
90
|
+
# atterns/pagination). If request parameters change between requests,
|
91
|
+
# subsequent results may contain duplicates or missing records.
|
92
92
|
# @param [Integer] limit Optional parameter: The maximum number of results
|
93
93
|
# to be returned in a single page. It is possible to receive fewer results
|
94
94
|
# than the specified limit on a given page. The default value of 100 is also
|
@@ -6,26 +6,28 @@ module Square
|
|
6
6
|
# might take several
|
7
7
|
# seconds to appear.
|
8
8
|
# The maximum results per page is 100.
|
9
|
-
# @param [String] begin_time Optional parameter:
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
9
|
+
# @param [String] begin_time Optional parameter: Indicates the start of the
|
10
|
+
# time range to retrieve each PaymentRefund` for, in RFC 3339 format. The
|
11
|
+
# range is determined using the `created_at` field for each `PaymentRefund`.
|
12
|
+
# Default: The current time minus one year.
|
13
|
+
# @param [String] end_time Optional parameter: Indicates the end of the time
|
14
|
+
# range to retrieve each `PaymentRefund` for, in RFC 3339 format. The
|
15
|
+
# range is determined using the `created_at` field for each `PaymentRefund`.
|
16
|
+
# Default: The current time.
|
15
17
|
# @param [String] sort_order Optional parameter: The order in which results
|
16
|
-
# are listed
|
17
|
-
# (default).
|
18
|
+
# are listed by `PaymentRefund.created_at`: - `ASC` - Oldest to newest. -
|
19
|
+
# `DESC` - Newest to oldest (default).
|
18
20
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
19
21
|
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
20
22
|
# set of results for the original query. For more information, see
|
21
|
-
# [Pagination](https://developer.squareup.com/docs/basics/
|
22
|
-
# .
|
23
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
24
|
+
# atterns/pagination).
|
23
25
|
# @param [String] location_id Optional parameter: Limit results to the
|
24
26
|
# location supplied. By default, results are returned for all locations
|
25
27
|
# associated with the seller.
|
26
28
|
# @param [String] status Optional parameter: If provided, only refunds with
|
27
29
|
# the given status are returned. For a list of refund status values, see
|
28
|
-
# [PaymentRefund](
|
30
|
+
# [PaymentRefund](entity:PaymentRefund). Default: If omitted, refunds are
|
29
31
|
# returned regardless of their status.
|
30
32
|
# @param [String] source_type Optional parameter: If provided, only returns
|
31
33
|
# refunds whose payments have the indicated source type. Current values
|
@@ -81,7 +81,7 @@ module Square
|
|
81
81
|
end
|
82
82
|
|
83
83
|
# Captures a transaction that was created with the
|
84
|
-
# [Charge](
|
84
|
+
# [Charge](api-endpoint:Transactions-Charge)
|
85
85
|
# endpoint with a `delay_capture` value of `true`.
|
86
86
|
# See [Delayed capture
|
87
87
|
# transactions](https://developer.squareup.com/docs/payments/transactions/ov
|
@@ -111,7 +111,7 @@ module Square
|
|
111
111
|
end
|
112
112
|
|
113
113
|
# Cancels a transaction that was created with the
|
114
|
-
# [Charge](
|
114
|
+
# [Charge](api-endpoint:Transactions-Charge)
|
115
115
|
# endpoint with a `delay_capture` value of `true`.
|
116
116
|
# See [Delayed capture
|
117
117
|
# transactions](https://developer.squareup.com/docs/payments/transactions/ov
|
@@ -117,7 +117,7 @@ module Square
|
|
117
117
|
|
118
118
|
# Retrieves the vendor of a specified [Vendor]($m/Vendor) ID.
|
119
119
|
# @param [String] vendor_id Required parameter: ID of the
|
120
|
-
# [Vendor](
|
120
|
+
# [Vendor](entity:Vendor) to retrieve.
|
121
121
|
# @return [RetrieveVendorResponse Hash] response from the API call
|
122
122
|
def retrieve_vendor(vendor_id:)
|
123
123
|
new_api_call_builder
|