seatsio 23.3.0 → 24.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78679456a042799c64713308f7e6a6139090ca1b0c0d08c5a32de82ad6eb7731
4
- data.tar.gz: b5b0df2f4b17558a04b728c3eaf5321e9fc06eb93b0035bd2a223a0c9e1f6c9e
3
+ metadata.gz: f3cf72acbe57a45bd74d47241f7906704097168f31e825b154fe724261857d76
4
+ data.tar.gz: 9774c91df2e28c5ab2a7b540ca3ba4cdbf2701665f660cee2d1455eb35c599ce
5
5
  SHA512:
6
- metadata.gz: d0fc8943339273274167cb968a8790670fe971d7d1d58d50a5ef68930bc08e8a3c0c5b4fd3694e33db441d5b4b44a59de3a3e561aabf90faba4f10c7a75db511
7
- data.tar.gz: dc254319de5d162e32251327aaacce360067d86cc51f7840e3f5075fe245cb89a4c1ac0beaf78f52a19e45708254dff0628db9f96c378ea7b6ea3c0bb53cca3d
6
+ metadata.gz: '049a91316ef289e8e860ac0330fd6577a984ef1f519ab6faff36f06980c672c141bb3c61f3489fd45dffc2c38de4030fb64246ac5c4d5bb53a5b79632de89511'
7
+ data.tar.gz: 5fd59d5b2ef28802b82a93cdea1f38eae108e8ea42fd2234fd51cd0415403c045b65b7fd3c2ec49242aad2381a7489dbbb3f2ee5e48eeedb1f303142eddeff45
@@ -0,0 +1 @@
1
+ 2.3.0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (23.3.0)
4
+ seatsio (24.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -47,4 +47,4 @@ DEPENDENCIES
47
47
  webmock (~> 3.4, >= 3.4.2)
48
48
 
49
49
  BUNDLED WITH
50
- 1.16.1
50
+ 1.17.2
data/README.md CHANGED
@@ -14,7 +14,7 @@ seatsio-ruby follows semver since v23.3.0.
14
14
 
15
15
  ```ruby
16
16
  require('seatsio')
17
- client = Seatsio::Client.new("my-secret-key") # can be found on https://app.seats.io/settings
17
+ client = Seatsio::Client.new("my-workspace-secret-key") # can be found on https://app.seats.io/workspace-settings
18
18
  chart = client.charts.create
19
19
  event = client.events.create key: chart.key
20
20
  ```
@@ -23,7 +23,7 @@ event = client.events.create key: chart.key
23
23
 
24
24
  ```ruby
25
25
  require('seatsio')
26
- client = Seatsio::Client.new("my-secret-key")
26
+ client = Seatsio::Client.new("my-workspace-secret-key")
27
27
  client.events.book(event.key, ["A-1", "A-2"])
28
28
  ```
29
29
 
@@ -31,7 +31,7 @@ client.events.book(event.key, ["A-1", "A-2"])
31
31
 
32
32
  ```ruby
33
33
  require('seatsio')
34
- client = Seatsio::Client.new("my-secret-key")
34
+ client = Seatsio::Client.new("my-workspace-secret-key")
35
35
  client.events.release(event.key, ["A-1", "A-2"])
36
36
  ```
37
37
 
@@ -39,7 +39,7 @@ client.events.release(event.key, ["A-1", "A-2"])
39
39
 
40
40
  ```ruby
41
41
  require('seatsio')
42
- client = Seatsio::Client.new("my-secret-key")
42
+ client = Seatsio::Client.new("my-workspace-secret-key")
43
43
  client.events.book(event.key, ["A-1", "A-2"], "a-hold-token")
44
44
  ```
45
45
 
@@ -47,7 +47,7 @@ client.events.book(event.key, ["A-1", "A-2"], "a-hold-token")
47
47
 
48
48
  ```ruby
49
49
  require('seatsio')
50
- client = Seatsio::Client.new("my-secret-key")
50
+ client = Seatsio::Client.new("my-workspace-secret-key")
51
51
  client.events.change_object_status("<EVENT KEY>", ["A-1", "A-2"], "my-custom-status")
52
52
  ```
53
53
 
@@ -55,7 +55,7 @@ client.events.change_object_status("", ["A-1", "A-2"], "my-custom-sta
55
55
 
56
56
  ```ruby
57
57
  require('seatsio')
58
- client = Seatsio::Client.new("my-secret-key")
58
+ client = Seatsio::Client.new("my-workspace-secret-key")
59
59
  charts = client.charts.list
60
60
  charts.each do |chart|
61
61
  puts chart.key
data/Rakefile CHANGED
@@ -8,4 +8,11 @@ Rake::TestTask.new(:test) do |t|
8
8
  t.warning = false
9
9
  end
10
10
 
11
+ Rake::TestTask.new(:singletest) do |t|
12
+ t.libs << "test"
13
+ t.libs << "lib"
14
+ t.test_files = FileList["test/**/update_channels_test.rb", "test/**/assign_objects_to_channels_test.rb"]
15
+ t.warning = false
16
+ end
17
+
11
18
  task :default => :test
@@ -69,13 +69,11 @@ module Seatsio
69
69
  end
70
70
 
71
71
  def retrieve_published_version(key)
72
- response = @http_client.get("charts/#{key}/version/published")
73
- Domain::Chart.new(response)
72
+ @http_client.get("charts/#{key}/version/published")
74
73
  end
75
74
 
76
75
  def retrieve_draft_version(key)
77
- response = @http_client.get("charts/#{key}/version/draft")
78
- Domain::ChartDraft.new(response)
76
+ @http_client.get("charts/#{key}/version/draft")
79
77
  end
80
78
 
81
79
  def retrieve_draft_version_thumbnail(key)
@@ -94,6 +92,11 @@ module Seatsio
94
92
  @http_client.post("charts/#{chart_key}/version/draft/actions/publish")
95
93
  end
96
94
 
95
+ def save_social_distancing_rulesets(chart_key, rulesets)
96
+ payload = {"socialDistancingRulesets": rulesets}
97
+ @http_client.post("charts/#{chart_key}/social-distancing-rulesets", payload)
98
+ end
99
+
97
100
  def list(chart_filter: nil, tag: nil, expand_events: nil, with_validation: false)
98
101
  cursor = Pagination::Cursor.new(Domain::Chart, 'charts', @http_client)
99
102
  cursor.set_query_param('filter', chart_filter)
@@ -4,25 +4,11 @@ module Seatsio::Domain
4
4
 
5
5
  module_function
6
6
 
7
- class ChartCategories
8
- attr_accessor :list, :max_category_key
9
-
10
- def initialize(data)
11
- if data
12
- @list = data['list']
13
- @max_category_key = data['maxCategoryKey']
14
- else
15
- @list = []
16
- @max_category_key = ''
17
- end
18
- end
19
- end
20
-
21
7
  class Chart
22
8
 
23
9
  attr_reader :id, :key, :status, :name, :published_version_thumbnail_url,
24
- :draft_version_thumbnail_url, :events, :tags, :archived, :venue_type,
25
- :categories, :validation
10
+ :draft_version_thumbnail_url, :events, :tags, :archived,
11
+ :categories, :validation, :social_distancing_rulesets
26
12
 
27
13
  def initialize(data)
28
14
  @id = data['id']
@@ -34,9 +20,12 @@ module Seatsio::Domain
34
20
  @events = Event.create_list(data['events']) if data['events']
35
21
  @tags = data['tags']
36
22
  @archived = data['archived']
37
- @venue_type = data['venueType']
38
- @categories = ChartCategories.new(data['categories'])
39
23
  @validation = data['validation']
24
+ @social_distancing_rulesets = data['socialDistancingRulesets'].map {
25
+ |key, r| [key, SocialDistancingRuleset.new(r['name'], r['numberOfDisabledSeatsToTheSides'], r['disableSeatsInFrontAndBehind'],
26
+ r['numberOfDisabledAisleSeats'], r['maxGroupSize'],
27
+ r['disabledSeats'], r['enabledSeats'], r['index'])]
28
+ }.to_h
40
29
  end
41
30
  end
42
31
 
@@ -71,10 +60,32 @@ module Seatsio::Domain
71
60
  end
72
61
  end
73
62
 
63
+ class Channel
64
+ attr_reader :key, :name, :color, :index, :objects
65
+
66
+ def initialize(key, name, color, index, objects)
67
+ @key = key
68
+ @name = name
69
+ @color = color
70
+ @index = index
71
+ @objects = objects
72
+ end
73
+
74
+ def == (other)
75
+ self.key == other.key &&
76
+ self.name == other.name &&
77
+ self.color == other.color &&
78
+ self.index == other.index &&
79
+ self.objects == other.objects
80
+ end
81
+
82
+ end
83
+
74
84
  class Event
75
85
 
76
86
  attr_accessor :id, :key, :chart_key, :book_whole_tables, :supports_best_available,
77
- :table_booking_modes, :for_sale_config, :created_on, :updated_on
87
+ :table_booking_modes, :for_sale_config, :created_on, :updated_on, :channels,
88
+ :social_distancing_ruleset_key
78
89
 
79
90
  def initialize(data)
80
91
  @id = data['id']
@@ -86,6 +97,10 @@ module Seatsio::Domain
86
97
  @for_sale_config = ForSaleConfig.new(data['forSaleConfig']) if data['forSaleConfig']
87
98
  @created_on = parse_date(data['createdOn'])
88
99
  @updated_on = parse_date(data['updatedOn'])
100
+ @channels = data['channels'].map {
101
+ |d| Channel.new(d['key'], d['name'], d['color'], d['index'], d['objects'])
102
+ } if data['channels']
103
+ @social_distancing_ruleset_key = data['socialDistancingRulesetKey']
89
104
  end
90
105
 
91
106
  def self.create_list(list = [])
@@ -205,7 +220,8 @@ module Seatsio::Domain
205
220
 
206
221
  class ChartReportItem
207
222
 
208
- attr_reader :label, :labels, :category_key, :category_label, :section, :entrance, :capacity, :object_type
223
+ attr_reader :label, :labels, :category_key, :category_label, :section, :entrance, :capacity, :object_type,
224
+ :left_neighbour, :right_neighbour
209
225
 
210
226
  def initialize(data)
211
227
  @label = data['label']
@@ -216,6 +232,8 @@ module Seatsio::Domain
216
232
  @entrance = data['entrance']
217
233
  @capacity = data['capacity']
218
234
  @object_type = data['objectType']
235
+ @left_neighbour = data['leftNeighbour']
236
+ @right_neighbour = data['rightNeighbour']
219
237
  end
220
238
  end
221
239
 
@@ -265,7 +283,8 @@ module Seatsio::Domain
265
283
  attr_reader :labels, :label, :order_id, :extra_data, :capacity, :status,
266
284
  :category_key, :entrance, :object_type, :hold_token, :category_label,
267
285
  :ticket_type, :num_booked, :num_free, :num_held, :for_sale, :section,
268
- :is_accessible, :is_companion_seat, :has_restricted_view, :displayed_object_type
286
+ :is_accessible, :is_companion_seat, :has_restricted_view, :displayed_object_type,
287
+ :left_neighbour, :right_neighbour, :is_selectable, :is_disabled_by_social_distancing
269
288
 
270
289
  def initialize(data)
271
290
  @status = data['status']
@@ -289,6 +308,10 @@ module Seatsio::Domain
289
308
  @is_companion_seat = data['isCompanionSeat']
290
309
  @has_restricted_view = data['hasRestrictedView']
291
310
  @displayed_object_type = data['displayedObjectType']
311
+ @left_neighbour = data['leftNeighbour']
312
+ @right_neighbour = data['rightNeighbour']
313
+ @is_selectable = data['isSelectable']
314
+ @is_disabled_by_social_distancing = data['isDisabledBySocialDistancing']
292
315
  end
293
316
  end
294
317
 
@@ -446,4 +469,33 @@ module Seatsio::Domain
446
469
  object_details
447
470
  end
448
471
 
472
+ class SocialDistancingRuleset
473
+ attr_reader :name, :number_of_disabled_seats_to_the_sides, :disable_seats_in_front_and_behind,
474
+ :number_of_disabled_aisle_seats, :max_group_size, :disabled_seats, :enabled_seats, :index
475
+
476
+ def initialize(name, number_of_disabled_seats_to_the_sides = 0, disable_seats_in_front_and_behind = false, number_of_disabled_aisle_seats = 0,
477
+ max_group_size = 0, disabled_seats = [], enabled_seats = [], index = 0)
478
+ @name = name
479
+ @number_of_disabled_seats_to_the_sides = number_of_disabled_seats_to_the_sides
480
+ @disable_seats_in_front_and_behind = disable_seats_in_front_and_behind
481
+ @number_of_disabled_aisle_seats = number_of_disabled_aisle_seats
482
+ @max_group_size = max_group_size
483
+ @disabled_seats = disabled_seats
484
+ @enabled_seats = enabled_seats
485
+ @index = index
486
+ end
487
+
488
+ def == (other)
489
+ self.name == other.name &&
490
+ self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
491
+ self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
492
+ self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
493
+ self.max_group_size == other.max_group_size &&
494
+ self.disabled_seats == other.disabled_seats &&
495
+ self.enabled_seats == other.enabled_seats &&
496
+ self.index == other.index
497
+ end
498
+
499
+ end
500
+
449
501
  end
@@ -27,6 +27,10 @@ module Seatsio
27
27
  fetch_summary_report('bySection', event_key)
28
28
  end
29
29
 
30
+ def summary_by_selectability(event_key)
31
+ fetch_summary_report('bySelectability', event_key)
32
+ end
33
+
30
34
  def by_label(event_key, label = nil)
31
35
  fetch_report('byLabel', event_key, label)
32
36
  end
@@ -51,6 +55,10 @@ module Seatsio
51
55
  fetch_report('bySection', event_key, section)
52
56
  end
53
57
 
58
+ def by_selectability(event_key, selectability = nil)
59
+ fetch_report('bySelectability', event_key, selectability)
60
+ end
61
+
54
62
  private
55
63
 
56
64
  def fetch_summary_report(report_type, event_key)
@@ -15,8 +15,9 @@ module Seatsio
15
15
  @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
16
16
  end
17
17
 
18
- def create(chart_key: nil, event_key: nil, book_whole_tables: nil, table_booking_modes: nil)
19
- payload = build_event_request(chart_key: chart_key, event_key: event_key, book_whole_tables: book_whole_tables, table_booking_modes: table_booking_modes)
18
+ def create(chart_key: nil, event_key: nil, book_whole_tables: nil, table_booking_modes: nil, social_distancing_ruleset_key: nil)
19
+ payload = build_event_request(chart_key: chart_key, event_key: event_key, book_whole_tables: book_whole_tables,
20
+ table_booking_modes: table_booking_modes, social_distancing_ruleset_key: social_distancing_ruleset_key)
20
21
  response = @http_client.post("events", payload)
21
22
  Domain::Event.new(response)
22
23
  end
@@ -27,8 +28,9 @@ module Seatsio
27
28
  Domain::Events.new(response).events
28
29
  end
29
30
 
30
- def update(key:, chart_key: nil, event_key: nil, book_whole_tables: nil, table_booking_modes: nil)
31
- payload = build_event_request(chart_key: chart_key, event_key: event_key, book_whole_tables: book_whole_tables, table_booking_modes: table_booking_modes)
31
+ def update(key:, chart_key: nil, event_key: nil, book_whole_tables: nil, table_booking_modes: nil, social_distancing_ruleset_key: nil)
32
+ payload = build_event_request(chart_key: chart_key, event_key: event_key, book_whole_tables: book_whole_tables,
33
+ table_booking_modes: table_booking_modes, social_distancing_ruleset_key: social_distancing_ruleset_key)
32
34
  @http_client.post("/events/#{key}", payload)
33
35
  end
34
36
 
@@ -136,6 +138,14 @@ module Seatsio
136
138
  @http_client.post("events/#{key}/actions/mark-as-for-sale", request)
137
139
  end
138
140
 
141
+ def update_channels(key:, channels:)
142
+ @http_client.post("events/#{key}/channels/update", channels: channels)
143
+ end
144
+
145
+ def assign_objects_to_channels(key:, channelConfig:)
146
+ @http_client.post("events/#{key}/channels/assign-objects", channelConfig: channelConfig)
147
+ end
148
+
139
149
  private
140
150
 
141
151
  def build_parameters_for_mark_as_sale(objects: nil, categories: nil)
@@ -151,12 +161,13 @@ module Seatsio
151
161
  payload
152
162
  end
153
163
 
154
- def build_event_request(chart_key: nil, event_key: nil, book_whole_tables: nil, table_booking_modes: nil)
164
+ def build_event_request(chart_key: nil, event_key: nil, book_whole_tables: nil, table_booking_modes: nil, social_distancing_ruleset_key: nil)
155
165
  result = {}
156
166
  result["chartKey"] = chart_key if chart_key
157
167
  result["eventKey"] = event_key if event_key
158
168
  result["bookWholeTables"] = book_whole_tables if book_whole_tables != nil
159
169
  result["tableBookingModes"] = table_booking_modes if table_booking_modes != nil
170
+ result["socialDistancingRulesetKey"] = social_distancing_ruleset_key if social_distancing_ruleset_key != nil
160
171
  result
161
172
  end
162
173
 
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "23.3.0"
2
+ VERSION = "24.1.0"
3
3
  end
@@ -27,6 +27,11 @@ module Seatsio
27
27
  @http_client.post("workspaces/#{key}", body)
28
28
  end
29
29
 
30
+ def regenerate_secret_key(key:)
31
+ response = @http_client.post("workspaces/#{key}/actions/regenerate-secret-key")
32
+ response['secretKey']
33
+ end
34
+
30
35
  def list(filter: nil)
31
36
  extended_cursor = cursor
32
37
  extended_cursor.set_query_param('filter', filter)
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: 23.3.0
4
+ version: 24.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: 2020-03-13 00:00:00.000000000 Z
11
+ date: 2020-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,6 +101,7 @@ extra_rdoc_files: []
101
101
  files:
102
102
  - ".editorconfig"
103
103
  - ".gitignore"
104
+ - ".ruby-version"
104
105
  - ".travis.yml"
105
106
  - Gemfile
106
107
  - Gemfile.lock