seatsio 47.2.0 → 51.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +5 -1
- data/.github/workflows/build.yml +2 -2
- data/.github/workflows/release.yml +20 -7
- data/.ruby-version +1 -1
- data/Gemfile.lock +21 -22
- data/README.md +11 -2
- data/lib/seatsio/chart_reports.rb +8 -0
- data/lib/seatsio/charts.rb +33 -4
- data/lib/seatsio/domain.rb +63 -4
- data/lib/seatsio/event_log.rb +27 -0
- data/lib/seatsio/event_reports.rb +12 -0
- data/lib/seatsio/events/change_best_available_object_status_request.rb +4 -1
- data/lib/seatsio/events/change_object_status_request.rb +4 -2
- data/lib/seatsio/events.rb +24 -15
- data/lib/seatsio/exception.rb +3 -0
- data/lib/seatsio/hold_tokens.rb +2 -2
- data/lib/seatsio/httpClient.rb +26 -5
- data/lib/seatsio/pagination/cursor.rb +1 -1
- data/lib/seatsio/seasons.rb +4 -4
- data/lib/seatsio/version.rb +1 -1
- data/lib/seatsio/workspaces.rb +1 -1
- data/lib/seatsio.rb +3 -1
- data/release.mjs +4 -4
- data/seatsio.gemspec +1 -1
- metadata +6 -6
- data/lib/seatsio/events/change_object_status_in_batch_request.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56a644926444297963f2f3bf83f06766072cfaab7b6964e0e5e8e2e3eb22842d
|
4
|
+
data.tar.gz: 723050a281e26c7c44688d947d2b6cd7228e5849ac991c1f9d3e929cc2a375a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ba324ca8a888103228ddbfa77c88f996e6bd0a72bf92cdfc8f40084d30999c1cd2b724b25c9b3245011ec22873ba250b45170c877c756772e1880359f36a417
|
7
|
+
data.tar.gz: 516680e34fef8abd807f9095e9b72f18ba74523be06ff123d43c572d63eca1547b2a4a5e21ba3c60f28cbaf52d41a3d09cea5594e37492f57ec9b8f7824033eb
|
data/.github/dependabot.yml
CHANGED
data/.github/workflows/build.yml
CHANGED
@@ -12,7 +12,7 @@ jobs:
|
|
12
12
|
runs-on: ubuntu-latest
|
13
13
|
strategy:
|
14
14
|
matrix:
|
15
|
-
ruby-version: ['
|
15
|
+
ruby-version: ['3.0', '3.3']
|
16
16
|
|
17
17
|
steps:
|
18
18
|
- uses: actions/checkout@v2
|
@@ -23,6 +23,6 @@ jobs:
|
|
23
23
|
- uses: zcong1993/setup-timezone@master
|
24
24
|
with:
|
25
25
|
timezone: Europe/Brussels
|
26
|
-
- run: bundle exec
|
26
|
+
- run: bundle exec parallel_test
|
27
27
|
env:
|
28
28
|
DEMO_COMPANY_SECRET_KEY: ${{ secrets.DEMO_COMPANY_SECRET_KEY }}
|
@@ -24,13 +24,14 @@ jobs:
|
|
24
24
|
with:
|
25
25
|
fetch-depth: 0
|
26
26
|
- uses: fregante/setup-git-user@v2
|
27
|
-
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
-
|
27
|
+
- uses: actions/setup-node@v4
|
28
|
+
with:
|
29
|
+
node-version: 20
|
30
|
+
registry-url: https://registry.npmjs.org/
|
31
|
+
- name: Install dependencies
|
32
|
+
run: yarn add -D -E zx@8.1.4 semver@7.6.3
|
33
|
+
- name: Run release script
|
34
|
+
run: yarn zx ./release.mjs -v $VERSION_TO_BUMP
|
34
35
|
env:
|
35
36
|
VERSION_TO_BUMP: ${{ inputs.versionToBump }}
|
36
37
|
GH_TOKEN: ${{ github.token }}
|
@@ -44,3 +45,15 @@ jobs:
|
|
44
45
|
env:
|
45
46
|
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
46
47
|
|
48
|
+
notify-slack-failure:
|
49
|
+
runs-on: ubuntu-latest
|
50
|
+
needs: [ release ]
|
51
|
+
if: failure()
|
52
|
+
steps:
|
53
|
+
- uses: voxmedia/github-action-slack-notify-build@v1
|
54
|
+
with:
|
55
|
+
status: FAILED
|
56
|
+
channel: build_status
|
57
|
+
color: danger
|
58
|
+
env:
|
59
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.0
|
data/Gemfile.lock
CHANGED
@@ -1,41 +1,40 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
seatsio (
|
4
|
+
seatsio (51.4.0)
|
5
5
|
rest-client (~> 2.0, >= 2.0.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.8.
|
11
|
-
public_suffix (>= 2.0.2, <
|
12
|
-
|
10
|
+
addressable (2.8.7)
|
11
|
+
public_suffix (>= 2.0.2, < 7.0)
|
12
|
+
bigdecimal (3.1.8)
|
13
|
+
crack (1.0.0)
|
14
|
+
bigdecimal
|
13
15
|
rexml
|
14
|
-
domain_name (0.
|
15
|
-
|
16
|
-
hashdiff (1.0.1)
|
16
|
+
domain_name (0.6.20240107)
|
17
|
+
hashdiff (1.1.1)
|
17
18
|
http-accept (1.7.0)
|
18
|
-
http-cookie (1.0.
|
19
|
+
http-cookie (1.0.6)
|
19
20
|
domain_name (~> 0.5)
|
20
|
-
mime-types (3.
|
21
|
+
mime-types (3.5.2)
|
21
22
|
mime-types-data (~> 3.2015)
|
22
|
-
mime-types-data (3.
|
23
|
-
minitest (5.
|
24
|
-
minitest-parallel_fork (1.3.1)
|
25
|
-
minitest (>= 5.15.0)
|
23
|
+
mime-types-data (3.2024.0702)
|
24
|
+
minitest (5.25.4)
|
26
25
|
netrc (0.11.0)
|
27
|
-
|
28
|
-
|
26
|
+
parallel (1.26.3)
|
27
|
+
parallel_tests (4.7.2)
|
28
|
+
parallel
|
29
|
+
public_suffix (6.0.1)
|
30
|
+
rake (13.2.1)
|
29
31
|
rest-client (2.1.0)
|
30
32
|
http-accept (>= 1.7.0, < 2.0)
|
31
33
|
http-cookie (>= 1.0.2, < 2.0)
|
32
34
|
mime-types (>= 1.16, < 4.0)
|
33
35
|
netrc (~> 0.8)
|
34
|
-
rexml (3.
|
35
|
-
|
36
|
-
unf_ext
|
37
|
-
unf_ext (0.0.7.7)
|
38
|
-
webmock (3.19.1)
|
36
|
+
rexml (3.3.9)
|
37
|
+
webmock (3.24.0)
|
39
38
|
addressable (>= 2.8.0)
|
40
39
|
crack (>= 0.3.2)
|
41
40
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -46,10 +45,10 @@ PLATFORMS
|
|
46
45
|
DEPENDENCIES
|
47
46
|
bundler (~> 2.2)
|
48
47
|
minitest (~> 5.0)
|
49
|
-
|
48
|
+
parallel_tests (~> 4.7.1)
|
50
49
|
rake (~> 13.0)
|
51
50
|
seatsio!
|
52
51
|
webmock (~> 3.4, >= 3.4.2)
|
53
52
|
|
54
53
|
BUNDLED WITH
|
55
|
-
2.
|
54
|
+
2.5.3
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
# seatsio-ruby, the official Seats.io Ruby
|
1
|
+
# seatsio-ruby, the official Seats.io Ruby SDK
|
2
2
|
|
3
3
|
[![Build](https://github.com/seatsio/seatsio-ruby/workflows/Build/badge.svg)](https://github.com/seatsio/seatsio-ruby/actions/workflows/build.yml)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/seatsio.svg)](https://badge.fury.io/rb/seatsio)
|
5
5
|
|
6
|
-
This is the official Ruby client library for the [Seats.io V2 REST API](https://docs.seats.io/docs/api-overview), supporting Ruby
|
6
|
+
This is the official Ruby client library for the [Seats.io V2 REST API](https://docs.seats.io/docs/api-overview), supporting Ruby 3.0+
|
7
7
|
|
8
8
|
## Versioning
|
9
9
|
|
@@ -110,6 +110,15 @@ category_list.each_with_index do |category, index|
|
|
110
110
|
end
|
111
111
|
```
|
112
112
|
|
113
|
+
### Updating a category
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
require('seatsio')
|
117
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key", "my-workspace-public-key")
|
118
|
+
@seatsio.charts.update_category(chart_key: '<the chart key>', category_key: '<the category key>', label: "New label", color: "#bbbbbb", accessible: true)
|
119
|
+
```
|
120
|
+
|
121
|
+
|
113
122
|
### Listing all charts
|
114
123
|
|
115
124
|
```ruby
|
@@ -47,6 +47,14 @@ module Seatsio
|
|
47
47
|
fetch_summary_report('bySection', event_key, book_whole_tables, version)
|
48
48
|
end
|
49
49
|
|
50
|
+
def by_zone(chart_key, book_whole_tables = nil, version = nil)
|
51
|
+
fetch_chart_report('byZone', chart_key, book_whole_tables, version)
|
52
|
+
end
|
53
|
+
|
54
|
+
def summary_by_zone(event_key, book_whole_tables = nil, version = nil)
|
55
|
+
fetch_summary_report('byZone', event_key, book_whole_tables, version)
|
56
|
+
end
|
57
|
+
|
50
58
|
private
|
51
59
|
|
52
60
|
def fetch_chart_report(report_type, chart_key, book_whole_tables, version)
|
data/lib/seatsio/charts.rb
CHANGED
@@ -51,6 +51,14 @@ module Seatsio
|
|
51
51
|
Category.create_list(response['categories'])
|
52
52
|
end
|
53
53
|
|
54
|
+
def update_category(chart_key:, category_key:, label: nil, color: nil, accessible: nil)
|
55
|
+
payload = {}
|
56
|
+
payload['label'] = label if label != nil
|
57
|
+
payload['color'] = color if color != nil
|
58
|
+
payload['accessible'] = accessible if accessible != nil
|
59
|
+
@http_client.post("/charts/#{chart_key}/categories/#{category_key}", payload)
|
60
|
+
end
|
61
|
+
|
54
62
|
def add_tag(key, tag)
|
55
63
|
@http_client.post("charts/#{key}/tags/#{CGI::escape(tag)}")
|
56
64
|
end
|
@@ -105,17 +113,38 @@ module Seatsio
|
|
105
113
|
@http_client.post("charts/#{chart_key}/version/draft/actions/publish")
|
106
114
|
end
|
107
115
|
|
108
|
-
def list(chart_filter: nil, tag: nil, expand_events:
|
116
|
+
def list(chart_filter: nil, tag: nil, expand_events: false, expand_validation: false, expand_venue_type: false, expand_zones: false)
|
109
117
|
cursor = Pagination::Cursor.new(Chart, 'charts', @http_client)
|
110
118
|
cursor.set_query_param('filter', chart_filter)
|
111
119
|
cursor.set_query_param('tag', tag)
|
112
120
|
|
113
|
-
|
114
|
-
cursor.set_query_param('
|
115
|
-
|
121
|
+
expand_params = list_expand_params(expand_events, expand_validation, expand_venue_type, expand_zones)
|
122
|
+
cursor.set_query_param('expand', expand_params) unless expand_params.empty?
|
116
123
|
cursor
|
117
124
|
end
|
118
125
|
|
126
|
+
def list_expand_params(expand_events, expand_validation, expand_venue_type, expand_zones)
|
127
|
+
result = []
|
128
|
+
|
129
|
+
if expand_events
|
130
|
+
result.push('events')
|
131
|
+
end
|
132
|
+
|
133
|
+
if expand_validation
|
134
|
+
result.push('validation')
|
135
|
+
end
|
136
|
+
|
137
|
+
if expand_venue_type
|
138
|
+
result.push('venueType')
|
139
|
+
end
|
140
|
+
|
141
|
+
if expand_zones
|
142
|
+
result.push('zones')
|
143
|
+
end
|
144
|
+
|
145
|
+
result
|
146
|
+
end
|
147
|
+
|
119
148
|
def list_all_tags
|
120
149
|
response = @http_client.get('charts/tags')
|
121
150
|
response['tags']
|
data/lib/seatsio/domain.rb
CHANGED
@@ -8,7 +8,7 @@ module Seatsio
|
|
8
8
|
|
9
9
|
attr_reader :id, :key, :status, :name, :published_version_thumbnail_url,
|
10
10
|
:draft_version_thumbnail_url, :events, :tags, :archived,
|
11
|
-
:categories, :validation
|
11
|
+
:categories, :validation, :venue_type, :zones
|
12
12
|
|
13
13
|
def initialize(data)
|
14
14
|
@id = data['id']
|
@@ -21,6 +21,39 @@ module Seatsio
|
|
21
21
|
@tags = data['tags']
|
22
22
|
@archived = data['archived']
|
23
23
|
@validation = data['validation']
|
24
|
+
@venue_type = data['venueType']
|
25
|
+
@zones = Zone.create_list(data['zones']) if data['zones']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Zone
|
30
|
+
|
31
|
+
attr_reader :key, :label
|
32
|
+
|
33
|
+
def initialize(key, label)
|
34
|
+
@key = key
|
35
|
+
@label = label
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.from_json(data)
|
39
|
+
if data
|
40
|
+
Zone.new(data['key'], data['label'])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def == (other)
|
45
|
+
key == other.key &&
|
46
|
+
label == other.label
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.create_list(list = [])
|
50
|
+
result = []
|
51
|
+
|
52
|
+
list.each do |item|
|
53
|
+
result << Zone.from_json(item)
|
54
|
+
end
|
55
|
+
|
56
|
+
result
|
24
57
|
end
|
25
58
|
end
|
26
59
|
|
@@ -259,6 +292,17 @@ module Seatsio
|
|
259
292
|
end
|
260
293
|
end
|
261
294
|
|
295
|
+
class EventLogItem
|
296
|
+
attr_reader :id, :type, :timestamp, :data
|
297
|
+
|
298
|
+
def initialize(data)
|
299
|
+
@id = data['id']
|
300
|
+
@type = data['type']
|
301
|
+
@timestamp = DateTime.iso8601(data['timestamp'])
|
302
|
+
@data = data['data']
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
262
306
|
class ChangeObjectStatusResult
|
263
307
|
|
264
308
|
attr_reader :objects
|
@@ -304,7 +348,7 @@ module Seatsio
|
|
304
348
|
|
305
349
|
attr_reader :label, :labels, :ids, :category_key, :category_label, :section, :entrance, :capacity, :object_type,
|
306
350
|
:left_neighbour, :right_neighbour, :book_as_a_whole, :distance_to_focal_point, :num_seats, :is_accessible,
|
307
|
-
:is_companion_seat, :has_restricted_view
|
351
|
+
:is_companion_seat, :has_restricted_view, :zone, :floor
|
308
352
|
|
309
353
|
def initialize(data)
|
310
354
|
@label = data['label']
|
@@ -324,6 +368,8 @@ module Seatsio
|
|
324
368
|
@is_accessible = data['isAccessible']
|
325
369
|
@is_companion_seat = data['isCompanionSeat']
|
326
370
|
@has_restricted_view = data['hasRestrictedView']
|
371
|
+
@zone = data['zone']
|
372
|
+
@floor = data['floor']
|
327
373
|
end
|
328
374
|
end
|
329
375
|
|
@@ -369,18 +415,27 @@ module Seatsio
|
|
369
415
|
end
|
370
416
|
end
|
371
417
|
|
418
|
+
class StatusChangeType
|
419
|
+
CHANGE_STATUS_TO = 'CHANGE_STATUS_TO'
|
420
|
+
RELEASE = 'RELEASE'
|
421
|
+
OVERRIDE_SEASON_STATUS = 'OVERRIDE_SEASON_STATUS'
|
422
|
+
USE_SEASON_STATUS = 'USE_SEASON_STATUS'
|
423
|
+
end
|
424
|
+
|
372
425
|
class EventObjectInfo
|
373
426
|
FREE = 'free'
|
374
427
|
BOOKED = 'booked'
|
375
428
|
HELD = 'reservedByToken'
|
429
|
+
RESALE = 'resale'
|
376
430
|
|
377
431
|
attr_reader :labels, :ids, :label, :order_id, :extra_data, :capacity, :status,
|
378
432
|
:category_key, :entrance, :object_type, :hold_token, :category_label,
|
379
433
|
:ticket_type, :num_booked, :num_free, :num_held, :for_sale, :section,
|
380
434
|
:is_accessible, :is_companion_seat, :has_restricted_view, :displayed_object_type,
|
381
435
|
:left_neighbour, :right_neighbour, :is_available, :channel,
|
382
|
-
:book_as_a_whole, :distance_to_focal_point, :holds, :num_seats,
|
383
|
-
:
|
436
|
+
:book_as_a_whole, :distance_to_focal_point, :holds, :num_seats, :variable_occupancy,
|
437
|
+
:min_occupancy, :max_occupancy, :season_status_overridden_quantity, :num_not_for_sale,
|
438
|
+
:zone, :floor
|
384
439
|
|
385
440
|
def initialize(data)
|
386
441
|
@status = data['status']
|
@@ -416,6 +471,10 @@ module Seatsio
|
|
416
471
|
@variable_occupancy = data['variableOccupancy']
|
417
472
|
@min_occupancy = data['minOccupancy']
|
418
473
|
@max_occupancy = data['maxOccupancy']
|
474
|
+
@season_status_overridden_quantity = data['seasonStatusOverriddenQuantity']
|
475
|
+
@num_not_for_sale = data['numNotForSale']
|
476
|
+
@zone = data['zone']
|
477
|
+
@floor = data['floor']
|
419
478
|
end
|
420
479
|
end
|
421
480
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "seatsio/exception"
|
2
|
+
require "base64"
|
3
|
+
require "seatsio/httpClient"
|
4
|
+
require "seatsio/domain"
|
5
|
+
require "json"
|
6
|
+
require "cgi"
|
7
|
+
|
8
|
+
module Seatsio
|
9
|
+
class EventLogClient
|
10
|
+
|
11
|
+
def initialize(http_client)
|
12
|
+
@http_client = http_client
|
13
|
+
end
|
14
|
+
|
15
|
+
def list(filter: nil)
|
16
|
+
extended_cursor = cursor
|
17
|
+
extended_cursor.set_query_param('filter', filter)
|
18
|
+
extended_cursor
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def cursor()
|
24
|
+
Pagination::Cursor.new(EventLogItem, 'event-log', @http_client)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -71,6 +71,18 @@ module Seatsio
|
|
71
71
|
fetch_deep_summary_report('bySection', event_key)
|
72
72
|
end
|
73
73
|
|
74
|
+
def by_zone(event_key, zone = nil)
|
75
|
+
fetch_report('byZone', event_key, zone)
|
76
|
+
end
|
77
|
+
|
78
|
+
def summary_by_zone(event_key)
|
79
|
+
fetch_summary_report('byZone', event_key)
|
80
|
+
end
|
81
|
+
|
82
|
+
def deep_summary_by_zone(event_key)
|
83
|
+
fetch_deep_summary_report('byZone', event_key)
|
84
|
+
end
|
85
|
+
|
74
86
|
def by_availability(event_key, availability = nil)
|
75
87
|
fetch_report('byAvailability', event_key, availability)
|
76
88
|
end
|
@@ -1,10 +1,13 @@
|
|
1
|
-
def create_change_best_available_object_status_request(number, status, categories, extra_data, ticket_types, hold_token, order_id, keep_extra_data,
|
1
|
+
def create_change_best_available_object_status_request(number, status, categories, zone, extra_data, ticket_types, hold_token, order_id, keep_extra_data,
|
2
|
+
ignore_channels, channel_keys, try_to_prevent_orphan_seats, accessible_seats)
|
2
3
|
result = {}
|
3
4
|
best_available = {'number': number}
|
4
5
|
best_available[:categories] = categories if categories != nil
|
6
|
+
best_available[:zone] = zone if zone != nil
|
5
7
|
best_available[:extraData] = extra_data if extra_data != nil
|
6
8
|
best_available[:ticketTypes] = ticket_types if ticket_types != nil
|
7
9
|
best_available[:tryToPreventOrphanSeats] = try_to_prevent_orphan_seats if try_to_prevent_orphan_seats != nil
|
10
|
+
best_available[:accessibleSeats] = accessible_seats if accessible_seats != nil
|
8
11
|
result[:status] = status
|
9
12
|
result[:bestAvailable] = best_available
|
10
13
|
result[:holdToken] = hold_token if hold_token != nil
|
@@ -1,7 +1,9 @@
|
|
1
|
-
def create_change_object_status_request(object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, allowed_previous_statuses, rejected_previous_statuses)
|
1
|
+
def create_change_object_status_request(type, object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, allowed_previous_statuses, rejected_previous_statuses)
|
2
2
|
result = {}
|
3
|
+
result[:type] = type
|
3
4
|
result[:objects] = normalize(object_or_objects)
|
4
|
-
result[:
|
5
|
+
result[:type] = type
|
6
|
+
result[:status] = status if type != Seatsio::StatusChangeType::RELEASE
|
5
7
|
result[:holdToken] = hold_token if hold_token != nil
|
6
8
|
result[:orderId] = order_id if order_id != nil
|
7
9
|
if event_key_or_keys.is_a? Array
|
data/lib/seatsio/events.rb
CHANGED
@@ -30,9 +30,9 @@ module Seatsio
|
|
30
30
|
Events.new(response).events
|
31
31
|
end
|
32
32
|
|
33
|
-
def update(key:,
|
34
|
-
payload = build_event_request(
|
35
|
-
@http_client.post("
|
33
|
+
def update(key:, event_key: nil, name: nil, date: nil, table_booking_config: nil, object_categories: nil, categories: nil, is_in_the_past: nil)
|
34
|
+
payload = build_event_request(nil, event_key, name, date, table_booking_config, object_categories, categories, channels: nil, is_in_the_past: is_in_the_past)
|
35
|
+
@http_client.post("events/#{key}", payload)
|
36
36
|
end
|
37
37
|
|
38
38
|
def override_season_object_status(key:, objects:)
|
@@ -64,7 +64,7 @@ module Seatsio
|
|
64
64
|
|
65
65
|
def retrieve_object_infos(key:, labels:)
|
66
66
|
url = "events/#{key}/objects"
|
67
|
-
query_params = URI.encode_www_form(
|
67
|
+
query_params = URI.encode_www_form({ label: labels })
|
68
68
|
response = @http_client.get(url, query_params)
|
69
69
|
response.each do |key, value|
|
70
70
|
response[key] = EventObjectInfo.new(value)
|
@@ -76,8 +76,12 @@ module Seatsio
|
|
76
76
|
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)
|
77
77
|
end
|
78
78
|
|
79
|
+
def put_up_for_resale(event_key_or_keys, object_or_objects)
|
80
|
+
self.change_object_status(event_key_or_keys, object_or_objects, Seatsio::EventObjectInfo::RESALE)
|
81
|
+
end
|
82
|
+
|
79
83
|
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, allowed_previous_statuses: nil, rejected_previous_statuses: nil)
|
80
|
-
request = create_change_object_status_request(object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, allowed_previous_statuses, rejected_previous_statuses)
|
84
|
+
request = create_change_object_status_request(Seatsio::StatusChangeType::CHANGE_STATUS_TO, object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, allowed_previous_statuses, rejected_previous_statuses)
|
81
85
|
request[:params] = {
|
82
86
|
:expand => 'objects'
|
83
87
|
}
|
@@ -98,26 +102,31 @@ module Seatsio
|
|
98
102
|
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)
|
99
103
|
end
|
100
104
|
|
101
|
-
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, try_to_prevent_orphan_seats: nil)
|
102
|
-
request = create_change_best_available_object_status_request(number, status, categories, extra_data, ticket_types, hold_token, order_id, keep_extra_data, ignore_channels, channel_keys, try_to_prevent_orphan_seats)
|
105
|
+
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, try_to_prevent_orphan_seats: nil, zone: nil, accessible_seats: nil)
|
106
|
+
request = create_change_best_available_object_status_request(number, status, categories, zone, extra_data, ticket_types, hold_token, order_id, keep_extra_data, ignore_channels, channel_keys, try_to_prevent_orphan_seats, accessible_seats)
|
103
107
|
response = @http_client.post("events/#{key}/actions/change-object-status", request)
|
104
108
|
BestAvailableObjects.new(response)
|
105
109
|
end
|
106
110
|
|
107
|
-
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, try_to_prevent_orphan_seats: nil)
|
108
|
-
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, try_to_prevent_orphan_seats: try_to_prevent_orphan_seats)
|
111
|
+
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, try_to_prevent_orphan_seats: nil, zone: nil)
|
112
|
+
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, try_to_prevent_orphan_seats: try_to_prevent_orphan_seats, zone: zone)
|
109
113
|
end
|
110
114
|
|
111
|
-
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, try_to_prevent_orphan_seats: nil)
|
112
|
-
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, try_to_prevent_orphan_seats: try_to_prevent_orphan_seats)
|
115
|
+
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, try_to_prevent_orphan_seats: nil, zone: nil)
|
116
|
+
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, try_to_prevent_orphan_seats: try_to_prevent_orphan_seats, zone: zone)
|
113
117
|
end
|
114
118
|
|
115
119
|
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)
|
116
|
-
|
120
|
+
request = create_change_object_status_request(Seatsio::StatusChangeType::RELEASE, object_or_objects, nil, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, nil, nil)
|
121
|
+
request[:params] = {
|
122
|
+
:expand => 'objects'
|
123
|
+
}
|
124
|
+
response = @http_client.post("events/groups/actions/change-object-status", request)
|
125
|
+
ChangeObjectStatusResult.new(response)
|
117
126
|
end
|
118
127
|
|
119
128
|
def delete(key:)
|
120
|
-
@http_client.delete("
|
129
|
+
@http_client.delete("events/#{key}")
|
121
130
|
end
|
122
131
|
|
123
132
|
def retrieve(key:)
|
@@ -133,12 +142,12 @@ module Seatsio
|
|
133
142
|
if object_id != nil
|
134
143
|
status_changes_for_object key: key, object_id: object_id
|
135
144
|
else
|
136
|
-
Pagination::Cursor.new(StatusChange, "
|
145
|
+
Pagination::Cursor.new(StatusChange, "events/#{key}/status-changes", @http_client)
|
137
146
|
end
|
138
147
|
end
|
139
148
|
|
140
149
|
def status_changes_for_object(key:, object_id:)
|
141
|
-
Pagination::Cursor.new(StatusChange, "
|
150
|
+
Pagination::Cursor.new(StatusChange, "events/#{key}/objects/#{object_id}/status-changes", @http_client)
|
142
151
|
end
|
143
152
|
|
144
153
|
def mark_as_not_for_sale(key:, objects: nil, area_places: nil, categories: nil)
|
data/lib/seatsio/exception.rb
CHANGED
data/lib/seatsio/hold_tokens.rb
CHANGED
@@ -25,13 +25,13 @@ module Seatsio
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def retrieve(hold_token)
|
28
|
-
response = @http_client.get("
|
28
|
+
response = @http_client.get("hold-tokens/#{hold_token}")
|
29
29
|
HoldToken.new(response)
|
30
30
|
end
|
31
31
|
|
32
32
|
def expire_in_minutes(hold_token, expires_in_minutes = nil)
|
33
33
|
body = {"expiresInMinutes": expires_in_minutes}
|
34
|
-
response = @http_client.post("
|
34
|
+
response = @http_client.post("hold-tokens/#{hold_token}", body)
|
35
35
|
HoldToken.new(response)
|
36
36
|
end
|
37
37
|
end
|
data/lib/seatsio/httpClient.rb
CHANGED
@@ -49,11 +49,7 @@ module Seatsio
|
|
49
49
|
rescue RestClient::NotFound => e
|
50
50
|
raise Exception::NotFoundException.new(e.response)
|
51
51
|
rescue RestClient::ExceptionWithResponse => e
|
52
|
-
|
53
|
-
raise Exception::RateLimitExceededException.new(e.response)
|
54
|
-
else
|
55
|
-
raise Exception::SeatsioException.new(e.response)
|
56
|
-
end
|
52
|
+
handle_exception(e.response)
|
57
53
|
rescue RestClient::Exceptions::Timeout
|
58
54
|
raise Exception::SeatsioException.new("Timeout ERROR")
|
59
55
|
rescue SocketError
|
@@ -94,5 +90,30 @@ module Seatsio
|
|
94
90
|
def delete(endpoint, payload = {})
|
95
91
|
execute(:delete, endpoint, payload)
|
96
92
|
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def handle_exception(response)
|
97
|
+
if response.code == 429
|
98
|
+
raise Exception::RateLimitExceededException.new(response)
|
99
|
+
end
|
100
|
+
|
101
|
+
content_type = response.headers[:content_type]
|
102
|
+
if content_type&.include?("application/json")
|
103
|
+
parsed_exception = JSON.parse(response.body, symbolize_names: true)
|
104
|
+
if best_available_objects_not_found?(parsed_exception[:errors])
|
105
|
+
raise Exception::BestAvailableObjectsNotFoundException.new(response)
|
106
|
+
else
|
107
|
+
raise Exception::SeatsioException.new(response)
|
108
|
+
end
|
109
|
+
else
|
110
|
+
raise Exception::SeatsioException.new(response)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def best_available_objects_not_found?(errors)
|
115
|
+
errors.any? { |error| error[:code] == "BEST_AVAILABLE_OBJECTS_NOT_FOUND" }
|
116
|
+
end
|
117
|
+
|
97
118
|
end
|
98
119
|
end
|
data/lib/seatsio/seasons.rb
CHANGED
@@ -24,7 +24,7 @@ module Seatsio
|
|
24
24
|
request = {}
|
25
25
|
request['key'] = partial_season_key if partial_season_key
|
26
26
|
request['eventKeys'] = event_keys if event_keys
|
27
|
-
response = @http_client.post("
|
27
|
+
response = @http_client.post("seasons/#{top_level_season_key}/partial-seasons", request)
|
28
28
|
Season.new(response)
|
29
29
|
end
|
30
30
|
|
@@ -36,19 +36,19 @@ module Seatsio
|
|
36
36
|
request = {}
|
37
37
|
request['eventKeys'] = event_keys if event_keys
|
38
38
|
request['numberOfEvents'] = number_of_events if number_of_events
|
39
|
-
response = @http_client.post("
|
39
|
+
response = @http_client.post("seasons/#{key}/actions/create-events", request)
|
40
40
|
Events.new(response).events
|
41
41
|
end
|
42
42
|
|
43
43
|
def add_events_to_partial_season(top_level_season_key:, partial_season_key:, event_keys:)
|
44
44
|
request = {}
|
45
45
|
request['eventKeys'] = event_keys
|
46
|
-
response = @http_client.post("
|
46
|
+
response = @http_client.post("seasons/#{top_level_season_key}/partial-seasons/#{partial_season_key}/actions/add-events", request)
|
47
47
|
Season.new(response)
|
48
48
|
end
|
49
49
|
|
50
50
|
def remove_event_from_partial_season(top_level_season_key:, partial_season_key:, event_key:)
|
51
|
-
response = @http_client.delete("
|
51
|
+
response = @http_client.delete("seasons/#{top_level_season_key}/partial-seasons/#{partial_season_key}/events/#{event_key}")
|
52
52
|
Season.new(response)
|
53
53
|
end
|
54
54
|
|
data/lib/seatsio/version.rb
CHANGED
data/lib/seatsio/workspaces.rb
CHANGED
data/lib/seatsio.rb
CHANGED
@@ -7,11 +7,12 @@ require 'seatsio/hold_tokens'
|
|
7
7
|
require 'seatsio/chart_reports'
|
8
8
|
require 'seatsio/event_reports'
|
9
9
|
require 'seatsio/usage_reports'
|
10
|
+
require 'seatsio/event_log'
|
10
11
|
|
11
12
|
module Seatsio
|
12
13
|
class Client
|
13
14
|
attr_reader :charts, :workspaces, :events, :seasons,
|
14
|
-
:hold_tokens, :chart_reports, :event_reports, :usage_reports
|
15
|
+
:hold_tokens, :chart_reports, :event_reports, :usage_reports, :event_log
|
15
16
|
|
16
17
|
def initialize(region, secret_key, workspace_key = nil, max_retries = 5)
|
17
18
|
base_url = region.url
|
@@ -24,6 +25,7 @@ module Seatsio
|
|
24
25
|
@chart_reports = ChartReportsClient.new(@http_client)
|
25
26
|
@event_reports = EventReportsClient.new(@http_client)
|
26
27
|
@usage_reports = UsageReportsClient.new(@http_client)
|
28
|
+
@event_log = EventLogClient.new(@http_client)
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
data/release.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env zx
|
2
2
|
|
3
3
|
/*
|
4
|
-
* Script to release the seats.io
|
4
|
+
* Script to release the seats.io ruby lib.
|
5
5
|
* - changes the version number in README.md
|
6
6
|
* - changes the version number in build.gradle
|
7
7
|
* - creates the release in Gihub (using gh cli)
|
@@ -10,15 +10,15 @@
|
|
10
10
|
* Prerequisites:
|
11
11
|
* - zx installed (https://github.com/google/zx)
|
12
12
|
* - gh cli installed (https://cli.github.com/)
|
13
|
-
* - semver cli installed (https://github.com/fsaintjacques/semver-tool)
|
14
13
|
*
|
15
14
|
* Usage:
|
16
|
-
* zx ./release.mjs -v major/minor -n "release notes"
|
15
|
+
* yarn zx ./release.mjs -v major/minor -n "release notes"
|
17
16
|
* */
|
18
17
|
|
19
18
|
// don't output the commands themselves
|
20
19
|
$.verbose = false
|
21
20
|
|
21
|
+
const semver = require('semver')
|
22
22
|
const versionToBump = getVersionToBump()
|
23
23
|
const latestReleaseTag = await fetchLatestReleasedVersionNumber()
|
24
24
|
const latestVersion = removeLeadingV(latestReleaseTag)
|
@@ -49,7 +49,7 @@ async function fetchLatestReleasedVersionNumber() {
|
|
49
49
|
}
|
50
50
|
|
51
51
|
async function determineNextVersionNumber(previous) {
|
52
|
-
return (
|
52
|
+
return semver.inc(previous, versionToBump)
|
53
53
|
}
|
54
54
|
|
55
55
|
async function bumpVersionInFiles() {
|
data/seatsio.gemspec
CHANGED
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency "rake", "~> 13.0"
|
27
27
|
spec.add_development_dependency "minitest", "~> 5.0"
|
28
28
|
spec.add_development_dependency 'webmock', '~> 3.4', '>= 3.4.2'
|
29
|
-
spec.add_development_dependency '
|
29
|
+
spec.add_development_dependency 'parallel_tests', '~> 4.7.1'
|
30
30
|
end
|
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: 51.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seats.io
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -93,19 +93,19 @@ dependencies:
|
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: 3.4.2
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
96
|
+
name: parallel_tests
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: 4.7.1
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
108
|
+
version: 4.7.1
|
109
109
|
description: This is the official Ruby client library for the Seats.io V2 REST API
|
110
110
|
email:
|
111
111
|
- nahuel@seats.io
|
@@ -131,10 +131,10 @@ files:
|
|
131
131
|
- lib/seatsio/chart_reports.rb
|
132
132
|
- lib/seatsio/charts.rb
|
133
133
|
- lib/seatsio/domain.rb
|
134
|
+
- lib/seatsio/event_log.rb
|
134
135
|
- lib/seatsio/event_reports.rb
|
135
136
|
- lib/seatsio/events.rb
|
136
137
|
- lib/seatsio/events/change_best_available_object_status_request.rb
|
137
|
-
- lib/seatsio/events/change_object_status_in_batch_request.rb
|
138
138
|
- lib/seatsio/events/change_object_status_request.rb
|
139
139
|
- lib/seatsio/exception.rb
|
140
140
|
- lib/seatsio/hold_tokens.rb
|
@@ -1,6 +0,0 @@
|
|
1
|
-
def create_change_object_status_in_batch_request(event_key, object_or_objects, status, hold_token = nil , order_id = nil, keep_extra_data = nil, ignore_channels = nil, channel_keys = nil)
|
2
|
-
result = create_change_object_status_request(object_or_objects, status, hold_token, order_id, '', keep_extra_data, ignore_channels, channel_keys)
|
3
|
-
result.delete(:events)
|
4
|
-
result[:event] = event_key
|
5
|
-
result
|
6
|
-
end
|