seatsio 32.2.0 → 33.1.0
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/.github/dependabot.yml +11 -0
- data/Gemfile.lock +5 -5
- data/README.md +47 -6
- data/lib/seatsio/chart_reports.rb +2 -2
- data/lib/seatsio/charts.rb +2 -2
- data/lib/seatsio/domain.rb +16 -28
- data/lib/seatsio/event_reports.rb +2 -2
- data/lib/seatsio/events.rb +20 -11
- data/lib/seatsio/exception.rb +3 -0
- data/lib/seatsio/hold_tokens.rb +2 -2
- data/lib/seatsio/httpClient.rb +17 -6
- data/lib/seatsio/subaccounts.rb +2 -2
- data/lib/seatsio/usage_reports.rb +2 -2
- data/lib/seatsio/version.rb +1 -1
- data/lib/seatsio/workspaces.rb +15 -2
- data/lib/seatsio.rb +12 -9
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33473b549ec1ccc19d4cd335a986402488cb147e6578a5f02cfb841ef319e3a3
|
4
|
+
data.tar.gz: e0242b450577e6497845bd29a43435169f5e7c9425912c2097282382d5636bee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d66a102bba053bffd67fe4c99d8f43e57307aa2b4d8c90fd79c19ccea7b5c8f7ab5c58bf84cef2312555ae0c4adab0bb1075546147d0b146582232d7cc06dad3
|
7
|
+
data.tar.gz: 37904aca59ceb8321f4cf1ffdb75ce4f445222737cf4aab12536064848b8cd23b3824a9130938ac8eeb04d29710870f35d4fe7ce5bdc7852b130b03c4c7cfc16
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
seatsio (
|
4
|
+
seatsio (33.1.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
addressable (2.
|
9
|
+
addressable (2.8.0)
|
10
10
|
public_suffix (>= 2.0.2, < 5.0)
|
11
11
|
crack (0.4.5)
|
12
12
|
rexml
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
minitest (5.14.4)
|
23
23
|
netrc (0.11.0)
|
24
24
|
public_suffix (4.0.6)
|
25
|
-
rake (13.0.
|
25
|
+
rake (13.0.6)
|
26
26
|
rest-client (2.1.0)
|
27
27
|
http-accept (>= 1.7.0, < 2.0)
|
28
28
|
http-cookie (>= 1.0.2, < 2.0)
|
@@ -32,8 +32,8 @@ GEM
|
|
32
32
|
unf (0.1.4)
|
33
33
|
unf_ext
|
34
34
|
unf_ext (0.0.7.7)
|
35
|
-
webmock (3.
|
36
|
-
addressable (>= 2.
|
35
|
+
webmock (3.14.0)
|
36
|
+
addressable (>= 2.8.0)
|
37
37
|
crack (>= 0.3.2)
|
38
38
|
hashdiff (>= 0.4.0, < 2.0.0)
|
39
39
|
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ seatsio-ruby follows semver since v23.3.0.
|
|
17
17
|
require('seatsio')
|
18
18
|
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key") # can be found on https://app.seats.io/workspace-settings
|
19
19
|
chart = client.charts.create
|
20
|
-
event = client.events.create
|
20
|
+
event = client.events.create chart_key: chart.key
|
21
21
|
```
|
22
22
|
|
23
23
|
### Booking objects
|
@@ -52,6 +52,22 @@ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
|
52
52
|
client.events.change_object_status("<EVENT KEY>", ["A-1", "A-2"], "my-custom-status")
|
53
53
|
```
|
54
54
|
|
55
|
+
### Retrieving object category and status (and other information)
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
require('seatsio')
|
59
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
60
|
+
object_infos = client.events.retrieve_object_infos key: event.key, labels: ['A-1', 'A-2']
|
61
|
+
|
62
|
+
puts object_infos['A-1'].category_key
|
63
|
+
puts object_infos['A-1'].category_label
|
64
|
+
puts object_infos['A-1'].status
|
65
|
+
|
66
|
+
puts object_infos['A-2'].category_key
|
67
|
+
puts object_infos['A-2'].category_label
|
68
|
+
puts object_infos['A-2'].status
|
69
|
+
```
|
70
|
+
|
55
71
|
### Listing all charts
|
56
72
|
|
57
73
|
```ruby
|
@@ -73,7 +89,8 @@ Each page is Enumerable, and it has `next_page_starts_after` and `previous_page_
|
|
73
89
|
|
74
90
|
```ruby
|
75
91
|
# ... user initially opens the screen ...
|
76
|
-
|
92
|
+
require('seatsio')
|
93
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
77
94
|
firstPage = client.charts.list.first_page()
|
78
95
|
firstPage.each do |chart|
|
79
96
|
puts chart.key
|
@@ -82,7 +99,8 @@ end
|
|
82
99
|
|
83
100
|
```ruby
|
84
101
|
# ... user clicks on 'next page' button ...
|
85
|
-
|
102
|
+
require('seatsio')
|
103
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
86
104
|
nextPage = client.charts.list.page_after(firstPage.next_page_starts_after)
|
87
105
|
nextPage.each do |chart|
|
88
106
|
puts chart.key
|
@@ -91,7 +109,8 @@ end
|
|
91
109
|
|
92
110
|
```ruby
|
93
111
|
# ... user clicks on 'previous page' button ...
|
94
|
-
|
112
|
+
require('seatsio')
|
113
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
95
114
|
previousPage = client.charts.list.page_before(nextPage.previous_page_ends_before)
|
96
115
|
previousPage.each do |chart|
|
97
116
|
puts chart.key
|
@@ -102,10 +121,21 @@ end
|
|
102
121
|
|
103
122
|
```ruby
|
104
123
|
require('seatsio')
|
105
|
-
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key")
|
124
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key") # can be found on https://app.seats.io/company-settings
|
106
125
|
client.workspaces.create name: "a workspace"
|
107
126
|
```
|
108
127
|
|
128
|
+
### Creating a chart and an event with the company admin key
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
require('seatsio')
|
132
|
+
# company admin key can be found on https://app.seats.io/company-settings
|
133
|
+
# workspace public key can be found on https://app.seats.io/workspace-settings
|
134
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key", "my-workspace-public-key")
|
135
|
+
chart = client.charts.create
|
136
|
+
event = client.events.create chart_key: chart.key
|
137
|
+
```
|
138
|
+
|
109
139
|
# Error handling
|
110
140
|
|
111
141
|
When an API call results in a 4xx or 5xx error (e.g. when a chart could not be found), a SeatsioException is thrown.
|
@@ -121,4 +151,15 @@ This exception contains a message string describing what went wrong, and also tw
|
|
121
151
|
This library supports [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff).
|
122
152
|
|
123
153
|
When you send too many concurrent requests, the server returns an error `429 - Too Many Requests`. The client reacts to this by waiting for a while, and then retrying the request.
|
124
|
-
If the request still fails with an error `429`, it waits a little longer, and try again.
|
154
|
+
If the request still fails with an error `429`, it waits a little longer, and try again. By default this happens 5 times, before giving up (after approximately 15 seconds).
|
155
|
+
|
156
|
+
We throw a `RateLimitExceededException` (which is a subclass of `SeatsioException`) when exponential backoff eventually fails.
|
157
|
+
|
158
|
+
To change the maximum number of retries, create the client as follows:
|
159
|
+
|
160
|
+
```ruby
|
161
|
+
require('seatsio')
|
162
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key", max_retries = 3)
|
163
|
+
```
|
164
|
+
|
165
|
+
Passing in 0 disables exponential backoff completely. In that case, the client will never retry a failed request.
|
@@ -6,8 +6,8 @@ require 'cgi'
|
|
6
6
|
|
7
7
|
module Seatsio
|
8
8
|
class ChartReportsClient
|
9
|
-
def initialize(
|
10
|
-
@http_client =
|
9
|
+
def initialize(http_client)
|
10
|
+
@http_client = http_client
|
11
11
|
end
|
12
12
|
|
13
13
|
def by_label(chart_key, book_whole_tables = nil)
|
data/lib/seatsio/charts.rb
CHANGED
@@ -11,8 +11,8 @@ module Seatsio
|
|
11
11
|
class ChartsClient
|
12
12
|
attr_reader :archive
|
13
13
|
|
14
|
-
def initialize(
|
15
|
-
@http_client =
|
14
|
+
def initialize(http_client)
|
15
|
+
@http_client = http_client
|
16
16
|
@archive = Pagination::Cursor.new(Chart, 'charts/archive', @http_client)
|
17
17
|
end
|
18
18
|
|
data/lib/seatsio/domain.rb
CHANGED
@@ -201,25 +201,6 @@ module Seatsio
|
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
|
-
class ObjectStatus
|
205
|
-
FREE = 'free'
|
206
|
-
BOOKED = 'booked'
|
207
|
-
HELD = 'reservedByToken'
|
208
|
-
|
209
|
-
attr_reader :status, :hold_token, :order_id, :ticket_type,
|
210
|
-
:quantity, :extra_data, :for_sale
|
211
|
-
|
212
|
-
def initialize(data)
|
213
|
-
@status = data['status']
|
214
|
-
@hold_token = data['holdToken']
|
215
|
-
@order_id = data['orderId']
|
216
|
-
@ticket_type = data['ticketType']
|
217
|
-
@quantity = data['quantity']
|
218
|
-
@extra_data = data['extraData']
|
219
|
-
@for_sale = data['forSale']
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
204
|
class ChangeObjectStatusResult
|
224
205
|
|
225
206
|
attr_reader :objects
|
@@ -261,14 +242,15 @@ module Seatsio
|
|
261
242
|
end
|
262
243
|
end
|
263
244
|
|
264
|
-
class
|
245
|
+
class ChartObjectInfo
|
265
246
|
|
266
|
-
attr_reader :label, :labels, :category_key, :category_label, :section, :entrance, :capacity, :object_type,
|
247
|
+
attr_reader :label, :labels, :ids, :category_key, :category_label, :section, :entrance, :capacity, :object_type,
|
267
248
|
:left_neighbour, :right_neighbour, :book_as_a_whole, :distance_to_focal_point
|
268
249
|
|
269
250
|
def initialize(data)
|
270
251
|
@label = data['label']
|
271
252
|
@labels = data['labels']
|
253
|
+
@ids = data['ids']
|
272
254
|
@category_label = data['categoryLabel']
|
273
255
|
@category_key = data['categoryKey']
|
274
256
|
@section = data['section']
|
@@ -291,7 +273,7 @@ module Seatsio
|
|
291
273
|
data.each do |key, values|
|
292
274
|
items[key] = []
|
293
275
|
values.each do |value|
|
294
|
-
items[key] <<
|
276
|
+
items[key] << ChartObjectInfo.new(value)
|
295
277
|
end
|
296
278
|
end
|
297
279
|
@items = items
|
@@ -306,7 +288,7 @@ module Seatsio
|
|
306
288
|
if data.is_a? Array
|
307
289
|
items = []
|
308
290
|
data.each do |item|
|
309
|
-
items <<
|
291
|
+
items << EventObjectInfo.new(item)
|
310
292
|
end
|
311
293
|
@items = items
|
312
294
|
elsif data.nil?
|
@@ -316,7 +298,7 @@ module Seatsio
|
|
316
298
|
data.each do |key, values|
|
317
299
|
items[key] = []
|
318
300
|
values.each do |value|
|
319
|
-
items[key] <<
|
301
|
+
items[key] << EventObjectInfo.new(value)
|
320
302
|
end
|
321
303
|
end
|
322
304
|
@items = items
|
@@ -324,18 +306,23 @@ module Seatsio
|
|
324
306
|
end
|
325
307
|
end
|
326
308
|
|
327
|
-
class
|
328
|
-
|
309
|
+
class EventObjectInfo
|
310
|
+
FREE = 'free'
|
311
|
+
BOOKED = 'booked'
|
312
|
+
HELD = 'reservedByToken'
|
313
|
+
|
314
|
+
attr_reader :labels, :ids, :label, :order_id, :extra_data, :capacity, :status,
|
329
315
|
:category_key, :entrance, :object_type, :hold_token, :category_label,
|
330
316
|
:ticket_type, :num_booked, :num_free, :num_held, :for_sale, :section,
|
331
317
|
:is_accessible, :is_companion_seat, :has_restricted_view, :displayed_object_type,
|
332
318
|
:left_neighbour, :right_neighbour, :is_selectable, :is_disabled_by_social_distancing, :channel,
|
333
|
-
:book_as_a_whole, :distance_to_focal_point
|
319
|
+
:book_as_a_whole, :distance_to_focal_point, :holds
|
334
320
|
|
335
321
|
def initialize(data)
|
336
322
|
@status = data['status']
|
337
323
|
@label = data['label']
|
338
324
|
@labels = data['labels']
|
325
|
+
@ids = data['ids']
|
339
326
|
@category_label = data['categoryLabel']
|
340
327
|
@category_key = data['categoryKey']
|
341
328
|
@ticket_type = data['ticketType']
|
@@ -361,6 +348,7 @@ module Seatsio
|
|
361
348
|
@channel = data['channel']
|
362
349
|
@book_as_a_whole = data['bookAsAWhole']
|
363
350
|
@distance_to_focal_point = data['distanceToFocalPoint']
|
351
|
+
@holds = data['holds']
|
364
352
|
end
|
365
353
|
end
|
366
354
|
|
@@ -504,7 +492,7 @@ module Seatsio
|
|
504
492
|
def to_object_details(data)
|
505
493
|
object_details = {}
|
506
494
|
data.each do |key, value|
|
507
|
-
object_details[key] =
|
495
|
+
object_details[key] = EventObjectInfo.new(value)
|
508
496
|
end
|
509
497
|
object_details
|
510
498
|
end
|
@@ -7,8 +7,8 @@ require 'cgi'
|
|
7
7
|
module Seatsio
|
8
8
|
# Client for fetching event reports
|
9
9
|
class EventReportsClient
|
10
|
-
def initialize(
|
11
|
-
@http_client =
|
10
|
+
def initialize(http_client)
|
11
|
+
@http_client = http_client
|
12
12
|
end
|
13
13
|
|
14
14
|
def by_status(event_key, status = nil)
|
data/lib/seatsio/events.rb
CHANGED
@@ -11,8 +11,8 @@ require "seatsio/events/change_best_available_object_status_request"
|
|
11
11
|
module Seatsio
|
12
12
|
|
13
13
|
class EventsClient
|
14
|
-
def initialize(
|
15
|
-
@http_client =
|
14
|
+
def initialize(http_client)
|
15
|
+
@http_client = http_client
|
16
16
|
end
|
17
17
|
|
18
18
|
def create(chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil)
|
@@ -43,14 +43,23 @@ module Seatsio
|
|
43
43
|
@http_client.post("events/#{key}/actions/update-extra-data", payload)
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
def retrieve_object_info(key:, label:)
|
47
|
+
result = retrieve_object_infos key: key, labels: [label]
|
48
|
+
result[label]
|
49
|
+
end
|
50
|
+
|
51
|
+
def retrieve_object_infos(key:, labels:)
|
52
|
+
url = "events/#{key}/objects"
|
53
|
+
query_params = URI.encode_www_form(labels.map { |label| ['label', label]})
|
54
|
+
response = @http_client.get(url, query_params)
|
55
|
+
response.each do |key, value|
|
56
|
+
response[key] = EventObjectInfo.new(value)
|
57
|
+
end
|
58
|
+
response
|
50
59
|
end
|
51
60
|
|
52
61
|
def book(event_key_or_keys, object_or_objects, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil, ignore_social_distancing: nil)
|
53
|
-
self.change_object_status(event_key_or_keys, object_or_objects,
|
62
|
+
self.change_object_status(event_key_or_keys, object_or_objects, Seatsio::EventObjectInfo::BOOKED, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys, ignore_social_distancing: ignore_social_distancing)
|
54
63
|
end
|
55
64
|
|
56
65
|
def change_object_status(event_key_or_keys, object_or_objects, status, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil, ignore_social_distancing: nil)
|
@@ -72,7 +81,7 @@ module Seatsio
|
|
72
81
|
end
|
73
82
|
|
74
83
|
def hold(event_key_or_keys, object_or_objects, hold_token, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil, ignore_social_distancing: nil)
|
75
|
-
change_object_status(event_key_or_keys, object_or_objects,
|
84
|
+
change_object_status(event_key_or_keys, object_or_objects, Seatsio::EventObjectInfo::HELD, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys, ignore_social_distancing: ignore_social_distancing)
|
76
85
|
end
|
77
86
|
|
78
87
|
def change_best_available_object_status(key, number, status, categories: nil, hold_token: nil, extra_data: nil, ticket_types: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil)
|
@@ -82,15 +91,15 @@ module Seatsio
|
|
82
91
|
end
|
83
92
|
|
84
93
|
def book_best_available(key, number, categories: nil, hold_token: nil, order_id: nil, keep_extra_data: nil, extra_data: nil, ticket_types: nil, ignore_channels: nil, channel_keys: nil)
|
85
|
-
change_best_available_object_status(key, number,
|
94
|
+
change_best_available_object_status(key, number, Seatsio::EventObjectInfo::BOOKED, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, extra_data: extra_data, ticket_types: ticket_types, ignore_channels: ignore_channels, channel_keys: channel_keys)
|
86
95
|
end
|
87
96
|
|
88
97
|
def hold_best_available(key, number, hold_token, categories: nil, order_id: nil, keep_extra_data: nil, extra_data: nil, ticket_types: nil, ignore_channels: nil, channel_keys: nil)
|
89
|
-
change_best_available_object_status(key, number,
|
98
|
+
change_best_available_object_status(key, number, Seatsio::EventObjectInfo::HELD, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, extra_data: extra_data, ticket_types: ticket_types, ignore_channels: ignore_channels, channel_keys: channel_keys)
|
90
99
|
end
|
91
100
|
|
92
101
|
def release(event_key_or_keys, object_or_objects, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil)
|
93
|
-
change_object_status(event_key_or_keys, object_or_objects,
|
102
|
+
change_object_status(event_key_or_keys, object_or_objects, Seatsio::EventObjectInfo::FREE, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys)
|
94
103
|
end
|
95
104
|
|
96
105
|
def delete(key:)
|
data/lib/seatsio/exception.rb
CHANGED
data/lib/seatsio/hold_tokens.rb
CHANGED
@@ -11,8 +11,8 @@ module Seatsio
|
|
11
11
|
|
12
12
|
class HoldTokensClient
|
13
13
|
# @return [Seatsio::HoldTokensClient]
|
14
|
-
def initialize(
|
15
|
-
@http_client =
|
14
|
+
def initialize(http_client)
|
15
|
+
@http_client = http_client
|
16
16
|
end
|
17
17
|
|
18
18
|
def create(expires_in_minutes: nil)
|
data/lib/seatsio/httpClient.rb
CHANGED
@@ -6,10 +6,11 @@ require "uri"
|
|
6
6
|
|
7
7
|
module Seatsio
|
8
8
|
class HttpClient
|
9
|
-
def initialize(secret_key, workspace_key, base_url)
|
9
|
+
def initialize(secret_key, workspace_key, base_url, max_retries)
|
10
10
|
@secret_key = Base64.encode64(secret_key)
|
11
11
|
@workspace_key = workspace_key
|
12
12
|
@base_url = base_url
|
13
|
+
@max_retries = max_retries
|
13
14
|
end
|
14
15
|
|
15
16
|
def execute(*args)
|
@@ -18,12 +19,18 @@ module Seatsio
|
|
18
19
|
unless @workspace_key.nil?
|
19
20
|
headers[:'X-Workspace-Key'] = @workspace_key
|
20
21
|
end
|
21
|
-
if args[2].include? :params
|
22
|
-
headers[:params] = args[2][:params]
|
23
|
-
end
|
24
22
|
|
25
23
|
url = "#{@base_url}/#{args[1]}"
|
26
24
|
|
25
|
+
if args[2].include? :params
|
26
|
+
params = args[2][:params]
|
27
|
+
if params.is_a? Hash
|
28
|
+
headers[:params] = params
|
29
|
+
else
|
30
|
+
url += "?" + params
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
27
34
|
request_options = { method: args[0], url: url, headers: headers }
|
28
35
|
|
29
36
|
if args[0] == :post
|
@@ -41,7 +48,11 @@ module Seatsio
|
|
41
48
|
rescue RestClient::NotFound => e
|
42
49
|
raise Exception::NotFoundException.new(e.response)
|
43
50
|
rescue RestClient::ExceptionWithResponse => e
|
44
|
-
|
51
|
+
if e.response.code == 429
|
52
|
+
raise Exception::RateLimitExceededException.new(e.response)
|
53
|
+
else
|
54
|
+
raise Exception::SeatsioException.new(e.response)
|
55
|
+
end
|
45
56
|
rescue RestClient::Exceptions::Timeout
|
46
57
|
raise Exception::SeatsioException.new("Timeout ERROR")
|
47
58
|
rescue SocketError
|
@@ -55,7 +66,7 @@ module Seatsio
|
|
55
66
|
begin
|
56
67
|
return RestClient::Request.execute(request_options)
|
57
68
|
rescue RestClient::ExceptionWithResponse => e
|
58
|
-
if e.response.code != 429 || retry_count >=
|
69
|
+
if e.response.code != 429 || retry_count >= @max_retries
|
59
70
|
raise e
|
60
71
|
else
|
61
72
|
wait_time = (2 ** (retry_count + 2)) / 10.0
|
data/lib/seatsio/subaccounts.rb
CHANGED
@@ -8,8 +8,8 @@ require "seatsio/domain"
|
|
8
8
|
|
9
9
|
module Seatsio
|
10
10
|
class SubaccountsClient
|
11
|
-
def initialize(
|
12
|
-
@http_client =
|
11
|
+
def initialize(http_client)
|
12
|
+
@http_client = http_client
|
13
13
|
end
|
14
14
|
|
15
15
|
def create(name: nil)
|
@@ -6,8 +6,8 @@ require 'cgi'
|
|
6
6
|
|
7
7
|
module Seatsio
|
8
8
|
class UsageReportsClient
|
9
|
-
def initialize(
|
10
|
-
@http_client =
|
9
|
+
def initialize(http_client)
|
10
|
+
@http_client = http_client
|
11
11
|
end
|
12
12
|
|
13
13
|
def summary_for_all_months
|
data/lib/seatsio/version.rb
CHANGED
data/lib/seatsio/workspaces.rb
CHANGED
@@ -8,8 +8,9 @@ require "seatsio/domain"
|
|
8
8
|
|
9
9
|
module Seatsio
|
10
10
|
class WorkspacesClient
|
11
|
-
|
12
|
-
|
11
|
+
|
12
|
+
def initialize(http_client)
|
13
|
+
@http_client = http_client
|
13
14
|
end
|
14
15
|
|
15
16
|
def create(name:, is_test: nil)
|
@@ -50,6 +51,18 @@ module Seatsio
|
|
50
51
|
extended_cursor
|
51
52
|
end
|
52
53
|
|
54
|
+
def active(filter: nil)
|
55
|
+
extended_cursor = Pagination::Cursor.new(Workspace, 'workspaces/active', @http_client)
|
56
|
+
extended_cursor.set_query_param('filter', filter)
|
57
|
+
extended_cursor
|
58
|
+
end
|
59
|
+
|
60
|
+
def inactive(filter: nil)
|
61
|
+
extended_cursor = Pagination::Cursor.new(Workspace, 'workspaces/inactive', @http_client)
|
62
|
+
extended_cursor.set_query_param('filter', filter)
|
63
|
+
extended_cursor
|
64
|
+
end
|
65
|
+
|
53
66
|
def retrieve(key:)
|
54
67
|
response = @http_client.get("/workspaces/#{key}")
|
55
68
|
Workspace.new(response)
|
data/lib/seatsio.rb
CHANGED
@@ -13,19 +13,22 @@ module Seatsio
|
|
13
13
|
attr_reader :charts, :subaccounts, :workspaces, :events,
|
14
14
|
:hold_tokens, :chart_reports, :event_reports, :usage_reports
|
15
15
|
|
16
|
-
def initialize(region, secret_key, workspace_key = nil)
|
16
|
+
def initialize(region, secret_key, workspace_key = nil, max_retries = 5)
|
17
17
|
base_url = region.url
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
18
|
+
@http_client = Seatsio::HttpClient.new(secret_key, workspace_key, base_url, max_retries)
|
19
|
+
@charts = ChartsClient.new(@http_client)
|
20
|
+
@subaccounts = SubaccountsClient.new(@http_client)
|
21
|
+
@workspaces = WorkspacesClient.new(@http_client)
|
22
|
+
@events = EventsClient.new(@http_client)
|
23
|
+
@hold_tokens = HoldTokensClient.new(@http_client)
|
24
|
+
@chart_reports = ChartReportsClient.new(@http_client)
|
25
|
+
@event_reports = EventReportsClient.new(@http_client)
|
26
|
+
@usage_reports = UsageReportsClient.new(@http_client)
|
26
27
|
end
|
28
|
+
|
27
29
|
end
|
28
30
|
|
31
|
+
|
29
32
|
class Region
|
30
33
|
attr_reader :url
|
31
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seatsio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 33.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seats.io
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,6 +100,7 @@ extensions: []
|
|
100
100
|
extra_rdoc_files: []
|
101
101
|
files:
|
102
102
|
- ".editorconfig"
|
103
|
+
- ".github/dependabot.yml"
|
103
104
|
- ".github/workflows/build.yml"
|
104
105
|
- ".github/workflows/publish.yml"
|
105
106
|
- ".gitignore"
|
@@ -133,7 +134,7 @@ files:
|
|
133
134
|
homepage: http://seats.io
|
134
135
|
licenses: []
|
135
136
|
metadata: {}
|
136
|
-
post_install_message:
|
137
|
+
post_install_message:
|
137
138
|
rdoc_options: []
|
138
139
|
require_paths:
|
139
140
|
- lib
|
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
150
|
version: '0'
|
150
151
|
requirements: []
|
151
152
|
rubygems_version: 3.1.2
|
152
|
-
signing_key:
|
153
|
+
signing_key:
|
153
154
|
specification_version: 4
|
154
155
|
summary: the official Seats.io Ruby client library
|
155
156
|
test_files: []
|