seatsio 35.2.0 → 36.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 621bb856b807e82315540bb575ea947feb75cb3e7807adbd25cf0a7b74393aeb
4
- data.tar.gz: 1ea9af6b8e43f3ac4a4cd85fcf7cce0fe03aa46919e5d4d7ca219439b97e33ab
3
+ metadata.gz: 30626fb04f674a3c57bf42734608309677d5d05628a92c7c836f404a4fa0076c
4
+ data.tar.gz: 92d1834db424831a0eec2b190f6f25db3a468cfc0c952e93bf2c82dfcf3ff263
5
5
  SHA512:
6
- metadata.gz: a48e05fe8cc84746c3d9cc32e0e4eebf04b17e0654107524a19d384157a43b646ce6b5c3a4698a7461c28574c275c307c3d2d149eebf31827fdcbca7834cdb51
7
- data.tar.gz: f12a0b1a9deb661e5340b3d1419b4846cbb3b3f835e5a2e084bbd103f76ab8cf1f863e3cbf4daea263ee0837e5a67fc1f2bd1d94a68e442ae79d65f1610c9388
6
+ metadata.gz: b1cd7d244ab20302cfa260a2d8227028e37694187be91fa8f4e62bdbdda68703acc40afc779ef204389493e0486acc8d926e8aefd855a1a7ead5dcc88c18a107
7
+ data.tar.gz: 684cbb5146969a8771e7b8fa5e6ec6d05f99508ad464f663539d93b85478507c3db977fb62080914b8189df7a3d5fd60c9fcd3a59f0907ad296fefe2e77d5307
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (35.2.0)
4
+ seatsio (36.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,53 +11,54 @@ module Seatsio
11
11
  end
12
12
 
13
13
  def by_label(chart_key, book_whole_tables = nil)
14
- get_chart_report('byLabel', chart_key, book_whole_tables)
14
+ fetch_chart_report('byLabel', chart_key, book_whole_tables)
15
15
  end
16
16
 
17
17
  def by_object_type(chart_key, book_whole_tables = nil)
18
- get_chart_report('byObjectType', chart_key, book_whole_tables)
18
+ fetch_chart_report('byObjectType', chart_key, book_whole_tables)
19
19
  end
20
20
 
21
- def summary_by_object_type(chart_key)
22
- fetch_summary_report('byObjectType', chart_key)
21
+ def summary_by_object_type(chart_key, book_whole_tables = nil)
22
+ fetch_summary_report('byObjectType', chart_key, book_whole_tables)
23
23
  end
24
24
 
25
25
  def by_category_key(chart_key, book_whole_tables = nil)
26
- get_chart_report('byCategoryKey', chart_key, book_whole_tables)
26
+ fetch_chart_report('byCategoryKey', chart_key, book_whole_tables)
27
27
  end
28
28
 
29
- def summary_by_category_key(chart_key)
30
- fetch_summary_report('byCategoryKey', chart_key)
29
+ def summary_by_category_key(chart_key, book_whole_tables = nil)
30
+ fetch_summary_report('byCategoryKey', chart_key, book_whole_tables)
31
31
  end
32
32
 
33
33
  def by_category_label(chart_key, book_whole_tables = nil)
34
- get_chart_report('byCategoryLabel', chart_key, book_whole_tables)
34
+ fetch_chart_report('byCategoryLabel', chart_key, book_whole_tables)
35
35
  end
36
36
 
37
- def summary_by_category_label(chart_key)
38
- fetch_summary_report('byCategoryLabel', chart_key)
37
+ def summary_by_category_label(chart_key, book_whole_tables = nil)
38
+ fetch_summary_report('byCategoryLabel', chart_key, book_whole_tables)
39
39
  end
40
40
 
41
41
  def by_section(chart_key, book_whole_tables = nil)
42
- get_chart_report('bySection', chart_key, book_whole_tables)
42
+ fetch_chart_report('bySection', chart_key, book_whole_tables)
43
43
  end
44
44
 
45
- def summary_by_section(event_key)
46
- fetch_summary_report('bySection', event_key)
45
+ def summary_by_section(event_key, book_whole_tables = nil)
46
+ fetch_summary_report('bySection', event_key, book_whole_tables)
47
47
  end
48
48
 
49
49
  private
50
50
 
51
- def get_chart_report(report_type, chart_key, book_whole_tables)
51
+ def fetch_chart_report(report_type, chart_key, book_whole_tables)
52
52
  params = book_whole_tables.nil? ? {} : { bookWholeTables: book_whole_tables }
53
53
  url = "reports/charts/#{chart_key}/#{report_type}"
54
54
  body = @http_client.get(url, params)
55
55
  ChartReport.new(body)
56
56
  end
57
57
 
58
- def fetch_summary_report(report_type, event_key)
58
+ def fetch_summary_report(report_type, event_key, book_whole_tables)
59
+ params = book_whole_tables.nil? ? {} : { bookWholeTables: book_whole_tables }
59
60
  url = "reports/charts/#{event_key}/#{report_type}/summary"
60
- @http_client.get(url)
61
+ @http_client.get(url, params)
61
62
  end
62
63
  end
63
64
  end
@@ -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,8 @@ 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
131
132
 
132
133
  def initialize(data)
133
134
  @id = data['id']
@@ -139,19 +140,50 @@ module Seatsio
139
140
  @created_on = parse_date(data['createdOn'])
140
141
  @updated_on = parse_date(data['updatedOn'])
141
142
  @channels = data['channels'].map {
142
- |d| Channel.new(d['key'], d['name'], d['color'], d['index'], d['objects'])
143
+ |d| Channel.new(d['key'], d['name'], d['color'], d['index'], d['objects'])
143
144
  } if data['channels']
144
145
  @social_distancing_ruleset_key = data['socialDistancingRulesetKey']
146
+ @is_top_level_season = data['isTopLevelSeason']
147
+ @is_partial_season = data['isPartialSeason']
148
+ @is_event_in_season = data['isEventInSeason']
149
+ @top_level_season_key = data['topLevelSeasonKey']
150
+ end
151
+
152
+ def is_season
153
+ false
154
+ end
155
+
156
+ def self.from_json(data)
157
+ if data['isSeason']
158
+ Season.new(data)
159
+ else
160
+ Event.new(data)
161
+ end
145
162
  end
146
163
 
147
164
  def self.create_list(list = [])
148
165
  result = []
149
166
 
150
167
  list.each do |item|
151
- result << Event.new(item)
168
+ result << Event.from_json(item)
152
169
  end
153
170
 
154
- return result
171
+ result
172
+ end
173
+ end
174
+
175
+ class Season < Event
176
+
177
+ attr_accessor :partial_season_keys, :events
178
+
179
+ def initialize(data)
180
+ super(data)
181
+ @partial_season_keys = data['partialSeasonKeys']
182
+ @events = data['events'] ? Event.create_list(data['events']) : nil
183
+ end
184
+
185
+ def is_season
186
+ true
155
187
  end
156
188
  end
157
189
 
@@ -521,41 +553,41 @@ module Seatsio
521
553
  end
522
554
 
523
555
  def self.fixed(name, disabled_seats: [], index: 0)
524
- return SocialDistancingRuleset.new(name, index: index, disabled_seats: disabled_seats, fixed_group_layout: true)
556
+ SocialDistancingRuleset.new(name, index: index, disabled_seats: disabled_seats, fixed_group_layout: true)
525
557
  end
526
558
 
527
559
  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
560
  number_of_disabled_aisle_seats: 0, max_group_size: 0, max_occupancy_absolute: 0, max_occupancy_percentage: 0, one_group_per_table: false,
529
561
  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)
562
+ SocialDistancingRuleset.new(name,
563
+ number_of_disabled_seats_to_the_sides: number_of_disabled_seats_to_the_sides,
564
+ disable_seats_in_front_and_behind: disable_seats_in_front_and_behind,
565
+ disable_diagonal_seats_in_front_and_behind: disable_diagonal_seats_in_front_and_behind,
566
+ number_of_disabled_aisle_seats: number_of_disabled_aisle_seats,
567
+ max_group_size: max_group_size,
568
+ max_occupancy_absolute: max_occupancy_absolute,
569
+ max_occupancy_percentage: max_occupancy_percentage,
570
+ one_group_per_table: one_group_per_table,
571
+ fixed_group_layout: false,
572
+ disabled_seats: disabled_seats,
573
+ enabled_seats: enabled_seats,
574
+ index: index)
543
575
  end
544
576
 
545
577
  def == (other)
546
578
  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
579
+ self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
580
+ self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
581
+ self.disable_diagonal_seats_in_front_and_behind == other.disable_diagonal_seats_in_front_and_behind &&
582
+ self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
583
+ self.max_group_size == other.max_group_size &&
584
+ self.max_occupancy_absolute == other.max_occupancy_absolute &&
585
+ self.max_occupancy_percentage == other.max_occupancy_percentage &&
586
+ self.one_group_per_table == other.one_group_per_table &&
587
+ self.fixed_group_layout == other.fixed_group_layout &&
588
+ self.disabled_seats == other.disabled_seats &&
589
+ self.enabled_seats == other.enabled_seats &&
590
+ self.index == other.index
559
591
  end
560
592
  end
561
593
 
@@ -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.new(response)
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
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "35.2.0"
2
+ VERSION = "36.1.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.2.0
4
+ version: 36.1.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-01-31 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