seatsio 35.3.0 → 36.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/seatsio/domain.rb +73 -46
- data/lib/seatsio/events.rb +1 -2
- data/lib/seatsio/pagination/cursor.rb +1 -1
- data/lib/seatsio/seasons.rb +77 -0
- data/lib/seatsio/version.rb +1 -1
- data/lib/seatsio/workspaces.rb +0 -1
- data/lib/seatsio.rb +3 -3
- 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: 229d0d1752b24b273a977af9c0547f5aba5035756a438b7e7b8f8ca249a38473
|
4
|
+
data.tar.gz: a2fdbca2977e4b07e02680cd3c586bc5d360acb7709668a970b4dd12c737cb51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a54ead9e014c28239e158da656661013ae7ca9f5b743c7e5c13c18844884c39c16fe80515389d0e0141f7b596f964da17f1b460fd6b64dcf3301fe51599afe82
|
7
|
+
data.tar.gz: a9cc825746a3aa613013efa4aad2ddd03ba8b7a47a1850db032e877d5e5239a64fada00ece19e7504cbcf1c72e40674b1dd74871b457295def38ba841a5646c8
|
data/Gemfile.lock
CHANGED
data/lib/seatsio/domain.rb
CHANGED
@@ -22,19 +22,19 @@ module Seatsio
|
|
22
22
|
@archived = data['archived']
|
23
23
|
@validation = data['validation']
|
24
24
|
@social_distancing_rulesets = data['socialDistancingRulesets'].map {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
25
|
+
|key, r| [key, SocialDistancingRuleset.new(r['name'],
|
26
|
+
number_of_disabled_seats_to_the_sides: r['numberOfDisabledSeatsToTheSides'],
|
27
|
+
disable_seats_in_front_and_behind: r['disableSeatsInFrontAndBehind'],
|
28
|
+
disable_diagonal_seats_in_front_and_behind: r['disableDiagonalSeatsInFrontAndBehind'],
|
29
|
+
number_of_disabled_aisle_seats: r['numberOfDisabledAisleSeats'],
|
30
|
+
max_group_size: r['maxGroupSize'],
|
31
|
+
max_occupancy_absolute: r['maxOccupancyAbsolute'],
|
32
|
+
max_occupancy_percentage: r['maxOccupancyPercentage'],
|
33
|
+
one_group_per_table: r['oneGroupPerTable'],
|
34
|
+
fixed_group_layout: r['fixedGroupLayout'],
|
35
|
+
disabled_seats: r['disabledSeats'],
|
36
|
+
enabled_seats: r['enabledSeats'],
|
37
|
+
index: r['index'])]
|
38
38
|
}.to_h
|
39
39
|
end
|
40
40
|
end
|
@@ -115,10 +115,10 @@ module Seatsio
|
|
115
115
|
|
116
116
|
def == (other)
|
117
117
|
self.key == other.key &&
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
self.name == other.name &&
|
119
|
+
self.color == other.color &&
|
120
|
+
self.index == other.index &&
|
121
|
+
self.objects == other.objects
|
122
122
|
end
|
123
123
|
|
124
124
|
end
|
@@ -139,19 +139,46 @@ module Seatsio
|
|
139
139
|
@created_on = parse_date(data['createdOn'])
|
140
140
|
@updated_on = parse_date(data['updatedOn'])
|
141
141
|
@channels = data['channels'].map {
|
142
|
-
|
142
|
+
|d| Channel.new(d['key'], d['name'], d['color'], d['index'], d['objects'])
|
143
143
|
} if data['channels']
|
144
144
|
@social_distancing_ruleset_key = data['socialDistancingRulesetKey']
|
145
145
|
end
|
146
146
|
|
147
|
+
def is_season
|
148
|
+
false
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.from_json(data)
|
152
|
+
if data['isSeason']
|
153
|
+
Season.new(data)
|
154
|
+
else
|
155
|
+
Event.new(data)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
147
159
|
def self.create_list(list = [])
|
148
160
|
result = []
|
149
161
|
|
150
162
|
list.each do |item|
|
151
|
-
result << Event.
|
163
|
+
result << Event.from_json(item)
|
152
164
|
end
|
153
165
|
|
154
|
-
|
166
|
+
result
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
class Season < Event
|
171
|
+
|
172
|
+
attr_accessor :partial_season_keys, :events
|
173
|
+
|
174
|
+
def initialize(data)
|
175
|
+
super(data)
|
176
|
+
@partial_season_keys = data['partialSeasonKeys']
|
177
|
+
@events = data['events'] ? Event.create_list(data['events']) : nil
|
178
|
+
end
|
179
|
+
|
180
|
+
def is_season
|
181
|
+
true
|
155
182
|
end
|
156
183
|
end
|
157
184
|
|
@@ -521,41 +548,41 @@ module Seatsio
|
|
521
548
|
end
|
522
549
|
|
523
550
|
def self.fixed(name, disabled_seats: [], index: 0)
|
524
|
-
|
551
|
+
SocialDistancingRuleset.new(name, index: index, disabled_seats: disabled_seats, fixed_group_layout: true)
|
525
552
|
end
|
526
553
|
|
527
554
|
def self.rule_based(name, number_of_disabled_seats_to_the_sides: 0, disable_seats_in_front_and_behind: false, disable_diagonal_seats_in_front_and_behind: false,
|
528
555
|
number_of_disabled_aisle_seats: 0, max_group_size: 0, max_occupancy_absolute: 0, max_occupancy_percentage: 0, one_group_per_table: false,
|
529
556
|
disabled_seats: [], enabled_seats: [], index: 0)
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
557
|
+
SocialDistancingRuleset.new(name,
|
558
|
+
number_of_disabled_seats_to_the_sides: number_of_disabled_seats_to_the_sides,
|
559
|
+
disable_seats_in_front_and_behind: disable_seats_in_front_and_behind,
|
560
|
+
disable_diagonal_seats_in_front_and_behind: disable_diagonal_seats_in_front_and_behind,
|
561
|
+
number_of_disabled_aisle_seats: number_of_disabled_aisle_seats,
|
562
|
+
max_group_size: max_group_size,
|
563
|
+
max_occupancy_absolute: max_occupancy_absolute,
|
564
|
+
max_occupancy_percentage: max_occupancy_percentage,
|
565
|
+
one_group_per_table: one_group_per_table,
|
566
|
+
fixed_group_layout: false,
|
567
|
+
disabled_seats: disabled_seats,
|
568
|
+
enabled_seats: enabled_seats,
|
569
|
+
index: index)
|
543
570
|
end
|
544
571
|
|
545
572
|
def == (other)
|
546
573
|
self.name == other.name &&
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
574
|
+
self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
|
575
|
+
self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
|
576
|
+
self.disable_diagonal_seats_in_front_and_behind == other.disable_diagonal_seats_in_front_and_behind &&
|
577
|
+
self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
|
578
|
+
self.max_group_size == other.max_group_size &&
|
579
|
+
self.max_occupancy_absolute == other.max_occupancy_absolute &&
|
580
|
+
self.max_occupancy_percentage == other.max_occupancy_percentage &&
|
581
|
+
self.one_group_per_table == other.one_group_per_table &&
|
582
|
+
self.fixed_group_layout == other.fixed_group_layout &&
|
583
|
+
self.disabled_seats == other.disabled_seats &&
|
584
|
+
self.enabled_seats == other.enabled_seats &&
|
585
|
+
self.index == other.index
|
559
586
|
end
|
560
587
|
end
|
561
588
|
|
data/lib/seatsio/events.rb
CHANGED
@@ -4,7 +4,6 @@ require "seatsio/httpClient"
|
|
4
4
|
require "seatsio/domain"
|
5
5
|
require "json"
|
6
6
|
require "cgi"
|
7
|
-
require "seatsio/domain"
|
8
7
|
require "seatsio/events/change_object_status_request"
|
9
8
|
require "seatsio/events/change_best_available_object_status_request"
|
10
9
|
|
@@ -108,7 +107,7 @@ module Seatsio
|
|
108
107
|
|
109
108
|
def retrieve(key:)
|
110
109
|
response = @http_client.get("events/#{key}")
|
111
|
-
Event.
|
110
|
+
Event.from_json(response)
|
112
111
|
end
|
113
112
|
|
114
113
|
def list
|
@@ -85,7 +85,7 @@ module Seatsio
|
|
85
85
|
items = response['items']
|
86
86
|
parsed_items = []
|
87
87
|
|
88
|
-
items.each {|item| parsed_items << @cls.new(item)}
|
88
|
+
items.each {|item| parsed_items << (@cls.respond_to?(:from_json) ? @cls.from_json(item) : @cls.new(item))}
|
89
89
|
|
90
90
|
@collection += parsed_items
|
91
91
|
set_query_param(:start_after_id, items.last['id']) unless last?
|
@@ -0,0 +1,77 @@
|
|
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
|
+
|
10
|
+
class SeasonsClient
|
11
|
+
def initialize(http_client, seatsio_client)
|
12
|
+
@http_client = http_client
|
13
|
+
@seatsio_client = seatsio_client
|
14
|
+
end
|
15
|
+
|
16
|
+
def create(chart_key:, key: nil, number_of_events: nil, event_keys: nil,
|
17
|
+
table_booking_config: nil, social_distancing_ruleset_key: nil)
|
18
|
+
request = build_create_season_request(chart_key: chart_key, key: key, number_of_events: number_of_events, event_keys: event_keys,
|
19
|
+
table_booking_config: table_booking_config, social_distancing_ruleset_key: social_distancing_ruleset_key)
|
20
|
+
response = @http_client.post('seasons', request)
|
21
|
+
Season.new(response)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_partial_season(top_level_season_key:, partial_season_key: nil, event_keys: nil)
|
25
|
+
request = {}
|
26
|
+
request['key'] = partial_season_key if partial_season_key
|
27
|
+
request['eventKeys'] = event_keys if event_keys
|
28
|
+
response = @http_client.post("/seasons/#{top_level_season_key}/partial-seasons", request)
|
29
|
+
Season.new(response)
|
30
|
+
end
|
31
|
+
|
32
|
+
def retrieve(key:)
|
33
|
+
@seatsio_client.events.retrieve(key: key)
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_events(key:, number_of_events: nil, event_keys: nil)
|
37
|
+
request = {}
|
38
|
+
request['eventKeys'] = event_keys if event_keys
|
39
|
+
request['numberOfEvents'] = number_of_events if number_of_events
|
40
|
+
response = @http_client.post("/seasons/#{key}/actions/create-events", request)
|
41
|
+
Season.new(response)
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_events_to_partial_season(top_level_season_key:, partial_season_key:, event_keys:)
|
45
|
+
request = {}
|
46
|
+
request['eventKeys'] = event_keys
|
47
|
+
response = @http_client.post("/seasons/#{top_level_season_key}/partial-seasons/#{partial_season_key}/actions/add-events", request)
|
48
|
+
Season.new(response)
|
49
|
+
end
|
50
|
+
|
51
|
+
def remove_event_from_partial_season(top_level_season_key:, partial_season_key:, event_key:)
|
52
|
+
response = @http_client.delete("/seasons/#{top_level_season_key}/partial-seasons/#{partial_season_key}/events/#{event_key}")
|
53
|
+
Season.new(response)
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def build_create_season_request(chart_key: nil, key: nil, number_of_events: nil, event_keys: nil, table_booking_config: nil, social_distancing_ruleset_key: nil)
|
59
|
+
request = {}
|
60
|
+
request['chartKey'] = chart_key if chart_key
|
61
|
+
request['key'] = key if key
|
62
|
+
request['numberOfEvents'] = number_of_events if number_of_events
|
63
|
+
request['eventKeys'] = event_keys if event_keys
|
64
|
+
request['tableBookingConfig'] = table_booking_config_to_request(table_booking_config) if table_booking_config != nil
|
65
|
+
request['socialDistancingRulesetKey'] = social_distancing_ruleset_key if social_distancing_ruleset_key != nil
|
66
|
+
request
|
67
|
+
end
|
68
|
+
|
69
|
+
def table_booking_config_to_request(table_booking_config)
|
70
|
+
request = {}
|
71
|
+
request['mode'] = table_booking_config.mode
|
72
|
+
request['tables'] = table_booking_config.tables if table_booking_config.tables != nil
|
73
|
+
request
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
data/lib/seatsio/version.rb
CHANGED
data/lib/seatsio/workspaces.rb
CHANGED
data/lib/seatsio.rb
CHANGED
@@ -3,6 +3,7 @@ require 'seatsio/charts'
|
|
3
3
|
require 'seatsio/subaccounts'
|
4
4
|
require 'seatsio/workspaces'
|
5
5
|
require 'seatsio/events'
|
6
|
+
require 'seatsio/seasons'
|
6
7
|
require 'seatsio/hold_tokens'
|
7
8
|
require 'seatsio/chart_reports'
|
8
9
|
require 'seatsio/event_reports'
|
@@ -10,7 +11,7 @@ require 'seatsio/usage_reports'
|
|
10
11
|
|
11
12
|
module Seatsio
|
12
13
|
class Client
|
13
|
-
attr_reader :charts, :subaccounts, :workspaces, :events,
|
14
|
+
attr_reader :charts, :subaccounts, :workspaces, :events, :seasons,
|
14
15
|
:hold_tokens, :chart_reports, :event_reports, :usage_reports
|
15
16
|
|
16
17
|
def initialize(region, secret_key, workspace_key = nil, max_retries = 5)
|
@@ -20,15 +21,14 @@ module Seatsio
|
|
20
21
|
@subaccounts = SubaccountsClient.new(@http_client)
|
21
22
|
@workspaces = WorkspacesClient.new(@http_client)
|
22
23
|
@events = EventsClient.new(@http_client)
|
24
|
+
@seasons = SeasonsClient.new(@http_client, self)
|
23
25
|
@hold_tokens = HoldTokensClient.new(@http_client)
|
24
26
|
@chart_reports = ChartReportsClient.new(@http_client)
|
25
27
|
@event_reports = EventReportsClient.new(@http_client)
|
26
28
|
@usage_reports = UsageReportsClient.new(@http_client)
|
27
29
|
end
|
28
|
-
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
32
|
class Region
|
33
33
|
attr_reader :url
|
34
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: 36.0.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: 2022-02-
|
11
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- lib/seatsio/hold_tokens.rb
|
125
125
|
- lib/seatsio/httpClient.rb
|
126
126
|
- lib/seatsio/pagination/cursor.rb
|
127
|
+
- lib/seatsio/seasons.rb
|
127
128
|
- lib/seatsio/subaccounts.rb
|
128
129
|
- lib/seatsio/usage_reports.rb
|
129
130
|
- lib/seatsio/util.rb
|