square.rb 27.0.0.20230419 → 29.0.0.20230608
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/o_auth_api.rb +5 -5
- data/lib/square/api/subscriptions_api.rb +23 -19
- data/lib/square/api/terminal_api.rb +26 -2
- 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: 6f8d15edb9a8dd68b46a879c0afacf648c322c9e31373fce770c109b4dfae6b6
|
4
|
+
data.tar.gz: 892d648f4b7bfe44d6fb162e13d544867df6a8b6e3b173f5ca516ca78aa3e3e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b83f14d0f0291d461b694c853e38bad88b508a1bbab94df7faac7a550ddd99e499bba08882b4ce82a194eefeae64b5515481a708c6194dfcefa40c2b85eb98e
|
7
|
+
data.tar.gz: 169dc96d375401735be90799acb4b08e96199286a4ec89395015edfcc28736bde58e8e4ed41e784d97e8e5652287a6e96ffd0cc0e6aa8515eebe0fcaf988cb72
|
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/29.0.0.20230608 ({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
|
@@ -20,10 +20,10 @@ module Square
|
|
20
20
|
# Authorization: Client APPLICATION_SECRET
|
21
21
|
# ```
|
22
22
|
# Replace `APPLICATION_SECRET` with the application secret on the
|
23
|
-
# Credentials
|
23
|
+
# **Credentials**
|
24
24
|
# page in the [Developer Dashboard](https://developer.squareup.com/apps).
|
25
25
|
# @param [String] client_id Required parameter: Your application ID, which
|
26
|
-
# is available
|
26
|
+
# is available on the **OAuth** page in the [Developer
|
27
27
|
# Dashboard](https://developer.squareup.com/apps).
|
28
28
|
# @param [RenewTokenRequest] body Required parameter: An object containing
|
29
29
|
# the fields to POST for the request. See the corresponding object
|
@@ -65,8 +65,8 @@ module Square
|
|
65
65
|
# ```
|
66
66
|
# Authorization: Client APPLICATION_SECRET
|
67
67
|
# ```
|
68
|
-
# Replace `APPLICATION_SECRET` with the application secret on the OAuth
|
69
|
-
# page for your application
|
68
|
+
# Replace `APPLICATION_SECRET` with the application secret on the **OAuth**
|
69
|
+
# page for your application in the Developer Dashboard.
|
70
70
|
# @param [RevokeTokenRequest] body Required parameter: An object containing
|
71
71
|
# the fields to POST for the request. See the corresponding object
|
72
72
|
# definition for field details.
|
@@ -97,7 +97,7 @@ module Square
|
|
97
97
|
# The `grant_type` parameter specifies the type of OAuth request. If
|
98
98
|
# `grant_type` is `authorization_code`, you must include the authorization
|
99
99
|
# code you received when a seller granted you authorization. If `grant_type`
|
100
|
-
# is `refresh_token`, you must provide a valid refresh token. If you
|
100
|
+
# is `refresh_token`, you must provide a valid refresh token. If you're
|
101
101
|
# using
|
102
102
|
# an old version of the Square APIs (prior to March 13, 2019), `grant_type`
|
103
103
|
# can be `migration_token` and you must provide a valid migration token.
|
@@ -1,13 +1,16 @@
|
|
1
1
|
module Square
|
2
2
|
# SubscriptionsApi
|
3
3
|
class SubscriptionsApi < BaseApi
|
4
|
-
#
|
4
|
+
# Enrolls a customer in a subscription.
|
5
5
|
# If you provide a card on file in the request, Square charges the card for
|
6
|
-
# the subscription. Otherwise, Square
|
6
|
+
# the subscription. Otherwise, Square sends an invoice to the customer's
|
7
7
|
# email
|
8
8
|
# address. The subscription starts immediately, unless the request includes
|
9
9
|
# the optional `start_date`. Each individual subscription is associated with
|
10
10
|
# a particular location.
|
11
|
+
# For more information, see [Create a
|
12
|
+
# subscription](https://developer.squareup.com/docs/subscriptions-api/manage
|
13
|
+
# -subscriptions#create-a-subscription).
|
11
14
|
# @param [CreateSubscriptionRequest] body Required parameter: An object
|
12
15
|
# containing the fields to POST for the request. See the corresponding
|
13
16
|
# object definition for field details.
|
@@ -42,10 +45,6 @@ module Square
|
|
42
45
|
# If the request specifies customer IDs, the endpoint orders results
|
43
46
|
# first by location, within location by customer ID, and within
|
44
47
|
# customer by subscription creation date.
|
45
|
-
# For more information, see
|
46
|
-
# [Retrieve
|
47
|
-
# subscriptions](https://developer.squareup.com/docs/subscriptions-api/overv
|
48
|
-
# iew#retrieve-subscriptions).
|
49
48
|
# @param [SearchSubscriptionsRequest] body Required parameter: An object
|
50
49
|
# containing the fields to POST for the request. See the corresponding
|
51
50
|
# object definition for field details.
|
@@ -67,7 +66,7 @@ module Square
|
|
67
66
|
.execute
|
68
67
|
end
|
69
68
|
|
70
|
-
# Retrieves a subscription.
|
69
|
+
# Retrieves a specific subscription.
|
71
70
|
# @param [String] subscription_id Required parameter: The ID of the
|
72
71
|
# subscription to retrieve.
|
73
72
|
# @param [String] include Optional parameter: A query parameter to specify
|
@@ -93,8 +92,9 @@ module Square
|
|
93
92
|
.execute
|
94
93
|
end
|
95
94
|
|
96
|
-
# Updates a subscription
|
97
|
-
#
|
95
|
+
# Updates a subscription by modifying or clearing `subscription` field
|
96
|
+
# values.
|
97
|
+
# To clear a field, set its value to `null`.
|
98
98
|
# @param [String] subscription_id Required parameter: The ID of the
|
99
99
|
# subscription to update.
|
100
100
|
# @param [UpdateSubscriptionRequest] body Required parameter: An object
|
@@ -146,11 +146,10 @@ module Square
|
|
146
146
|
.execute
|
147
147
|
end
|
148
148
|
|
149
|
-
# Schedules a `CANCEL` action to cancel an active subscription
|
150
|
-
#
|
151
|
-
#
|
152
|
-
#
|
153
|
-
# date.
|
149
|
+
# Schedules a `CANCEL` action to cancel an active subscription. This
|
150
|
+
# sets the `canceled_date` field to the end of the active billing period.
|
151
|
+
# After this date,
|
152
|
+
# the subscription status changes from ACTIVE to CANCELED.
|
154
153
|
# @param [String] subscription_id Required parameter: The ID of the
|
155
154
|
# subscription to cancel.
|
156
155
|
# @return [CancelSubscriptionResponse Hash] response from the API call
|
@@ -170,7 +169,9 @@ module Square
|
|
170
169
|
.execute
|
171
170
|
end
|
172
171
|
|
173
|
-
# Lists all
|
172
|
+
# Lists all
|
173
|
+
# [events](https://developer.squareup.com/docs/subscriptions-api/actions-eve
|
174
|
+
# nts) for a specific subscription.
|
174
175
|
# @param [String] subscription_id Required parameter: The ID of the
|
175
176
|
# subscription to retrieve the events for.
|
176
177
|
# @param [String] cursor Optional parameter: When the total number of
|
@@ -178,8 +179,8 @@ module Square
|
|
178
179
|
# specify the cursor returned from a preceding response here to fetch the
|
179
180
|
# next set of results. If the cursor is unset, the response contains the
|
180
181
|
# last page of the results. For more information, see
|
181
|
-
# [Pagination](https://developer.squareup.com/docs/
|
182
|
-
#
|
182
|
+
# [Pagination](https://developer.squareup.com/docs/build-basics/common-api-p
|
183
|
+
# atterns/pagination).
|
183
184
|
# @param [Integer] limit Optional parameter: The upper limit on the number
|
184
185
|
# of subscription events to return in a paged response.
|
185
186
|
# @return [ListSubscriptionEventsResponse Hash] response from the API call
|
@@ -258,8 +259,11 @@ module Square
|
|
258
259
|
.execute
|
259
260
|
end
|
260
261
|
|
261
|
-
# Schedules a `SWAP_PLAN` action to swap a subscription plan in an
|
262
|
-
# subscription.
|
262
|
+
# Schedules a `SWAP_PLAN` action to swap a subscription plan variation in an
|
263
|
+
# existing subscription.
|
264
|
+
# For more information, see [Swap Subscription Plan
|
265
|
+
# Variations](https://developer.squareup.com/docs/subscriptions-api/swap-pla
|
266
|
+
# n-variations).
|
263
267
|
# @param [String] subscription_id Required parameter: The ID of the
|
264
268
|
# subscription to swap the subscription plan for.
|
265
269
|
# @param [SwapPlanRequest] body Required parameter: An object containing the
|
@@ -50,7 +50,7 @@ module Square
|
|
50
50
|
# Retrieves a Terminal action request by `action_id`. Terminal action
|
51
51
|
# requests are available for 30 days.
|
52
52
|
# @param [String] action_id Required parameter: Unique ID for the desired
|
53
|
-
# `TerminalAction
|
53
|
+
# `TerminalAction`.
|
54
54
|
# @return [GetTerminalActionResponse Hash] response from the API call
|
55
55
|
def get_terminal_action(action_id:)
|
56
56
|
new_api_call_builder
|
@@ -70,7 +70,7 @@ module Square
|
|
70
70
|
|
71
71
|
# Cancels a Terminal action request if the status of the request permits it.
|
72
72
|
# @param [String] action_id Required parameter: Unique ID for the desired
|
73
|
-
# `TerminalAction
|
73
|
+
# `TerminalAction`.
|
74
74
|
# @return [CancelTerminalActionResponse Hash] response from the API call
|
75
75
|
def cancel_terminal_action(action_id:)
|
76
76
|
new_api_call_builder
|
@@ -88,6 +88,30 @@ module Square
|
|
88
88
|
.execute
|
89
89
|
end
|
90
90
|
|
91
|
+
# Dismisses a Terminal action request if the status and type of the request
|
92
|
+
# permits it.
|
93
|
+
# See [Link and Dismiss
|
94
|
+
# Actions](https://developer.squareup.com/docs/terminal-api/advanced-feature
|
95
|
+
# s/custom-workflows/link-and-dismiss-actions) for more details.
|
96
|
+
# @param [String] action_id Required parameter: Unique ID for the
|
97
|
+
# `TerminalAction` associated with the waiting dialog to be dismissed.
|
98
|
+
# @return [DismissTerminalActionResponse Hash] response from the API call
|
99
|
+
def dismiss_terminal_action(action_id:)
|
100
|
+
new_api_call_builder
|
101
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
102
|
+
'/v2/terminals/actions/{action_id}/dismiss',
|
103
|
+
'default')
|
104
|
+
.template_param(new_parameter(action_id, key: 'action_id')
|
105
|
+
.should_encode(true))
|
106
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
107
|
+
.auth(Single.new('global')))
|
108
|
+
.response(new_response_handler
|
109
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
110
|
+
.is_api_response(true)
|
111
|
+
.convertor(ApiResponse.method(:create)))
|
112
|
+
.execute
|
113
|
+
end
|
114
|
+
|
91
115
|
# Creates a Terminal checkout request and sends it to the specified device
|
92
116
|
# to take a payment
|
93
117
|
# for the requested amount.
|
@@ -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
|
+
'29.0.0.20230608'
|
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-06-08', 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-06-08', 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: 29.0.0.20230608
|
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-06-07 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
|