seatsio 35.3.0 → 36.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '04119e53fff832a017f6e2b8976af5006b59ec234d45d926ad9dc786d70dfcc4'
4
- data.tar.gz: 06d4f2e2ea5307fe7fdcdde2f5f2b757ac8514bc1f5be6fb3fb689a27e6f5060
3
+ metadata.gz: 51b6694e67b96449da75241064889f2cafefafcd19ce9681068243811e4e7139
4
+ data.tar.gz: '049e16db09bbca9860f4bd59544eeaa33e9515e220526f5e6ebec8195556fd2d'
5
5
  SHA512:
6
- metadata.gz: c7e4439a3bcd67965ec3bb38e16a855085d13fec62f5fa778ecf60cf27a16983c1029455270e6b35c2b29680306d04e43b224192a287bcba39a6c6ab9fc07478
7
- data.tar.gz: 361bd672805ef4cadd8789dd61ecc187dac2c7fe86eae8cf66229fefd09bb85d45fdd7539921ccff37d00a8e8ff68ee5d366e700caaeab514ec5b19c8da84b82
6
+ metadata.gz: 0ffe2521637b1b337eb70d79aac50271f1534811960c40b5fd4c60757e88aa0853bf84c1e8c0ed004ba7612cc3d9019bd668f0757619ddfd167cc8c02aeb6a04
7
+ data.tar.gz: 44904bc6ff34588a454dcaa501136be6f6b577fa8a039b3c866737e0cf13c1da98d1bf37193f3f95983cce19dd46351acd2fea9b1552d33e9e2cc8ecf10df82e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (35.3.0)
4
+ seatsio (36.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
- |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'])]
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
- self.name == other.name &&
119
- self.color == other.color &&
120
- self.index == other.index &&
121
- self.objects == other.objects
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
@@ -127,7 +127,9 @@ module Seatsio
127
127
 
128
128
  attr_accessor :id, :key, :chart_key, :supports_best_available,
129
129
  :table_booking_config, :for_sale_config, :created_on, :updated_on, :channels,
130
- :social_distancing_ruleset_key
130
+ :social_distancing_ruleset_key, :is_top_level_season, :is_partial_season,
131
+ :is_event_in_season, :top_level_season_key,
132
+ :social_distancing_ruleset_key, :object_categories
131
133
 
132
134
  def initialize(data)
133
135
  @id = data['id']
@@ -139,19 +141,51 @@ module Seatsio
139
141
  @created_on = parse_date(data['createdOn'])
140
142
  @updated_on = parse_date(data['updatedOn'])
141
143
  @channels = data['channels'].map {
142
- |d| Channel.new(d['key'], d['name'], d['color'], d['index'], d['objects'])
144
+ |d| Channel.new(d['key'], d['name'], d['color'], d['index'], d['objects'])
143
145
  } if data['channels']
144
146
  @social_distancing_ruleset_key = data['socialDistancingRulesetKey']
147
+ @is_top_level_season = data['isTopLevelSeason']
148
+ @is_partial_season = data['isPartialSeason']
149
+ @is_event_in_season = data['isEventInSeason']
150
+ @top_level_season_key = data['topLevelSeasonKey']
151
+ @object_categories = data['objectCategories']
152
+ end
153
+
154
+ def is_season
155
+ false
156
+ end
157
+
158
+ def self.from_json(data)
159
+ if data['isSeason']
160
+ Season.new(data)
161
+ else
162
+ Event.new(data)
163
+ end
145
164
  end
146
165
 
147
166
  def self.create_list(list = [])
148
167
  result = []
149
168
 
150
169
  list.each do |item|
151
- result << Event.new(item)
170
+ result << Event.from_json(item)
152
171
  end
153
172
 
154
- return result
173
+ result
174
+ end
175
+ end
176
+
177
+ class Season < Event
178
+
179
+ attr_accessor :partial_season_keys, :events
180
+
181
+ def initialize(data)
182
+ super(data)
183
+ @partial_season_keys = data['partialSeasonKeys']
184
+ @events = data['events'] ? Event.create_list(data['events']) : nil
185
+ end
186
+
187
+ def is_season
188
+ true
155
189
  end
156
190
  end
157
191
 
@@ -521,41 +555,41 @@ module Seatsio
521
555
  end
522
556
 
523
557
  def self.fixed(name, disabled_seats: [], index: 0)
524
- return SocialDistancingRuleset.new(name, index: index, disabled_seats: disabled_seats, fixed_group_layout: true)
558
+ SocialDistancingRuleset.new(name, index: index, disabled_seats: disabled_seats, fixed_group_layout: true)
525
559
  end
526
560
 
527
561
  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
562
  number_of_disabled_aisle_seats: 0, max_group_size: 0, max_occupancy_absolute: 0, max_occupancy_percentage: 0, one_group_per_table: false,
529
563
  disabled_seats: [], enabled_seats: [], index: 0)
530
- return SocialDistancingRuleset.new(name,
531
- number_of_disabled_seats_to_the_sides: number_of_disabled_seats_to_the_sides,
532
- disable_seats_in_front_and_behind: disable_seats_in_front_and_behind,
533
- disable_diagonal_seats_in_front_and_behind: disable_diagonal_seats_in_front_and_behind,
534
- number_of_disabled_aisle_seats: number_of_disabled_aisle_seats,
535
- max_group_size: max_group_size,
536
- max_occupancy_absolute: max_occupancy_absolute,
537
- max_occupancy_percentage: max_occupancy_percentage,
538
- one_group_per_table: one_group_per_table,
539
- fixed_group_layout: false,
540
- disabled_seats: disabled_seats,
541
- enabled_seats: enabled_seats,
542
- index: index)
564
+ SocialDistancingRuleset.new(name,
565
+ number_of_disabled_seats_to_the_sides: number_of_disabled_seats_to_the_sides,
566
+ disable_seats_in_front_and_behind: disable_seats_in_front_and_behind,
567
+ disable_diagonal_seats_in_front_and_behind: disable_diagonal_seats_in_front_and_behind,
568
+ number_of_disabled_aisle_seats: number_of_disabled_aisle_seats,
569
+ max_group_size: max_group_size,
570
+ max_occupancy_absolute: max_occupancy_absolute,
571
+ max_occupancy_percentage: max_occupancy_percentage,
572
+ one_group_per_table: one_group_per_table,
573
+ fixed_group_layout: false,
574
+ disabled_seats: disabled_seats,
575
+ enabled_seats: enabled_seats,
576
+ index: index)
543
577
  end
544
578
 
545
579
  def == (other)
546
580
  self.name == other.name &&
547
- self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
548
- self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
549
- self.disable_diagonal_seats_in_front_and_behind == other.disable_diagonal_seats_in_front_and_behind &&
550
- self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
551
- self.max_group_size == other.max_group_size &&
552
- self.max_occupancy_absolute == other.max_occupancy_absolute &&
553
- self.max_occupancy_percentage == other.max_occupancy_percentage &&
554
- self.one_group_per_table == other.one_group_per_table &&
555
- self.fixed_group_layout == other.fixed_group_layout &&
556
- self.disabled_seats == other.disabled_seats &&
557
- self.enabled_seats == other.enabled_seats &&
558
- self.index == other.index
581
+ self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
582
+ self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
583
+ self.disable_diagonal_seats_in_front_and_behind == other.disable_diagonal_seats_in_front_and_behind &&
584
+ self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
585
+ self.max_group_size == other.max_group_size &&
586
+ self.max_occupancy_absolute == other.max_occupancy_absolute &&
587
+ self.max_occupancy_percentage == other.max_occupancy_percentage &&
588
+ self.one_group_per_table == other.one_group_per_table &&
589
+ self.fixed_group_layout == other.fixed_group_layout &&
590
+ self.disabled_seats == other.disabled_seats &&
591
+ self.enabled_seats == other.enabled_seats &&
592
+ self.index == other.index
559
593
  end
560
594
  end
561
595
 
@@ -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
 
@@ -15,9 +14,11 @@ module Seatsio
15
14
  @http_client = http_client
16
15
  end
17
16
 
18
- def create(chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil)
17
+ def create(chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil, object_categories: nil)
19
18
  payload = build_event_request(chart_key: chart_key, event_key: event_key,
20
- table_booking_config: table_booking_config, social_distancing_ruleset_key: social_distancing_ruleset_key)
19
+ table_booking_config: table_booking_config,
20
+ social_distancing_ruleset_key: social_distancing_ruleset_key,
21
+ object_categories: object_categories)
21
22
  response = @http_client.post("events", payload)
22
23
  Event.new(response)
23
24
  end
@@ -28,8 +29,8 @@ module Seatsio
28
29
  Events.new(response).events
29
30
  end
30
31
 
31
- def update(key:, chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil)
32
- payload = build_event_request(chart_key: chart_key, event_key: event_key, table_booking_config: table_booking_config, social_distancing_ruleset_key: social_distancing_ruleset_key)
32
+ def update(key:, chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil, object_categories: nil)
33
+ payload = build_event_request(chart_key: chart_key, event_key: event_key, table_booking_config: table_booking_config, social_distancing_ruleset_key: social_distancing_ruleset_key, object_categories: object_categories)
33
34
  @http_client.post("/events/#{key}", payload)
34
35
  end
35
36
 
@@ -108,7 +109,7 @@ module Seatsio
108
109
 
109
110
  def retrieve(key:)
110
111
  response = @http_client.get("events/#{key}")
111
- Event.new(response)
112
+ Event.from_json(response)
112
113
  end
113
114
 
114
115
  def list
@@ -164,12 +165,13 @@ module Seatsio
164
165
  payload
165
166
  end
166
167
 
167
- def build_event_request(chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil)
168
+ def build_event_request(chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil, object_categories: nil)
168
169
  result = {}
169
170
  result["chartKey"] = chart_key if chart_key
170
171
  result["eventKey"] = event_key if event_key
171
172
  result["tableBookingConfig"] = table_booking_config_to_request(table_booking_config) if table_booking_config != nil
172
173
  result["socialDistancingRulesetKey"] = social_distancing_ruleset_key if social_distancing_ruleset_key != nil
174
+ result["objectCategories"] = object_categories if object_categories != nil
173
175
  result
174
176
  end
175
177
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "35.3.0"
2
+ VERSION = "36.2.0"
3
3
  end
@@ -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
 
9
8
  module Seatsio
10
9
  class WorkspacesClient
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: 35.3.0
4
+ version: 36.2.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-01 00:00:00.000000000 Z
11
+ date: 2022-02-24 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