seatsio 25.2.0 → 27.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: 1820cf5207f9bc8eb9319c9cf61fbc20d018c040491b9c38e16c236d43a2c2b7
4
- data.tar.gz: 2764070302f5b4e32534fd2b9454424916ea5cc2ba91a1c18943a353903d2b3e
3
+ metadata.gz: 387ed52306c0b323ea46c428338e2b710769bf1aad466f846c45c098181fa6c6
4
+ data.tar.gz: 481627a92f34480ad8eaff3b50df48c49a375e187917e433792a226d96608381
5
5
  SHA512:
6
- metadata.gz: eec0fd22db7aa7a6cf4a1695e10c915da5014c5629f99866f26c5f77896f500809ec3b6a2dde216d82d495b841235add72d9868f8caf25feb12dda52afb5c22f
7
- data.tar.gz: c401bb02abc284f62f899a382774f61c8bbfa5414dbff5234c53ea1725111508995eeaa5b0db8f1c46112a505b54d977907d8e25a4e446459fd37b8c44380973
6
+ metadata.gz: 6a686de47074aa17d326a3f88b92221d15148484293bba3443f0203fb883f3cc29a5b0279a3482a6a4cad69df38350ff38a0de06ffa8d9ff084767ee2e404b3a
7
+ data.tar.gz: d113f54e14e58123928483ac2b40b34750edeb613fbc1cdff941cccfa4ffafabff84d1e77d7b54bb94418583969c465bde5fa3b625f1805699443037a226f2cc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (25.2.0)
4
+ seatsio (27.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -10,24 +10,25 @@ module Seatsio
10
10
  @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
11
11
  end
12
12
 
13
- def by_label(chart_key)
14
- get_chart_report('byLabel', chart_key)
13
+ def by_label(chart_key, book_whole_tables = nil)
14
+ get_chart_report('byLabel', chart_key, book_whole_tables)
15
15
  end
16
16
 
17
- def by_category_key(chart_key)
18
- get_chart_report('byCategoryKey', chart_key)
17
+ def by_category_key(chart_key, book_whole_tables = nil)
18
+ get_chart_report('byCategoryKey', chart_key, book_whole_tables)
19
19
  end
20
20
 
21
- def by_category_label(chart_key)
22
- get_chart_report('byCategoryLabel', chart_key)
21
+ def by_category_label(chart_key, book_whole_tables = nil)
22
+ get_chart_report('byCategoryLabel', chart_key, book_whole_tables)
23
23
  end
24
24
 
25
25
  private
26
26
 
27
- def get_chart_report(report_type, chart_key)
27
+ def get_chart_report(report_type, chart_key, book_whole_tables)
28
+ params = book_whole_tables.nil? ? {} : { bookWholeTables: book_whole_tables }
28
29
  url = "reports/charts/#{chart_key}/#{report_type}"
29
- body = @http_client.get(url)
30
- Domain::ChartReport.new(body)
30
+ body = @http_client.get(url, params)
31
+ ChartReport.new(body)
31
32
  end
32
33
  end
33
34
  end
@@ -13,24 +13,24 @@ module Seatsio
13
13
 
14
14
  def initialize(secret_key, workspace_key, base_url)
15
15
  @http_client = Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
16
- @archive = Pagination::Cursor.new(Domain::Chart, 'charts/archive', @http_client)
16
+ @archive = Pagination::Cursor.new(Chart, 'charts/archive', @http_client)
17
17
  end
18
18
 
19
- # @return [Seatsio::Domain::Chart]
19
+ # @return [Seatsio::Chart]
20
20
  def retrieve(chart_key)
21
21
  response = @http_client.get("charts/#{chart_key}")
22
- Domain::Chart.new(response)
22
+ Chart.new(response)
23
23
  end
24
24
 
25
25
  def retrieve_with_events(chart_key)
26
26
  response = @http_client.get("charts/#{chart_key}?expand=events")
27
- Domain::Chart.new(response)
27
+ Chart.new(response)
28
28
  end
29
29
 
30
30
  def create(name: nil, venue_type: nil, categories: nil)
31
31
  payload = build_chart_request name: name, venue_type: venue_type, categories: categories
32
32
  response = @http_client.post('charts', payload)
33
- Domain::Chart.new(response)
33
+ Chart.new(response)
34
34
  end
35
35
 
36
36
  def update(key:, new_name: nil, categories: nil)
@@ -48,24 +48,24 @@ module Seatsio
48
48
 
49
49
  def copy(key)
50
50
  response = @http_client.post("charts/#{key}/version/published/actions/copy")
51
- Domain::Chart.new(response)
51
+ Chart.new(response)
52
52
  end
53
53
 
54
54
  def copy_to_subaccount(chart_key, subaccount_id)
55
55
  url = "charts/#{chart_key}/version/published/actions/copy-to/#{subaccount_id}"
56
56
  response = @http_client.post url
57
- Domain::Chart.new(response)
57
+ Chart.new(response)
58
58
  end
59
59
 
60
60
  def copy_to_workspace(chart_key, to_workspace_key)
61
61
  url = "charts/#{chart_key}/version/published/actions/copy-to-workspace/#{to_workspace_key}"
62
62
  response = @http_client.post url
63
- Domain::Chart.new(response)
63
+ Chart.new(response)
64
64
  end
65
65
 
66
66
  def copy_draft_version(key)
67
67
  response = @http_client.post("charts/#{key}/version/draft/actions/copy")
68
- Domain::Chart.new(response)
68
+ Chart.new(response)
69
69
  end
70
70
 
71
71
  def retrieve_published_version(key)
@@ -98,7 +98,7 @@ module Seatsio
98
98
  end
99
99
 
100
100
  def list(chart_filter: nil, tag: nil, expand_events: nil, with_validation: false)
101
- cursor = Pagination::Cursor.new(Domain::Chart, 'charts', @http_client)
101
+ cursor = Pagination::Cursor.new(Chart, 'charts', @http_client)
102
102
  cursor.set_query_param('filter', chart_filter)
103
103
  cursor.set_query_param('tag', tag)
104
104
 
@@ -123,12 +123,12 @@ module Seatsio
123
123
 
124
124
  def validate_published_version(chart_key)
125
125
  response = @http_client.post("charts/#{chart_key}/version/published/actions/validate")
126
- Seatsio::Domain::ChartValidationResult.new(response)
126
+ Seatsio::ChartValidationResult.new(response)
127
127
  end
128
128
 
129
129
  def validate_draft_version(chart_key)
130
130
  response = @http_client.post("charts/#{chart_key}/version/draft/actions/validate")
131
- Seatsio::Domain::ChartValidationResult.new(response)
131
+ Seatsio::ChartValidationResult.new(response)
132
132
  end
133
133
 
134
134
  private
@@ -1,6 +1,6 @@
1
1
  require 'seatsio/util'
2
2
 
3
- module Seatsio::Domain
3
+ module Seatsio
4
4
 
5
5
  module_function
6
6
 
@@ -24,6 +24,7 @@ module Seatsio::Domain
24
24
  @social_distancing_rulesets = data['socialDistancingRulesets'].map {
25
25
  |key, r| [key, SocialDistancingRuleset.new(r['name'], r['numberOfDisabledSeatsToTheSides'], r['disableSeatsInFrontAndBehind'],
26
26
  r['numberOfDisabledAisleSeats'], r['maxGroupSize'],
27
+ r['maxOccupancyAbsolute'], r['maxOccupancyPercentage'], r['oneGroupPerTable'], r['fixedGroupLayout'],
27
28
  r['disabledSeats'], r['enabledSeats'], r['index'])]
28
29
  }.to_h
29
30
  end
@@ -60,6 +61,38 @@ module Seatsio::Domain
60
61
  end
61
62
  end
62
63
 
64
+ class TableBookingConfig
65
+
66
+ attr_reader :mode, :tables
67
+
68
+ def initialize(mode, tables = nil)
69
+ @mode = mode
70
+ @tables = tables
71
+ end
72
+
73
+ def self.inherit
74
+ TableBookingConfig.new('INHERIT')
75
+ end
76
+
77
+ def self.all_by_seat
78
+ TableBookingConfig.new('ALL_BY_SEAT')
79
+ end
80
+
81
+ def self.all_by_table
82
+ TableBookingConfig.new('ALL_BY_TABLE')
83
+ end
84
+
85
+ def self.custom(tables)
86
+ TableBookingConfig.new('CUSTOM', tables)
87
+ end
88
+
89
+ def self.from_json(data)
90
+ if data
91
+ TableBookingConfig.new(data['mode'], data['tables'])
92
+ end
93
+ end
94
+ end
95
+
63
96
  class Channel
64
97
  attr_reader :key, :name, :color, :index, :objects
65
98
 
@@ -83,17 +116,16 @@ module Seatsio::Domain
83
116
 
84
117
  class Event
85
118
 
86
- attr_accessor :id, :key, :chart_key, :book_whole_tables, :supports_best_available,
87
- :table_booking_modes, :for_sale_config, :created_on, :updated_on, :channels,
119
+ attr_accessor :id, :key, :chart_key, :supports_best_available,
120
+ :table_booking_config, :for_sale_config, :created_on, :updated_on, :channels,
88
121
  :social_distancing_ruleset_key
89
122
 
90
123
  def initialize(data)
91
124
  @id = data['id']
92
125
  @key = data['key']
93
126
  @chart_key = data['chartKey']
94
- @book_whole_tables = data['bookWholeTables']
95
127
  @supports_best_available = data['supportsBestAvailable']
96
- @table_booking_modes = data['tableBookingModes']
128
+ @table_booking_config = TableBookingConfig::from_json(data['tableBookingConfig'])
97
129
  @for_sale_config = ForSaleConfig.new(data['forSaleConfig']) if data['forSaleConfig']
98
130
  @created_on = parse_date(data['createdOn'])
99
131
  @updated_on = parse_date(data['updatedOn'])
@@ -184,7 +216,7 @@ module Seatsio::Domain
184
216
  attr_reader :objects
185
217
 
186
218
  def initialize(data)
187
- @objects = Seatsio::Domain.to_object_details(data['objects']);
219
+ @objects = Seatsio.to_object_details(data['objects']);
188
220
  end
189
221
  end
190
222
 
@@ -216,7 +248,7 @@ module Seatsio::Domain
216
248
  def initialize(data)
217
249
  @next_to_each_other = data['nextToEachOther']
218
250
  @objects = data['objects']
219
- @object_details = Seatsio::Domain.to_object_details(data['objectDetails'])
251
+ @object_details = Seatsio.to_object_details(data['objectDetails'])
220
252
  end
221
253
  end
222
254
 
@@ -286,7 +318,7 @@ module Seatsio::Domain
286
318
  :category_key, :entrance, :object_type, :hold_token, :category_label,
287
319
  :ticket_type, :num_booked, :num_free, :num_held, :for_sale, :section,
288
320
  :is_accessible, :is_companion_seat, :has_restricted_view, :displayed_object_type,
289
- :left_neighbour, :right_neighbour, :is_selectable, :is_disabled_by_social_distancing
321
+ :left_neighbour, :right_neighbour, :is_selectable, :is_disabled_by_social_distancing, :channel
290
322
 
291
323
  def initialize(data)
292
324
  @status = data['status']
@@ -314,6 +346,7 @@ module Seatsio::Domain
314
346
  @right_neighbour = data['rightNeighbour']
315
347
  @is_selectable = data['isSelectable']
316
348
  @is_disabled_by_social_distancing = data['isDisabledBySocialDistancing']
349
+ @channel = data['channel']
317
350
  end
318
351
  end
319
352
 
@@ -473,31 +506,52 @@ module Seatsio::Domain
473
506
 
474
507
  class SocialDistancingRuleset
475
508
  attr_reader :name, :number_of_disabled_seats_to_the_sides, :disable_seats_in_front_and_behind,
476
- :number_of_disabled_aisle_seats, :max_group_size, :disabled_seats, :enabled_seats, :index
509
+ :number_of_disabled_aisle_seats, :max_group_size, :max_occupancy_absolute,
510
+ :max_occupancy_percentage, :one_group_per_table, :fixed_group_layout, :disabled_seats, :enabled_seats, :index
477
511
 
478
512
  def initialize(name, number_of_disabled_seats_to_the_sides = 0, disable_seats_in_front_and_behind = false, number_of_disabled_aisle_seats = 0,
479
- max_group_size = 0, disabled_seats = [], enabled_seats = [], index = 0)
513
+ max_group_size = 0, max_occupancy_absolute = 0, max_occupancy_percentage = 0, one_group_per_table = false,
514
+ fixed_group_layout = false, disabled_seats = [], enabled_seats = [], index = 0)
480
515
  @name = name
481
516
  @number_of_disabled_seats_to_the_sides = number_of_disabled_seats_to_the_sides
482
517
  @disable_seats_in_front_and_behind = disable_seats_in_front_and_behind
483
518
  @number_of_disabled_aisle_seats = number_of_disabled_aisle_seats
484
519
  @max_group_size = max_group_size
520
+ @max_occupancy_absolute = max_occupancy_absolute
521
+ @max_occupancy_percentage = max_occupancy_percentage
522
+ @one_group_per_table = one_group_per_table
523
+ @fixed_group_layout = fixed_group_layout
485
524
  @disabled_seats = disabled_seats
486
525
  @enabled_seats = enabled_seats
487
526
  @index = index
488
527
  end
489
528
 
529
+ def self.fixed(name, disabled_seats = [], index = 0)
530
+ SocialDistancingRuleset.new(name, 0, false, 0, 0, 0, 0, false, true, disabled_seats, [], index)
531
+ end
532
+
533
+ def self.rule_based(name, number_of_disabled_seats_to_the_sides = 0, disable_seats_in_front_and_behind = false, number_of_disabled_aisle_seats = 0,
534
+ max_group_size = 0, max_occupancy_absolute = 0, max_occupancy_percentage = 0, one_group_per_table = false,
535
+ disabled_seats = [], enabled_seats = [], index = 0)
536
+ SocialDistancingRuleset.new(name, number_of_disabled_seats_to_the_sides, disable_seats_in_front_and_behind, number_of_disabled_aisle_seats,
537
+ max_group_size, max_occupancy_absolute, max_occupancy_percentage,
538
+ one_group_per_table, false, disabled_seats, enabled_seats, index)
539
+ end
540
+
490
541
  def == (other)
491
542
  self.name == other.name &&
492
543
  self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
493
544
  self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
494
545
  self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
495
546
  self.max_group_size == other.max_group_size &&
547
+ self.max_occupancy_absolute == other.max_occupancy_absolute &&
548
+ self.max_occupancy_percentage == other.max_occupancy_percentage &&
549
+ self.one_group_per_table == other.one_group_per_table &&
550
+ self.fixed_group_layout == other.fixed_group_layout &&
496
551
  self.disabled_seats == other.disabled_seats &&
497
552
  self.enabled_seats == other.enabled_seats &&
498
553
  self.index == other.index
499
554
  end
500
-
501
555
  end
502
556
 
503
557
  end
@@ -31,6 +31,10 @@ module Seatsio
31
31
  fetch_summary_report('bySelectability', event_key)
32
32
  end
33
33
 
34
+ def summary_by_channel(event_key)
35
+ fetch_summary_report('byChannel', event_key)
36
+ end
37
+
34
38
  def by_label(event_key, label = nil)
35
39
  fetch_report('byLabel', event_key, label)
36
40
  end
@@ -59,6 +63,10 @@ module Seatsio
59
63
  fetch_report('bySelectability', event_key, selectability)
60
64
  end
61
65
 
66
+ def by_channel(event_key, channelKey = nil)
67
+ fetch_report('byChannel', event_key, channelKey)
68
+ end
69
+
62
70
  private
63
71
 
64
72
  def fetch_summary_report(report_type, event_key)
@@ -70,11 +78,11 @@ module Seatsio
70
78
  if report_filter
71
79
  url = "reports/events/#{event_key}/#{report_type}/#{report_filter}"
72
80
  body = @http_client.get(url)
73
- Domain::EventReport.new(body[report_filter])
81
+ EventReport.new(body[report_filter])
74
82
  else
75
83
  url = "reports/events/#{event_key}/#{report_type}"
76
84
  body = @http_client.get(url)
77
- Domain::EventReport.new(body)
85
+ EventReport.new(body)
78
86
  end
79
87
  end
80
88
  end
@@ -15,22 +15,21 @@ 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, 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)
18
+ def create(chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil)
19
+ 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)
21
21
  response = @http_client.post("events", payload)
22
- Domain::Event.new(response)
22
+ Event.new(response)
23
23
  end
24
24
 
25
25
  def create_multiple(key: nil, event_creation_params: nil)
26
26
  payload = build_events_request(chart_key: key, event_creation_params: event_creation_params)
27
27
  response = @http_client.post("events/actions/create-multiple", payload)
28
- Domain::Events.new(response).events
28
+ Events.new(response).events
29
29
  end
30
30
 
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)
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)
34
33
  @http_client.post("/events/#{key}", payload)
35
34
  end
36
35
 
@@ -47,11 +46,11 @@ module Seatsio
47
46
  def retrieve_object_status(key:, object_key:)
48
47
  url = "events/#{key}/objects/#{CGI::escape(object_key).gsub('+', '%20')}"
49
48
  response = @http_client.get(url)
50
- Domain::ObjectStatus.new(response)
49
+ ObjectStatus.new(response)
51
50
  end
52
51
 
53
52
  def book(event_key_or_keys, object_or_objects, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil)
54
- self.change_object_status(event_key_or_keys, object_or_objects, Domain::ObjectStatus::BOOKED, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys)
53
+ self.change_object_status(event_key_or_keys, object_or_objects, ObjectStatus::BOOKED, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys)
55
54
  end
56
55
 
57
56
  def change_object_status(event_key_or_keys, object_or_objects, status, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil)
@@ -60,38 +59,38 @@ module Seatsio
60
59
  :expand => 'objects'
61
60
  }
62
61
  response = @http_client.post("seasons/actions/change-object-status", request)
63
- Domain::ChangeObjectStatusResult.new(response)
62
+ ChangeObjectStatusResult.new(response)
64
63
  end
65
64
 
66
65
  def change_object_status_in_batch(status_change_requests)
67
66
  request = {
68
67
  :statusChanges => status_change_requests,
69
- :params => { :expand => 'objects' }
68
+ :params => {:expand => 'objects'}
70
69
  }
71
70
  response = @http_client.post("events/actions/change-object-status", request)
72
- Domain::ChangeObjectStatusInBatchResult.new(response).results
71
+ ChangeObjectStatusInBatchResult.new(response).results
73
72
  end
74
73
 
75
74
  def hold(event_key_or_keys, object_or_objects, hold_token, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil)
76
- change_object_status(event_key_or_keys, object_or_objects, Domain::ObjectStatus::HELD, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys)
75
+ change_object_status(event_key_or_keys, object_or_objects, ObjectStatus::HELD, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys)
77
76
  end
78
77
 
79
78
  def change_best_available_object_status(key, number, status, categories: nil, hold_token: nil, extra_data: nil, ticket_types: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil)
80
79
  request = create_change_best_available_object_status_request(number, status, categories, extra_data, ticket_types, hold_token, order_id, keep_extra_data, ignore_channels, channel_keys)
81
80
  response = @http_client.post("events/#{key}/actions/change-object-status", request)
82
- Domain::BestAvailableObjects.new(response)
81
+ BestAvailableObjects.new(response)
83
82
  end
84
83
 
85
84
  def book_best_available(key, number, categories: nil, hold_token: nil, order_id: nil, keep_extra_data: nil, extra_data: nil, ticket_types: nil, ignore_channels: nil, channel_keys: nil)
86
- change_best_available_object_status(key, number, Domain::ObjectStatus::BOOKED, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, extra_data: extra_data, ticket_types: ticket_types, ignore_channels: ignore_channels, channel_keys: channel_keys)
85
+ change_best_available_object_status(key, number, ObjectStatus::BOOKED, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, extra_data: extra_data, ticket_types: ticket_types, ignore_channels: ignore_channels, channel_keys: channel_keys)
87
86
  end
88
87
 
89
88
  def hold_best_available(key, number, hold_token, categories: nil, order_id: nil, keep_extra_data: nil, extra_data: nil, ticket_types: nil, ignore_channels: nil, channel_keys: nil)
90
- change_best_available_object_status(key, number, Domain::ObjectStatus::HELD, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, extra_data: extra_data, ticket_types: ticket_types, ignore_channels: ignore_channels, channel_keys: channel_keys)
89
+ change_best_available_object_status(key, number, ObjectStatus::HELD, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, extra_data: extra_data, ticket_types: ticket_types, ignore_channels: ignore_channels, channel_keys: channel_keys)
91
90
  end
92
91
 
93
92
  def release(event_key_or_keys, object_or_objects, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil)
94
- change_object_status(event_key_or_keys, object_or_objects, Domain::ObjectStatus::FREE, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys)
93
+ change_object_status(event_key_or_keys, object_or_objects, ObjectStatus::FREE, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys)
95
94
  end
96
95
 
97
96
  def delete(key:)
@@ -101,23 +100,23 @@ module Seatsio
101
100
 
102
101
  def retrieve(key:)
103
102
  response = @http_client.get("events/#{key}")
104
- Domain::Event.new(response)
103
+ Event.new(response)
105
104
  end
106
105
 
107
106
  def list
108
- Pagination::Cursor.new(Domain::Event, 'events', @http_client)
107
+ Pagination::Cursor.new(Event, 'events', @http_client)
109
108
  end
110
109
 
111
110
  def list_status_changes(key, object_id = nil)
112
111
  if object_id != nil
113
112
  status_changes_for_object key: key, object_id: object_id
114
113
  else
115
- Pagination::Cursor.new(Domain::StatusChange, "/events/#{key}/status-changes", @http_client)
114
+ Pagination::Cursor.new(StatusChange, "/events/#{key}/status-changes", @http_client)
116
115
  end
117
116
  end
118
117
 
119
118
  def status_changes_for_object(key:, object_id:)
120
- Pagination::Cursor.new(Domain::StatusChange, "/events/#{key}/objects/#{object_id}/status-changes", @http_client)
119
+ Pagination::Cursor.new(StatusChange, "/events/#{key}/objects/#{object_id}/status-changes", @http_client)
121
120
  end
122
121
 
123
122
  def mark_as_not_for_sale(key:, objects: nil, categories: nil)
@@ -157,12 +156,11 @@ module Seatsio
157
156
  payload
158
157
  end
159
158
 
160
- def build_event_request(chart_key: nil, event_key: nil, book_whole_tables: nil, table_booking_modes: nil, social_distancing_ruleset_key: nil)
159
+ def build_event_request(chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil)
161
160
  result = {}
162
161
  result["chartKey"] = chart_key if chart_key
163
162
  result["eventKey"] = event_key if event_key
164
- result["bookWholeTables"] = book_whole_tables if book_whole_tables != nil
165
- result["tableBookingModes"] = table_booking_modes if table_booking_modes != nil
163
+ result["tableBookingConfig"] = table_booking_config_to_request(table_booking_config) if table_booking_config != nil
166
164
  result["socialDistancingRulesetKey"] = social_distancing_ruleset_key if social_distancing_ruleset_key != nil
167
165
  result
168
166
  end
@@ -179,12 +177,18 @@ module Seatsio
179
177
  params.each do |param|
180
178
  r = {}
181
179
  r["eventKey"] = param[:event_key] if param[:event_key] != nil
182
- r["bookWholeTables"] = param[:book_whole_tables] if param[:book_whole_tables] != nil
183
- r["tableBookingModes"] = param[:table_booking_modes] if param[:table_booking_modes] != nil
180
+ r["tableBookingConfig"] = table_booking_config_to_request(param[:table_booking_config]) if param[:table_booking_config] != nil
184
181
  result.push(r)
185
182
  end
186
183
  result
187
184
  end
188
185
 
186
+ def table_booking_config_to_request(table_booking_config)
187
+ result = {}
188
+ result["mode"] = table_booking_config.mode
189
+ result["tables"] = table_booking_config.tables if table_booking_config.tables != nil
190
+ result
191
+ end
192
+
189
193
  end
190
194
  end
@@ -21,18 +21,18 @@ module Seatsio
21
21
  body[:expiresInMinutes] = expires_in_minutes
22
22
  end
23
23
  response = @http_client.post('hold-tokens', body)
24
- Domain::HoldToken.new(response)
24
+ HoldToken.new(response)
25
25
  end
26
26
 
27
27
  def retrieve(hold_token)
28
28
  response = @http_client.get("/hold-tokens/#{hold_token}")
29
- Domain::HoldToken.new(response)
29
+ HoldToken.new(response)
30
30
  end
31
31
 
32
32
  def expire_in_minutes(hold_token, expires_in_minutes = nil)
33
33
  body = {"expiresInMinutes": expires_in_minutes}
34
34
  response = @http_client.post("/hold-tokens/#{hold_token}", body)
35
- Domain::HoldToken.new(response)
35
+ HoldToken.new(response)
36
36
  end
37
37
  end
38
38
  end
@@ -17,7 +17,7 @@ module Seatsio
17
17
  body['name'] = name if name
18
18
 
19
19
  response = @http_client.post("subaccounts", body)
20
- Domain::Subaccount.new(response)
20
+ Subaccount.new(response)
21
21
  end
22
22
 
23
23
  def update(id:, name: nil)
@@ -50,17 +50,17 @@ module Seatsio
50
50
 
51
51
  def retrieve(id:)
52
52
  response = @http_client.get("/subaccounts/#{id}")
53
- Domain::Subaccount.new(response)
53
+ Subaccount.new(response)
54
54
  end
55
55
 
56
56
  def copy_chart_to_parent(id: nil, chart_key: nil)
57
57
  response = @http_client.post("/subaccounts/#{id}/charts/#{chart_key}/actions/copy-to/parent")
58
- Domain::Chart.new(response)
58
+ Chart.new(response)
59
59
  end
60
60
 
61
61
  def copy_chart_to_subaccount(from_id: nil, to_id: nil, chart_key: nil)
62
62
  response = @http_client.post("/subaccounts/#{from_id}/charts/#{chart_key}/actions/copy-to/#{to_id}")
63
- Domain::Chart.new(response)
63
+ Chart.new(response)
64
64
  end
65
65
 
66
66
  def regenerate_secret_key(id:)
@@ -75,7 +75,7 @@ module Seatsio
75
75
 
76
76
  def cursor(status: nil)
77
77
  endpoint = status ? "subaccounts/#{status}" : 'subaccounts'
78
- Pagination::Cursor.new(Domain::Subaccount, endpoint, @http_client)
78
+ Pagination::Cursor.new(Subaccount, endpoint, @http_client)
79
79
  end
80
80
  end
81
81
  end
@@ -13,19 +13,19 @@ module Seatsio
13
13
  def summary_for_all_months
14
14
  url = "reports/usage"
15
15
  body = @http_client.get(url)
16
- Domain::UsageSummaryForAllMoths.new(body)
16
+ UsageSummaryForAllMoths.new(body)
17
17
  end
18
18
 
19
19
  def details_for_month(month)
20
20
  url = "reports/usage/month/" + month.serialize
21
21
  body = @http_client.get(url)
22
- body.map { |item| Domain::UsageDetails.new(item) }
22
+ body.map { |item| UsageDetails.new(item) }
23
23
  end
24
24
 
25
25
  def details_for_event_in_month(eventId, month)
26
26
  url = "reports/usage/month/" + month.serialize + "/event/" + eventId.to_s
27
27
  body = @http_client.get(url)
28
- body.map { |item| Domain::UsageForObject.new(item) }
28
+ body.map { |item| UsageForObject.new(item) }
29
29
  end
30
30
  end
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "25.2.0"
2
+ VERSION = "27.0.0"
3
3
  end
@@ -18,7 +18,7 @@ module Seatsio
18
18
  body['isTest'] = is_test if is_test
19
19
 
20
20
  response = @http_client.post("workspaces", body)
21
- Domain::Workspace.new(response)
21
+ Workspace.new(response)
22
22
  end
23
23
 
24
24
  def update(key:, name:)
@@ -52,13 +52,13 @@ module Seatsio
52
52
 
53
53
  def retrieve(key:)
54
54
  response = @http_client.get("/workspaces/#{key}")
55
- Domain::Workspace.new(response)
55
+ Workspace.new(response)
56
56
  end
57
57
 
58
58
  private
59
59
 
60
60
  def cursor()
61
- Pagination::Cursor.new(Domain::Workspace, 'workspaces', @http_client)
61
+ Pagination::Cursor.new(Workspace, 'workspaces', @http_client)
62
62
  end
63
63
  end
64
64
  end
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: 25.2.0
4
+ version: 27.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-07-29 00:00:00.000000000 Z
11
+ date: 2020-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler