square.rb 11.0.0.20210513 → 12.0.0.20210616
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.rb +3 -0
- data/lib/square/api/base_api.rb +1 -1
- data/lib/square/api/cards_api.rb +170 -0
- data/lib/square/api/catalog_api.rb +6 -4
- data/lib/square/api/customers_api.rb +7 -9
- data/lib/square/api/disputes_api.rb +97 -86
- data/lib/square/api/gift_card_activities_api.rb +127 -0
- data/lib/square/api/gift_cards_api.rb +291 -0
- data/lib/square/api/o_auth_api.rb +8 -9
- data/lib/square/api/team_api.rb +30 -30
- data/lib/square/api/transactions_api.rb +3 -2
- data/lib/square/client.rb +25 -3
- data/lib/square/configuration.rb +23 -8
- data/lib/square/http/faraday_client.rb +5 -2
- metadata +9 -6
data/lib/square/api/team_api.rb
CHANGED
@@ -5,12 +5,12 @@ module Square
|
|
5
5
|
super(config, http_call_back: http_call_back)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Creates a single `TeamMember` object. The `TeamMember`
|
9
|
-
# successful creates.
|
8
|
+
# Creates a single `TeamMember` object. The `TeamMember` object is returned
|
9
|
+
# on successful creates.
|
10
10
|
# You must provide the following values in your request to this endpoint:
|
11
11
|
# - `given_name`
|
12
12
|
# - `family_name`
|
13
|
-
# Learn about [Troubleshooting the
|
13
|
+
# Learn about [Troubleshooting the Team
|
14
14
|
# API](https://developer.squareup.com/docs/team/troubleshooting#createteamme
|
15
15
|
# mber).
|
16
16
|
# @param [CreateTeamMemberRequest] body Required parameter: An object
|
@@ -47,13 +47,13 @@ module Square
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# Creates multiple `TeamMember` objects. The created `TeamMember` objects
|
50
|
-
#
|
51
|
-
# This process is non-transactional and
|
52
|
-
#
|
53
|
-
# the request cannot be successfully processed, the request
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# Learn about [Troubleshooting the
|
50
|
+
# are returned on successful creates.
|
51
|
+
# This process is non-transactional and processes as much of the request as
|
52
|
+
# possible. If one of the creates in
|
53
|
+
# the request cannot be successfully processed, the request is not marked as
|
54
|
+
# failed, but the body of the response
|
55
|
+
# contains explicit error information for the failed create.
|
56
|
+
# Learn about [Troubleshooting the Team
|
57
57
|
# API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-
|
58
58
|
# team-members).
|
59
59
|
# @param [BulkCreateTeamMembersRequest] body Required parameter: An object
|
@@ -90,13 +90,13 @@ module Square
|
|
90
90
|
end
|
91
91
|
|
92
92
|
# Updates multiple `TeamMember` objects. The updated `TeamMember` objects
|
93
|
-
#
|
94
|
-
# This process is non-transactional and
|
95
|
-
#
|
96
|
-
# the request cannot be successfully processed, the request
|
97
|
-
#
|
98
|
-
#
|
99
|
-
# Learn about [Troubleshooting the
|
93
|
+
# are returned on successful updates.
|
94
|
+
# This process is non-transactional and processes as much of the request as
|
95
|
+
# possible. If one of the updates in
|
96
|
+
# the request cannot be successfully processed, the request is not marked as
|
97
|
+
# failed, but the body of the response
|
98
|
+
# contains explicit error information for the failed update.
|
99
|
+
# Learn about [Troubleshooting the Team
|
100
100
|
# API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-
|
101
101
|
# team-members).
|
102
102
|
# @param [BulkUpdateTeamMembersRequest] body Required parameter: An object
|
@@ -133,8 +133,8 @@ module Square
|
|
133
133
|
end
|
134
134
|
|
135
135
|
# Returns a paginated list of `TeamMember` objects for a business.
|
136
|
-
# The list
|
137
|
-
# - location IDs
|
136
|
+
# The list can be filtered by the following:
|
137
|
+
# - location IDs
|
138
138
|
# - `status`
|
139
139
|
# @param [SearchTeamMembersRequest] body Required parameter: An object
|
140
140
|
# containing the fields to POST for the request. See the corresponding
|
@@ -169,8 +169,8 @@ module Square
|
|
169
169
|
)
|
170
170
|
end
|
171
171
|
|
172
|
-
#
|
173
|
-
# Learn about [Troubleshooting the
|
172
|
+
# Retrieves a `TeamMember` object for the given `TeamMember.id`.
|
173
|
+
# Learn about [Troubleshooting the Team
|
174
174
|
# API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-t
|
175
175
|
# eam-member).
|
176
176
|
# @param [String] team_member_id Required parameter: The ID of the team
|
@@ -207,9 +207,9 @@ module Square
|
|
207
207
|
)
|
208
208
|
end
|
209
209
|
|
210
|
-
# Updates a single `TeamMember` object. The `TeamMember`
|
211
|
-
# successful updates.
|
212
|
-
# Learn about [Troubleshooting the
|
210
|
+
# Updates a single `TeamMember` object. The `TeamMember` object is returned
|
211
|
+
# on successful updates.
|
212
|
+
# Learn about [Troubleshooting the Team
|
213
213
|
# API](https://developer.squareup.com/docs/team/troubleshooting#update-a-tea
|
214
214
|
# m-member).
|
215
215
|
# @param [String] team_member_id Required parameter: The ID of the team
|
@@ -252,13 +252,13 @@ module Square
|
|
252
252
|
)
|
253
253
|
end
|
254
254
|
|
255
|
-
#
|
255
|
+
# Retrieves a `WageSetting` object for a team member specified
|
256
256
|
# by `TeamMember.id`.
|
257
|
-
# Learn about [Troubleshooting the
|
257
|
+
# Learn about [Troubleshooting the Team
|
258
258
|
# API](https://developer.squareup.com/docs/team/troubleshooting#retrievewage
|
259
259
|
# setting).
|
260
260
|
# @param [String] team_member_id Required parameter: The ID of the team
|
261
|
-
# member to retrieve wage setting
|
261
|
+
# member for which to retrieve the wage setting.
|
262
262
|
# @return [RetrieveWageSettingResponse Hash] response from the API call
|
263
263
|
def retrieve_wage_setting(team_member_id:)
|
264
264
|
# Prepare query url.
|
@@ -295,12 +295,12 @@ module Square
|
|
295
295
|
# `WageSetting` with the specified `team_member_id` does not exist.
|
296
296
|
# Otherwise,
|
297
297
|
# it fully replaces the `WageSetting` object for the team member.
|
298
|
-
# The `WageSetting`
|
299
|
-
# Learn about [Troubleshooting the
|
298
|
+
# The `WageSetting` is returned on a successful update.
|
299
|
+
# Learn about [Troubleshooting the Team
|
300
300
|
# API](https://developer.squareup.com/docs/team/troubleshooting#create-or-up
|
301
301
|
# date-a-wage-setting).
|
302
302
|
# @param [String] team_member_id Required parameter: The ID of the team
|
303
|
-
# member to update the `WageSetting` object
|
303
|
+
# member for which to update the `WageSetting` object.
|
304
304
|
# @param [UpdateWageSettingRequest] body Required parameter: An object
|
305
305
|
# containing the fields to POST for the request. See the corresponding
|
306
306
|
# object definition for field details.
|
@@ -152,8 +152,9 @@ module Square
|
|
152
152
|
|
153
153
|
# Charges a card represented by a card nonce or a customer's card on file.
|
154
154
|
# Your request to this endpoint must include _either_:
|
155
|
-
# - A value for the `card_nonce` parameter (to charge a card
|
156
|
-
#
|
155
|
+
# - A value for the `card_nonce` parameter (to charge a card payment token
|
156
|
+
# generated
|
157
|
+
# with the Web Payments SDK)
|
157
158
|
# - Values for the `customer_card_id` and `customer_id` parameters (to
|
158
159
|
# charge
|
159
160
|
# a customer's card on file)
|
data/lib/square/client.rb
CHANGED
@@ -4,7 +4,7 @@ module Square
|
|
4
4
|
attr_reader :config
|
5
5
|
|
6
6
|
def sdk_version
|
7
|
-
'
|
7
|
+
'12.0.0.20210616'
|
8
8
|
end
|
9
9
|
|
10
10
|
def square_version
|
@@ -53,6 +53,12 @@ module Square
|
|
53
53
|
@bookings ||= BookingsApi.new config
|
54
54
|
end
|
55
55
|
|
56
|
+
# Access to cards controller.
|
57
|
+
# @return [CardsApi] Returns the controller instance.
|
58
|
+
def cards
|
59
|
+
@cards ||= CardsApi.new config
|
60
|
+
end
|
61
|
+
|
56
62
|
# Access to cash_drawers controller.
|
57
63
|
# @return [CashDrawersApi] Returns the controller instance.
|
58
64
|
def cash_drawers
|
@@ -101,6 +107,18 @@ module Square
|
|
101
107
|
@employees ||= EmployeesApi.new config
|
102
108
|
end
|
103
109
|
|
110
|
+
# Access to gift_cards controller.
|
111
|
+
# @return [GiftCardsApi] Returns the controller instance.
|
112
|
+
def gift_cards
|
113
|
+
@gift_cards ||= GiftCardsApi.new config
|
114
|
+
end
|
115
|
+
|
116
|
+
# Access to gift_card_activities controller.
|
117
|
+
# @return [GiftCardActivitiesApi] Returns the controller instance.
|
118
|
+
def gift_card_activities
|
119
|
+
@gift_card_activities ||= GiftCardActivitiesApi.new config
|
120
|
+
end
|
121
|
+
|
104
122
|
# Access to inventory controller.
|
105
123
|
# @return [InventoryApi] Returns the controller instance.
|
106
124
|
def inventory
|
@@ -198,14 +216,18 @@ module Square
|
|
198
216
|
end
|
199
217
|
|
200
218
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
201
|
-
backoff_factor:
|
219
|
+
backoff_factor: 2,
|
220
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
221
|
+
retry_methods: %i[get put], environment: 'production',
|
202
222
|
custom_url: 'https://connect.squareup.com',
|
203
|
-
square_version: '2021-
|
223
|
+
square_version: '2021-06-16', access_token: 'TODO: Replace',
|
204
224
|
additional_headers: {}, config: nil)
|
205
225
|
@config = if config.nil?
|
206
226
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
207
227
|
retry_interval: retry_interval,
|
208
228
|
backoff_factor: backoff_factor,
|
229
|
+
retry_statuses: retry_statuses,
|
230
|
+
retry_methods: retry_methods,
|
209
231
|
environment: environment,
|
210
232
|
custom_url: custom_url,
|
211
233
|
square_version: square_version,
|
data/lib/square/configuration.rb
CHANGED
@@ -8,6 +8,8 @@ module Square
|
|
8
8
|
attr_reader :max_retries
|
9
9
|
attr_reader :retry_interval
|
10
10
|
attr_reader :backoff_factor
|
11
|
+
attr_reader :retry_statuses
|
12
|
+
attr_reader :retry_methods
|
11
13
|
attr_reader :environment
|
12
14
|
attr_reader :custom_url
|
13
15
|
attr_reader :square_version
|
@@ -22,9 +24,11 @@ module Square
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
25
|
-
backoff_factor:
|
27
|
+
backoff_factor: 2,
|
28
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
29
|
+
retry_methods: %i[get put], environment: 'production',
|
26
30
|
custom_url: 'https://connect.squareup.com',
|
27
|
-
square_version: '2021-
|
31
|
+
square_version: '2021-06-16', access_token: 'TODO: Replace',
|
28
32
|
additional_headers: {})
|
29
33
|
# The value to use for connection timeout
|
30
34
|
@timeout = timeout
|
@@ -39,6 +43,12 @@ module Square
|
|
39
43
|
# by in order to provide backoff
|
40
44
|
@backoff_factor = backoff_factor
|
41
45
|
|
46
|
+
# A list of HTTP statuses to retry
|
47
|
+
@retry_statuses = retry_statuses
|
48
|
+
|
49
|
+
# A list of HTTP methods to retry
|
50
|
+
@retry_methods = retry_methods
|
51
|
+
|
42
52
|
# Current API environment
|
43
53
|
@environment = String(environment)
|
44
54
|
|
@@ -59,13 +69,15 @@ module Square
|
|
59
69
|
end
|
60
70
|
|
61
71
|
def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
|
62
|
-
backoff_factor: nil,
|
63
|
-
|
64
|
-
additional_headers: nil)
|
72
|
+
backoff_factor: nil, retry_statuses: nil, retry_methods: nil,
|
73
|
+
environment: nil, custom_url: nil, square_version: nil,
|
74
|
+
access_token: nil, additional_headers: nil)
|
65
75
|
timeout ||= self.timeout
|
66
76
|
max_retries ||= self.max_retries
|
67
77
|
retry_interval ||= self.retry_interval
|
68
78
|
backoff_factor ||= self.backoff_factor
|
79
|
+
retry_statuses ||= self.retry_statuses
|
80
|
+
retry_methods ||= self.retry_methods
|
69
81
|
environment ||= self.environment
|
70
82
|
custom_url ||= self.custom_url
|
71
83
|
square_version ||= self.square_version
|
@@ -75,8 +87,9 @@ module Square
|
|
75
87
|
Configuration.new(timeout: timeout, max_retries: max_retries,
|
76
88
|
retry_interval: retry_interval,
|
77
89
|
backoff_factor: backoff_factor,
|
78
|
-
|
79
|
-
|
90
|
+
retry_statuses: retry_statuses,
|
91
|
+
retry_methods: retry_methods, environment: environment,
|
92
|
+
custom_url: custom_url, square_version: square_version,
|
80
93
|
access_token: access_token,
|
81
94
|
additional_headers: additional_headers)
|
82
95
|
end
|
@@ -84,7 +97,9 @@ module Square
|
|
84
97
|
def create_http_client
|
85
98
|
FaradayClient.new(timeout: timeout, max_retries: max_retries,
|
86
99
|
retry_interval: retry_interval,
|
87
|
-
backoff_factor: backoff_factor
|
100
|
+
backoff_factor: backoff_factor,
|
101
|
+
retry_statuses: retry_statuses,
|
102
|
+
retry_methods: retry_methods)
|
88
103
|
end
|
89
104
|
|
90
105
|
# All the environments the SDK can run in.
|
@@ -6,7 +6,8 @@ module Square
|
|
6
6
|
class FaradayClient < HttpClient
|
7
7
|
# The constructor.
|
8
8
|
def initialize(timeout:, max_retries:, retry_interval:,
|
9
|
-
backoff_factor:,
|
9
|
+
backoff_factor:, retry_statuses:, retry_methods:,
|
10
|
+
cache: false, verify: true)
|
10
11
|
@connection = Faraday.new do |faraday|
|
11
12
|
faraday.use Faraday::HttpCache, serializer: Marshal if cache
|
12
13
|
faraday.use FaradayMiddleware::FollowRedirects
|
@@ -16,7 +17,9 @@ module Square
|
|
16
17
|
faraday.ssl[:ca_file] = Certifi.where
|
17
18
|
faraday.ssl[:verify] = verify
|
18
19
|
faraday.request :retry, max: max_retries, interval: retry_interval,
|
19
|
-
backoff_factor: backoff_factor
|
20
|
+
backoff_factor: backoff_factor,
|
21
|
+
retry_statuses: retry_statuses,
|
22
|
+
methods: retry_methods
|
20
23
|
faraday.adapter Faraday.default_adapter
|
21
24
|
faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
|
22
25
|
faraday.options[:timeout] = timeout if timeout > 0
|
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: 12.0.0.20210616
|
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: 2021-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -31,9 +31,9 @@ dependencies:
|
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.0'
|
34
|
-
- - "
|
34
|
+
- - "<="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 1.0
|
36
|
+
version: 1.3.0
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -41,9 +41,9 @@ dependencies:
|
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '1.0'
|
44
|
-
- - "
|
44
|
+
- - "<="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 1.0
|
46
|
+
version: 1.3.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: faraday_middleware
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/square/api/bank_accounts_api.rb
|
141
141
|
- lib/square/api/base_api.rb
|
142
142
|
- lib/square/api/bookings_api.rb
|
143
|
+
- lib/square/api/cards_api.rb
|
143
144
|
- lib/square/api/cash_drawers_api.rb
|
144
145
|
- lib/square/api/catalog_api.rb
|
145
146
|
- lib/square/api/checkout_api.rb
|
@@ -149,6 +150,8 @@ files:
|
|
149
150
|
- lib/square/api/devices_api.rb
|
150
151
|
- lib/square/api/disputes_api.rb
|
151
152
|
- lib/square/api/employees_api.rb
|
153
|
+
- lib/square/api/gift_card_activities_api.rb
|
154
|
+
- lib/square/api/gift_cards_api.rb
|
152
155
|
- lib/square/api/inventory_api.rb
|
153
156
|
- lib/square/api/invoices_api.rb
|
154
157
|
- lib/square/api/labor_api.rb
|