seatsio 23 → 24.0.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: b88d6d19b2c22781400c6ae47b2b56ad427ac9bad5c8ec5a3c6bff74ee51b669
4
- data.tar.gz: 11bf8b67f7fee295ee84353f2d949b4394f74c503f62ad390629f4911d441e19
3
+ metadata.gz: 4930b1db1d27358e928cc9505ce23c7087cf17f7dcfde447410d95adbd9d8ec7
4
+ data.tar.gz: 6697bab9ba71f211e932dac4c52e606cedd5c72ea32475d253bdc9658645dcd7
5
5
  SHA512:
6
- metadata.gz: 58861f8258b3054132b3cd5e9a58689a1f484da363da9a006c35829c59e21dd454bb3b284aa114c4b015158e2673d28a68f949f82905184d7e8adeda44a43839
7
- data.tar.gz: 72b0cd80783a6ae96f5d029246fb602ed8e06390a98a301b78b87998ea076db2357b6466692d42573949aafd68a17e7494947189190e4eb5e5d100530f78a9c9
6
+ metadata.gz: 70f297b8674903e48a297cadeb036aff12a8ceb2c473d390f2cf22f11de93c0893e6c28051c60cb3f695b150fe7b50d9c59773a9bcbf9f559196e071e4d26b5d
7
+ data.tar.gz: c89361a4618d02e15f7e6edf3eb5edca592a65bc3bc1c62c255b06a4eb1f4f313e79c1967f0bcdda6f5d2dba962958ad4b4a6e7479915a6874602782b79c55b0
@@ -0,0 +1 @@
1
+ 2.3.0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (23)
4
+ seatsio (24.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -21,7 +21,7 @@ GEM
21
21
  minitest (5.11.3)
22
22
  netrc (0.11.0)
23
23
  public_suffix (3.1.0)
24
- rake (10.5.0)
24
+ rake (13.0.1)
25
25
  rest-client (2.0.2)
26
26
  http-cookie (>= 1.0.2, < 2.0)
27
27
  mime-types (>= 1.16, < 4.0)
@@ -41,10 +41,10 @@ PLATFORMS
41
41
  DEPENDENCIES
42
42
  bundler (~> 1.16)
43
43
  minitest (~> 5.0)
44
- rake (~> 10.0)
44
+ rake (~> 13.0)
45
45
  rest-client (~> 2.0, >= 2.0.2)
46
46
  seatsio!
47
47
  webmock (~> 3.4, >= 3.4.2)
48
48
 
49
49
  BUNDLED WITH
50
- 1.17.3
50
+ 1.17.2
data/README.md CHANGED
@@ -4,12 +4,9 @@
4
4
 
5
5
  This is the official Ruby client library for the [Seats.io V2 REST API](https://docs.seats.io/docs/api-overview), supporting Ruby 2.2.0+
6
6
 
7
+ ## Versioning
7
8
 
8
- # Versioning
9
-
10
- seatsio-ruby only uses major version numbers: v5, v6, v7 etc. Each release - backwards compatible or not - receives a new major version number.
11
-
12
- The reason: we want to play safe and assume that each release might break backwards compatibility.
9
+ seatsio-ruby follows semver since v23.3.0.
13
10
 
14
11
  ## Examples
15
12
 
@@ -17,7 +14,7 @@ The reason: we want to play safe and assume that each release might break backwa
17
14
 
18
15
  ```ruby
19
16
  require('seatsio')
20
- 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
21
18
  chart = client.charts.create
22
19
  event = client.events.create key: chart.key
23
20
  ```
@@ -26,7 +23,7 @@ event = client.events.create key: chart.key
26
23
 
27
24
  ```ruby
28
25
  require('seatsio')
29
- client = Seatsio::Client.new("my-secret-key")
26
+ client = Seatsio::Client.new("my-workspace-secret-key")
30
27
  client.events.book(event.key, ["A-1", "A-2"])
31
28
  ```
32
29
 
@@ -34,7 +31,7 @@ client.events.book(event.key, ["A-1", "A-2"])
34
31
 
35
32
  ```ruby
36
33
  require('seatsio')
37
- client = Seatsio::Client.new("my-secret-key")
34
+ client = Seatsio::Client.new("my-workspace-secret-key")
38
35
  client.events.release(event.key, ["A-1", "A-2"])
39
36
  ```
40
37
 
@@ -42,7 +39,7 @@ client.events.release(event.key, ["A-1", "A-2"])
42
39
 
43
40
  ```ruby
44
41
  require('seatsio')
45
- client = Seatsio::Client.new("my-secret-key")
42
+ client = Seatsio::Client.new("my-workspace-secret-key")
46
43
  client.events.book(event.key, ["A-1", "A-2"], "a-hold-token")
47
44
  ```
48
45
 
@@ -50,7 +47,7 @@ client.events.book(event.key, ["A-1", "A-2"], "a-hold-token")
50
47
 
51
48
  ```ruby
52
49
  require('seatsio')
53
- client = Seatsio::Client.new("my-secret-key")
50
+ client = Seatsio::Client.new("my-workspace-secret-key")
54
51
  client.events.change_object_status("<EVENT KEY>", ["A-1", "A-2"], "my-custom-status")
55
52
  ```
56
53
 
@@ -58,7 +55,7 @@ client.events.change_object_status("", ["A-1", "A-2"], "my-custom-sta
58
55
 
59
56
  ```ruby
60
57
  require('seatsio')
61
- client = Seatsio::Client.new("my-secret-key")
58
+ client = Seatsio::Client.new("my-workspace-secret-key")
62
59
  charts = client.charts.list
63
60
  charts.each do |chart|
64
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
 
@@ -264,7 +282,9 @@ module Seatsio::Domain
264
282
  class EventReportItem
265
283
  attr_reader :labels, :label, :order_id, :extra_data, :capacity, :status,
266
284
  :category_key, :entrance, :object_type, :hold_token, :category_label,
267
- :ticket_type, :num_booked, :num_free, :num_held, :for_sale, :section
285
+ :ticket_type, :num_booked, :num_free, :num_held, :for_sale, :section,
286
+ :is_accessible, :is_companion_seat, :has_restricted_view, :displayed_object_type,
287
+ :left_neighbour, :right_neighbour
268
288
 
269
289
  def initialize(data)
270
290
  @status = data['status']
@@ -284,6 +304,12 @@ module Seatsio::Domain
284
304
  @capacity = data['capacity']
285
305
  @object_type = data['objectType']
286
306
  @extra_data = data['extraData']
307
+ @is_accessible = data['isAccessible']
308
+ @is_companion_seat = data['isCompanionSeat']
309
+ @has_restricted_view = data['hasRestrictedView']
310
+ @displayed_object_type = data['displayedObjectType']
311
+ @left_neighbour = data['leftNeighbour']
312
+ @right_neighbour = data['rightNeighbour']
287
313
  end
288
314
  end
289
315
 
@@ -441,4 +467,33 @@ module Seatsio::Domain
441
467
  object_details
442
468
  end
443
469
 
470
+ class SocialDistancingRuleset
471
+ attr_reader :name, :number_of_disabled_seats_to_the_sides, :disable_seats_in_front_and_behind,
472
+ :number_of_disabled_aisle_seats, :max_group_size, :disabled_seats, :enabled_seats, :index
473
+
474
+ def initialize(name, number_of_disabled_seats_to_the_sides = 0, disable_seats_in_front_and_behind = false, number_of_disabled_aisle_seats = 0,
475
+ max_group_size = 0, disabled_seats = [], enabled_seats = [], index = 0)
476
+ @name = name
477
+ @number_of_disabled_seats_to_the_sides = number_of_disabled_seats_to_the_sides
478
+ @disable_seats_in_front_and_behind = disable_seats_in_front_and_behind
479
+ @number_of_disabled_aisle_seats = number_of_disabled_aisle_seats
480
+ @max_group_size = max_group_size
481
+ @disabled_seats = disabled_seats
482
+ @enabled_seats = enabled_seats
483
+ @index = index
484
+ end
485
+
486
+ def == (other)
487
+ self.name == other.name &&
488
+ self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
489
+ self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
490
+ self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
491
+ self.max_group_size == other.max_group_size &&
492
+ self.disabled_seats == other.disabled_seats &&
493
+ self.enabled_seats == other.enabled_seats &&
494
+ self.index == other.index
495
+ end
496
+
497
+ end
498
+
444
499
  end
@@ -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,4 +1,4 @@
1
- def create_change_object_status_jn_batch_request(event_key, object_or_objects, status, hold_token = nil , order_id = nil, keep_extra_data = nil)
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)
2
2
  result = create_change_object_status_request(object_or_objects, status, hold_token, order_id, '', keep_extra_data)
3
3
  result.delete(:events)
4
4
  result[:event] = event_key
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "23"
2
+ VERSION = "24.0.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)
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.16"
24
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rake", "~> 13.0"
25
25
  spec.add_development_dependency "minitest", "~> 5.0"
26
26
  spec.add_development_dependency "rest-client", '~> 2.0', '>= 2.0.2'
27
27
  spec.add_development_dependency 'webmock', '~> 3.4', '>= 3.4.2'
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'
4
+ version: 24.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: 2020-03-02 00:00:00.000000000 Z
11
+ date: 2020-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -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