square.rb 27.0.0.20230419 → 28.0.0.20230517
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/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/invoices_api.rb +2 -2
- data/lib/square/api/merchant_custom_attributes_api.rb +419 -0
- data/lib/square/api/webhook_subscriptions_api.rb +2 -2
- data/lib/square/client.rb +8 -2
- data/lib/square/configuration.rb +1 -1
- data/lib/square.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aad233be99bfca2993a00a7c626631d148ed55b31b1e066374f4140f24e39d8
|
4
|
+
data.tar.gz: 495f1f8e3090fdcff82d59bb5f3a107d6e3041054c84ab025a6f10349bfc0103
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08e41c2920e1801d7a40ec683df94518d41b00953c46079de8749dd8f1c6a207750f17ea001d4e293d8cd493dee568b7d23204e2e60c9a864bf25933841bd1a0'
|
7
|
+
data.tar.gz: e6f513724723fd25e7009dff20d565ce765b20312496409822bd492a96157c71e5c31eb207b2508faa75e9d5f8d424cc43bf670c19626fdfe6dae7bf9f78a3b2
|
data/lib/square/api/base_api.rb
CHANGED
@@ -4,7 +4,7 @@ module Square
|
|
4
4
|
attr_accessor :config, :http_call_back
|
5
5
|
|
6
6
|
def self.user_agent
|
7
|
-
'Square-Ruby-SDK/
|
7
|
+
'Square-Ruby-SDK/28.0.0.20230517 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.user_agent_parameters
|
@@ -9,8 +9,8 @@ module Square
|
|
9
9
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
10
10
|
# a previous call to this endpoint. Provide this cursor to retrieve the
|
11
11
|
# next set of results for your original query. For more information, see
|
12
|
-
# [Pagination](https://developer.squareup.com/docs/
|
13
|
-
#
|
12
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
13
|
+
# atterns/pagination).
|
14
14
|
# @param [Integer] limit Optional parameter: The maximum number of invoices
|
15
15
|
# to return (200 is the maximum `limit`). If not provided, the server uses
|
16
16
|
# a default limit of 100 invoices.
|
@@ -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
|
@@ -25,8 +25,8 @@ module Square
|
|
25
25
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
26
26
|
# a previous call to this endpoint. Provide this to retrieve the next set of
|
27
27
|
# results for your original query. For more information, see
|
28
|
-
# [Pagination](https://developer.squareup.com/docs/basics/
|
29
|
-
# .
|
28
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
29
|
+
# atterns/pagination).
|
30
30
|
# @param [TrueClass|FalseClass] include_disabled Optional parameter:
|
31
31
|
# Includes disabled [Subscription](entity:WebhookSubscription)s. By default,
|
32
32
|
# all enabled [Subscription](entity:WebhookSubscription)s are returned.
|
data/lib/square/client.rb
CHANGED
@@ -4,7 +4,7 @@ module Square
|
|
4
4
|
attr_reader :config, :auth_managers
|
5
5
|
|
6
6
|
def sdk_version
|
7
|
-
'
|
7
|
+
'28.0.0.20230517'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -183,6 +183,12 @@ module Square
|
|
183
183
|
@merchants ||= MerchantsApi.new @global_configuration
|
184
184
|
end
|
185
185
|
|
186
|
+
# Access to merchant_custom_attributes controller.
|
187
|
+
# @return [MerchantCustomAttributesApi] Returns the controller instance.
|
188
|
+
def merchant_custom_attributes
|
189
|
+
@merchant_custom_attributes ||= MerchantCustomAttributesApi.new @global_configuration
|
190
|
+
end
|
191
|
+
|
186
192
|
# Access to orders controller.
|
187
193
|
# @return [OrdersApi] Returns the controller instance.
|
188
194
|
def orders
|
@@ -261,7 +267,7 @@ module Square
|
|
261
267
|
retry_methods: %i[get put], http_callback: nil,
|
262
268
|
environment: 'production',
|
263
269
|
custom_url: 'https://connect.squareup.com', access_token: '',
|
264
|
-
square_version: '2023-
|
270
|
+
square_version: '2023-05-17', user_agent_detail: '',
|
265
271
|
additional_headers: {}, config: nil)
|
266
272
|
@config = if config.nil?
|
267
273
|
Configuration.new(connection: connection, adapter: adapter,
|
data/lib/square/configuration.rb
CHANGED
@@ -19,7 +19,7 @@ module Square
|
|
19
19
|
retry_methods: %i[get put], http_callback: nil,
|
20
20
|
environment: 'production',
|
21
21
|
custom_url: 'https://connect.squareup.com', access_token: '',
|
22
|
-
square_version: '2023-
|
22
|
+
square_version: '2023-05-17', user_agent_detail: '',
|
23
23
|
additional_headers: {})
|
24
24
|
|
25
25
|
super connection: connection, adapter: adapter, timeout: timeout,
|
data/lib/square.rb
CHANGED
@@ -59,6 +59,7 @@ require_relative 'square/api/checkout_api'
|
|
59
59
|
require_relative 'square/api/transactions_api'
|
60
60
|
require_relative 'square/api/loyalty_api'
|
61
61
|
require_relative 'square/api/merchants_api'
|
62
|
+
require_relative 'square/api/merchant_custom_attributes_api'
|
62
63
|
require_relative 'square/api/orders_api'
|
63
64
|
require_relative 'square/api/order_custom_attributes_api'
|
64
65
|
require_relative 'square/api/payments_api'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: square.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 28.0.0.20230517
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Square Developer Platform
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apimatic_core_interfaces
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/square/api/location_custom_attributes_api.rb
|
121
121
|
- lib/square/api/locations_api.rb
|
122
122
|
- lib/square/api/loyalty_api.rb
|
123
|
+
- lib/square/api/merchant_custom_attributes_api.rb
|
123
124
|
- lib/square/api/merchants_api.rb
|
124
125
|
- lib/square/api/mobile_authorization_api.rb
|
125
126
|
- lib/square/api/o_auth_api.rb
|