square.rb 33.0.0.20231018 → 35.0.0.20240118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/catalog_api.rb +11 -1
- data/lib/square/api/checkout_api.rb +85 -0
- data/lib/square/api/customers_api.rb +1 -1
- data/lib/square/api/invoices_api.rb +65 -0
- data/lib/square/api/terminal_api.rb +43 -1
- data/lib/square/client.rb +2 -2
- data/lib/square/configuration.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 249614d84c1818c028f583951e3fa380f1533985909801204a1ee94eb0a91733
|
4
|
+
data.tar.gz: 4ae2b2cceb63628934b529fff05bd58f2cd27d8f22ae10a44ec26e0bc40f087d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ebdb416a8041d2d70a9d8108ce432ec26f2558bc67589a5f5e5625625f4366f4998d20575e0a8ac9e872b11a37133180ee6b27d7fffc9147674ff89a638f05e
|
7
|
+
data.tar.gz: 8fe1a39713a031a36023433a9a84c7492654a28adbd1c02a5130513cfd936336ad2c9c7d53ec707623498f8fc4bc3972bd9a2c45756664d2b628350c45b0ee45
|
data/LICENSE
CHANGED
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/35.0.0.20240118 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}'
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.user_agent_parameters
|
@@ -328,10 +328,19 @@ module Square
|
|
328
328
|
# of an object can be found in the version field of
|
329
329
|
# [CatalogObject]($m/CatalogObject)s. If not included, results will be from
|
330
330
|
# the current version of the catalog.
|
331
|
+
# @param [TrueClass | FalseClass] include_category_path_to_root Optional
|
332
|
+
# parameter: Specifies whether or not to include the `path_to_root` list for
|
333
|
+
# each returned category instance. The `path_to_root` list consists of
|
334
|
+
# `CategoryPathToRootNode` objects and specifies the path that starts with
|
335
|
+
# the immediate parent category of the returned category and ends with its
|
336
|
+
# root category. If the returned category is a top-level category, the
|
337
|
+
# `path_to_root` list is empty and is not returned in the response
|
338
|
+
# payload.
|
331
339
|
# @return [RetrieveCatalogObjectResponse Hash] response from the API call
|
332
340
|
def retrieve_catalog_object(object_id:,
|
333
341
|
include_related_objects: false,
|
334
|
-
catalog_version: nil
|
342
|
+
catalog_version: nil,
|
343
|
+
include_category_path_to_root: false)
|
335
344
|
new_api_call_builder
|
336
345
|
.request(new_request_builder(HttpMethodEnum::GET,
|
337
346
|
'/v2/catalog/object/{object_id}',
|
@@ -340,6 +349,7 @@ module Square
|
|
340
349
|
.should_encode(true))
|
341
350
|
.query_param(new_parameter(include_related_objects, key: 'include_related_objects'))
|
342
351
|
.query_param(new_parameter(catalog_version, key: 'catalog_version'))
|
352
|
+
.query_param(new_parameter(include_category_path_to_root, key: 'include_category_path_to_root'))
|
343
353
|
.header_param(new_parameter('application/json', key: 'accept'))
|
344
354
|
.auth(Single.new('global')))
|
345
355
|
.response(new_response_handler
|
@@ -35,6 +35,91 @@ module Square
|
|
35
35
|
.execute
|
36
36
|
end
|
37
37
|
|
38
|
+
# Retrieves the location-level settings for a Square-hosted checkout page.
|
39
|
+
# @param [String] location_id Required parameter: The ID of the location for
|
40
|
+
# which to retrieve settings.
|
41
|
+
# @return [RetrieveLocationSettingsResponse Hash] response from the API call
|
42
|
+
def retrieve_location_settings(location_id:)
|
43
|
+
new_api_call_builder
|
44
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
45
|
+
'/v2/online-checkout/location-settings/{location_id}',
|
46
|
+
'default')
|
47
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
48
|
+
.should_encode(true))
|
49
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
50
|
+
.auth(Single.new('global')))
|
51
|
+
.response(new_response_handler
|
52
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
53
|
+
.is_api_response(true)
|
54
|
+
.convertor(ApiResponse.method(:create)))
|
55
|
+
.execute
|
56
|
+
end
|
57
|
+
|
58
|
+
# Updates the location-level settings for a Square-hosted checkout page.
|
59
|
+
# @param [String] location_id Required parameter: The ID of the location for
|
60
|
+
# which to retrieve settings.
|
61
|
+
# @param [UpdateLocationSettingsRequest] body Required parameter: An object
|
62
|
+
# containing the fields to POST for the request. See the corresponding
|
63
|
+
# object definition for field details.
|
64
|
+
# @return [UpdateLocationSettingsResponse Hash] response from the API call
|
65
|
+
def update_location_settings(location_id:,
|
66
|
+
body:)
|
67
|
+
new_api_call_builder
|
68
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
69
|
+
'/v2/online-checkout/location-settings/{location_id}',
|
70
|
+
'default')
|
71
|
+
.template_param(new_parameter(location_id, key: 'location_id')
|
72
|
+
.should_encode(true))
|
73
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
74
|
+
.body_param(new_parameter(body))
|
75
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
76
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
77
|
+
.auth(Single.new('global')))
|
78
|
+
.response(new_response_handler
|
79
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
80
|
+
.is_api_response(true)
|
81
|
+
.convertor(ApiResponse.method(:create)))
|
82
|
+
.execute
|
83
|
+
end
|
84
|
+
|
85
|
+
# Retrieves the merchant-level settings for a Square-hosted checkout page.
|
86
|
+
# @return [RetrieveMerchantSettingsResponse Hash] response from the API call
|
87
|
+
def retrieve_merchant_settings
|
88
|
+
new_api_call_builder
|
89
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
90
|
+
'/v2/online-checkout/merchant-settings',
|
91
|
+
'default')
|
92
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
93
|
+
.auth(Single.new('global')))
|
94
|
+
.response(new_response_handler
|
95
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
96
|
+
.is_api_response(true)
|
97
|
+
.convertor(ApiResponse.method(:create)))
|
98
|
+
.execute
|
99
|
+
end
|
100
|
+
|
101
|
+
# Updates the merchant-level settings for a Square-hosted checkout page.
|
102
|
+
# @param [UpdateMerchantSettingsRequest] body Required parameter: An object
|
103
|
+
# containing the fields to POST for the request. See the corresponding
|
104
|
+
# object definition for field details.
|
105
|
+
# @return [UpdateMerchantSettingsResponse Hash] response from the API call
|
106
|
+
def update_merchant_settings(body:)
|
107
|
+
new_api_call_builder
|
108
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
109
|
+
'/v2/online-checkout/merchant-settings',
|
110
|
+
'default')
|
111
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
112
|
+
.body_param(new_parameter(body))
|
113
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
114
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
115
|
+
.auth(Single.new('global')))
|
116
|
+
.response(new_response_handler
|
117
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
118
|
+
.is_api_response(true)
|
119
|
+
.convertor(ApiResponse.method(:create)))
|
120
|
+
.execute
|
121
|
+
end
|
122
|
+
|
38
123
|
# Lists all payment links.
|
39
124
|
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
40
125
|
# a previous call to this endpoint. Provide this cursor to retrieve the next
|
@@ -177,7 +177,7 @@ module Square
|
|
177
177
|
# Updates a customer profile. This endpoint supports sparse updates, so only
|
178
178
|
# new or changed fields are required in the request.
|
179
179
|
# To add or update a field, specify the new value. To remove a field,
|
180
|
-
# specify `null`
|
180
|
+
# specify `null`
|
181
181
|
# (recommended) or specify an empty string (string fields only).
|
182
182
|
# As a best practice, include the `version` field in the request to enable
|
183
183
|
# [optimistic
|
@@ -171,6 +171,71 @@ module Square
|
|
171
171
|
.execute
|
172
172
|
end
|
173
173
|
|
174
|
+
# Uploads a file and attaches it to an invoice. This endpoint accepts HTTP
|
175
|
+
# multipart/form-data file uploads
|
176
|
+
# with a JSON `request` part and a `file` part. The `file` part must be a
|
177
|
+
# `readable stream` that contains a file
|
178
|
+
# in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF.
|
179
|
+
# Invoices can have up to 10 attachments with a total file size of 25 MB.
|
180
|
+
# Attachments can be added only to invoices
|
181
|
+
# in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
|
182
|
+
# @param [String] invoice_id Required parameter: The ID of the
|
183
|
+
# [invoice](entity:Invoice) to attach the file to.
|
184
|
+
# @param [CreateInvoiceAttachmentRequest] request Optional parameter:
|
185
|
+
# Represents a
|
186
|
+
# [CreateInvoiceAttachment]($e/Invoices/CreateInvoiceAttachment) request.
|
187
|
+
# @param [File | UploadIO] image_file Optional parameter: Example:
|
188
|
+
# @return [CreateInvoiceAttachmentResponse Hash] response from the API call
|
189
|
+
def create_invoice_attachment(invoice_id:,
|
190
|
+
request: nil,
|
191
|
+
image_file: nil)
|
192
|
+
new_api_call_builder
|
193
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
194
|
+
'/v2/invoices/{invoice_id}/attachments',
|
195
|
+
'default')
|
196
|
+
.template_param(new_parameter(invoice_id, key: 'invoice_id')
|
197
|
+
.should_encode(true))
|
198
|
+
.multipart_param(new_parameter(StringIO.new(request.to_json), key: 'request')
|
199
|
+
.default_content_type('application/json; charset=utf-8'))
|
200
|
+
.multipart_param(new_parameter(image_file, key: 'image_file')
|
201
|
+
.default_content_type('image/jpeg'))
|
202
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
203
|
+
.auth(Single.new('global')))
|
204
|
+
.response(new_response_handler
|
205
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
206
|
+
.is_api_response(true)
|
207
|
+
.convertor(ApiResponse.method(:create)))
|
208
|
+
.execute
|
209
|
+
end
|
210
|
+
|
211
|
+
# Removes an attachment from an invoice and permanently deletes the file.
|
212
|
+
# Attachments can be removed only
|
213
|
+
# from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID`
|
214
|
+
# state.
|
215
|
+
# @param [String] invoice_id Required parameter: The ID of the
|
216
|
+
# [invoice](entity:Invoice) to delete the attachment from.
|
217
|
+
# @param [String] attachment_id Required parameter: The ID of the
|
218
|
+
# [attachment](entity:InvoiceAttachment) to delete.
|
219
|
+
# @return [DeleteInvoiceAttachmentResponse Hash] response from the API call
|
220
|
+
def delete_invoice_attachment(invoice_id:,
|
221
|
+
attachment_id:)
|
222
|
+
new_api_call_builder
|
223
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
224
|
+
'/v2/invoices/{invoice_id}/attachments/{attachment_id}',
|
225
|
+
'default')
|
226
|
+
.template_param(new_parameter(invoice_id, key: 'invoice_id')
|
227
|
+
.should_encode(true))
|
228
|
+
.template_param(new_parameter(attachment_id, key: 'attachment_id')
|
229
|
+
.should_encode(true))
|
230
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
231
|
+
.auth(Single.new('global')))
|
232
|
+
.response(new_response_handler
|
233
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
234
|
+
.is_api_response(true)
|
235
|
+
.convertor(ApiResponse.method(:create)))
|
236
|
+
.execute
|
237
|
+
end
|
238
|
+
|
174
239
|
# Cancels an invoice. The seller cannot collect payments for
|
175
240
|
# the canceled invoice.
|
176
241
|
# You cannot cancel an invoice in the `DRAFT` state or in a terminal state:
|
@@ -94,7 +94,7 @@ module Square
|
|
94
94
|
# Actions](https://developer.squareup.com/docs/terminal-api/advanced-feature
|
95
95
|
# s/custom-workflows/link-and-dismiss-actions) for more details.
|
96
96
|
# @param [String] action_id Required parameter: Unique ID for the
|
97
|
-
# `TerminalAction` associated with the
|
97
|
+
# `TerminalAction` associated with the action to be dismissed.
|
98
98
|
# @return [DismissTerminalActionResponse Hash] response from the API call
|
99
99
|
def dismiss_terminal_action(action_id:)
|
100
100
|
new_api_call_builder
|
@@ -203,6 +203,27 @@ module Square
|
|
203
203
|
.execute
|
204
204
|
end
|
205
205
|
|
206
|
+
# Dismisses a Terminal checkout request if the status and type of the
|
207
|
+
# request permits it.
|
208
|
+
# @param [String] checkout_id Required parameter: Unique ID for the
|
209
|
+
# `TerminalCheckout` associated with the checkout to be dismissed.
|
210
|
+
# @return [DismissTerminalCheckoutResponse Hash] response from the API call
|
211
|
+
def dismiss_terminal_checkout(checkout_id:)
|
212
|
+
new_api_call_builder
|
213
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
214
|
+
'/v2/terminals/checkouts/{checkout_id}/dismiss',
|
215
|
+
'default')
|
216
|
+
.template_param(new_parameter(checkout_id, key: 'checkout_id')
|
217
|
+
.should_encode(true))
|
218
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
219
|
+
.auth(Single.new('global')))
|
220
|
+
.response(new_response_handler
|
221
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
222
|
+
.is_api_response(true)
|
223
|
+
.convertor(ApiResponse.method(:create)))
|
224
|
+
.execute
|
225
|
+
end
|
226
|
+
|
206
227
|
# Creates a request to refund an Interac payment completed on a Square
|
207
228
|
# Terminal. Refunds for Interac payments on a Square Terminal are supported
|
208
229
|
# only for Interac debit cards in Canada. Other refunds for Terminal
|
@@ -294,5 +315,26 @@ module Square
|
|
294
315
|
.convertor(ApiResponse.method(:create)))
|
295
316
|
.execute
|
296
317
|
end
|
318
|
+
|
319
|
+
# Dismisses a Terminal refund request if the status and type of the request
|
320
|
+
# permits it.
|
321
|
+
# @param [String] terminal_refund_id Required parameter: Unique ID for the
|
322
|
+
# `TerminalRefund` associated with the refund to be dismissed.
|
323
|
+
# @return [DismissTerminalRefundResponse Hash] response from the API call
|
324
|
+
def dismiss_terminal_refund(terminal_refund_id:)
|
325
|
+
new_api_call_builder
|
326
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
327
|
+
'/v2/terminals/refunds/{terminal_refund_id}/dismiss',
|
328
|
+
'default')
|
329
|
+
.template_param(new_parameter(terminal_refund_id, key: 'terminal_refund_id')
|
330
|
+
.should_encode(true))
|
331
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
332
|
+
.auth(Single.new('global')))
|
333
|
+
.response(new_response_handler
|
334
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
335
|
+
.is_api_response(true)
|
336
|
+
.convertor(ApiResponse.method(:create)))
|
337
|
+
.execute
|
338
|
+
end
|
297
339
|
end
|
298
340
|
end
|
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
|
+
'35.0.0.20240118'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -267,7 +267,7 @@ module Square
|
|
267
267
|
retry_methods: %i[get put], http_callback: nil,
|
268
268
|
environment: 'production',
|
269
269
|
custom_url: 'https://connect.squareup.com', access_token: '',
|
270
|
-
square_version: '
|
270
|
+
square_version: '2024-01-18', user_agent_detail: '',
|
271
271
|
additional_headers: {}, config: nil)
|
272
272
|
@config = if config.nil?
|
273
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: '
|
22
|
+
square_version: '2024-01-18', user_agent_detail: '',
|
23
23
|
additional_headers: {})
|
24
24
|
|
25
25
|
super connection: connection, adapter: adapter, timeout: timeout,
|
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: 35.0.0.20240118
|
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:
|
11
|
+
date: 2024-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apimatic_core_interfaces
|