seatsio 37.1.0 → 40.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: 0d2f06ac8e3e089f4810dfecc117a19d6783a36b1519501ef9b269856259526e
4
- data.tar.gz: cd2168d2831c7e197ef4cd0b967515366c037081edbc76cc30bc9f807a233ad2
3
+ metadata.gz: 318b95da4bc9436f82da06e2ba06af0e9ed25054e8328603496bca8e43e71758
4
+ data.tar.gz: 6efaef3cce86f803f1e8ed65346065181e565f2459fc303dc6ce0f2156ff48be
5
5
  SHA512:
6
- metadata.gz: 13f8b6c098c4ef32d2137404e1311c653162508edb8e10bd7a8fa2633562cec0a64813d9cfde31754063357a5a2a50cbfdd4f988da054cf3916511e0a687fb09
7
- data.tar.gz: a26c0f350dac784e904ebe2dcb1d6206984f1d12eb11045be1dd676f97f3b8f5f0e9ff06db83712b97a5dcc4711b372f353a1b44ddf2eb9dc969ab59471acfba
6
+ metadata.gz: fea50b19a573dfa2403d7e4f66fc6d64ae0396af968cf3469d112ef54c1b0611646fc9b03802f654c0ee96f0d670c6b2e1f1efdfad503c0b37b867889ce0998e
7
+ data.tar.gz: a4f17bd2c0b680ed75dec260e66b02715a0c8897713eb34ee6e74e738bef0e1bb7737a4a9682a3a3f243eac72c501d80078d401b406e713c3db32bd010ae0c3d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (37.1.0)
4
+ seatsio (40.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,48 @@
1
+ module Seatsio
2
+
3
+ class ChannelsClient
4
+ def initialize(http_client)
5
+ @http_client = http_client
6
+ end
7
+
8
+ def add(event_key:, channel_key:, channel_name:, channel_color:, index: nil, objects: nil)
9
+ payload = {
10
+ key: channel_key,
11
+ name: channel_name,
12
+ color: channel_color
13
+ }
14
+ payload['index'] = index if index != nil
15
+ payload['objects'] = objects if objects != nil
16
+ @http_client.post("events/#{event_key}/channels", payload)
17
+ end
18
+
19
+ def remove(event_key:, channel_key:)
20
+ @http_client.delete("events/#{event_key}/channels/#{channel_key}")
21
+ end
22
+
23
+ def update(event_key:, channel_key:, channel_name: nil, channel_color: nil, objects: nil)
24
+ payload = {}
25
+ payload['name'] = channel_name if channel_name != nil
26
+ payload['color'] = channel_color if channel_color != nil
27
+ payload['objects'] = objects if objects != nil
28
+ @http_client.post("events/#{event_key}/channels/#{channel_key}", payload)
29
+ end
30
+
31
+ def add_objects(event_key:, channel_key:, objects:)
32
+ @http_client.post("events/#{event_key}/channels/#{channel_key}/objects", { objects: objects })
33
+ end
34
+
35
+ def remove_objects(event_key:, channel_key:, objects:)
36
+ @http_client.delete("events/#{event_key}/channels/#{channel_key}/objects", { objects: objects })
37
+ end
38
+
39
+ def replace(key:, channels:)
40
+ @http_client.post("events/#{key}/channels/update", channels: channels)
41
+ end
42
+
43
+ def set_objects(key:, channelConfig:)
44
+ @http_client.post("events/#{key}/channels/assign-objects", channelConfig: channelConfig)
45
+ end
46
+
47
+ end
48
+ end
@@ -70,6 +70,41 @@ module Seatsio
70
70
  end
71
71
  end
72
72
 
73
+ class Category
74
+
75
+ attr_reader :key, :label, :color, :accessible
76
+
77
+ def initialize(key, label, color, accessible)
78
+ @key = key
79
+ @label = label
80
+ @color = color
81
+ @accessible = accessible
82
+ end
83
+
84
+ def self.from_json(data)
85
+ if data
86
+ Category.new(data['key'], data['label'], data['color'], data['accessible'])
87
+ end
88
+ end
89
+
90
+ def self.create_list(list = [])
91
+ result = []
92
+
93
+ list.each do |item|
94
+ result << Category.from_json(item)
95
+ end
96
+
97
+ result
98
+ end
99
+
100
+ def == (other)
101
+ key == other.key &&
102
+ label == other.label &&
103
+ color == other.color &&
104
+ accessible == other.accessible
105
+ end
106
+ end
107
+
73
108
  class TableBookingConfig
74
109
 
75
110
  attr_reader :mode, :tables
@@ -114,11 +149,11 @@ module Seatsio
114
149
  end
115
150
 
116
151
  def == (other)
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
152
+ key == other.key &&
153
+ name == other.name &&
154
+ color == other.color &&
155
+ index == other.index &&
156
+ objects == other.objects
122
157
  end
123
158
 
124
159
  end
@@ -149,7 +184,7 @@ module Seatsio
149
184
  @is_event_in_season = data['isEventInSeason']
150
185
  @top_level_season_key = data['topLevelSeasonKey']
151
186
  @object_categories = data['objectCategories']
152
- @categories = data['categories']
187
+ @categories = Category.create_list(data['categories']) if data['categories']
153
188
  end
154
189
 
155
190
  def is_season
@@ -441,16 +476,12 @@ module Seatsio
441
476
 
442
477
  class UsageByEvent
443
478
 
444
- attr_reader :event, :num_used_objects, :num_first_bookings, :num_first_bookings_or_selections,
445
- :num_ga_selections_without_booking, :num_non_ga_selections_without_booking, :num_object_selections
479
+ attr_reader :event, :num_used_objects, :num_first_bookings, :num_object_selections
446
480
 
447
481
  def initialize(data)
448
482
  @event = UsageEvent.new(data['event'])
449
483
  @num_used_objects = data['numUsedObjects']
450
484
  @num_first_bookings = data['numFirstBookings']
451
- @num_first_bookings_or_selections = data['numFirstBookingsOrSelections']
452
- @num_ga_selections_without_booking = data['numGASelectionsWithoutBooking']
453
- @num_non_ga_selections_without_booking = data['numNonGASelectionsWithoutBooking']
454
485
  @num_object_selections = data['numObjectSelections']
455
486
  end
456
487
  end
@@ -581,19 +612,19 @@ module Seatsio
581
612
  end
582
613
 
583
614
  def == (other)
584
- self.name == other.name &&
585
- self.number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
586
- self.disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
587
- self.disable_diagonal_seats_in_front_and_behind == other.disable_diagonal_seats_in_front_and_behind &&
588
- self.number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
589
- self.max_group_size == other.max_group_size &&
590
- self.max_occupancy_absolute == other.max_occupancy_absolute &&
591
- self.max_occupancy_percentage == other.max_occupancy_percentage &&
592
- self.one_group_per_table == other.one_group_per_table &&
593
- self.fixed_group_layout == other.fixed_group_layout &&
594
- self.disabled_seats == other.disabled_seats &&
595
- self.enabled_seats == other.enabled_seats &&
596
- self.index == other.index
615
+ name == other.name &&
616
+ number_of_disabled_seats_to_the_sides == other.number_of_disabled_seats_to_the_sides &&
617
+ disable_seats_in_front_and_behind == other.disable_seats_in_front_and_behind &&
618
+ disable_diagonal_seats_in_front_and_behind == other.disable_diagonal_seats_in_front_and_behind &&
619
+ number_of_disabled_aisle_seats == other.number_of_disabled_aisle_seats &&
620
+ max_group_size == other.max_group_size &&
621
+ max_occupancy_absolute == other.max_occupancy_absolute &&
622
+ max_occupancy_percentage == other.max_occupancy_percentage &&
623
+ one_group_per_table == other.one_group_per_table &&
624
+ fixed_group_layout == other.fixed_group_layout &&
625
+ disabled_seats == other.disabled_seats &&
626
+ enabled_seats == other.enabled_seats &&
627
+ index == other.index
597
628
  end
598
629
  end
599
630
 
@@ -6,12 +6,16 @@ require "json"
6
6
  require "cgi"
7
7
  require "seatsio/events/change_object_status_request"
8
8
  require "seatsio/events/change_best_available_object_status_request"
9
+ require 'seatsio/channels'
9
10
 
10
11
  module Seatsio
11
12
 
12
13
  class EventsClient
14
+ attr_reader :channels
15
+
13
16
  def initialize(http_client)
14
17
  @http_client = http_client
18
+ @channels = ChannelsClient.new(@http_client)
15
19
  end
16
20
 
17
21
  def create(chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil, object_categories: nil)
@@ -142,14 +146,6 @@ module Seatsio
142
146
  @http_client.post("events/#{key}/actions/mark-as-for-sale", request)
143
147
  end
144
148
 
145
- def update_channels(key:, channels:)
146
- @http_client.post("events/#{key}/channels/update", channels: channels)
147
- end
148
-
149
- def assign_objects_to_channels(key:, channelConfig:)
150
- @http_client.post("events/#{key}/channels/assign-objects", channelConfig: channelConfig)
151
- end
152
-
153
149
  private
154
150
 
155
151
  def build_parameters_for_mark_as_sale(objects: nil, categories: nil)
@@ -33,7 +33,7 @@ module Seatsio
33
33
 
34
34
  request_options = { method: args[0], url: url, headers: headers }
35
35
 
36
- if args[0] == :post
36
+ if args[0] == :post || args[0] == :delete
37
37
  args[2].delete :params
38
38
  request_options[:payload] = args[2].to_json
39
39
  end
@@ -90,8 +90,8 @@ module Seatsio
90
90
  execute(:post, endpoint, payload)
91
91
  end
92
92
 
93
- def delete(endpoint)
94
- execute(:delete, endpoint, {})
93
+ def delete(endpoint, payload = {})
94
+ execute(:delete, endpoint, payload)
95
95
  end
96
96
  end
97
97
  end
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "37.1.0"
2
+ VERSION = "40.0.0"
3
3
  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: 37.1.0
4
+ version: 40.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: 2022-03-21 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,6 +112,7 @@ files:
112
112
  - bin/console
113
113
  - bin/setup
114
114
  - lib/seatsio.rb
115
+ - lib/seatsio/channels.rb
115
116
  - lib/seatsio/chart_reports.rb
116
117
  - lib/seatsio/charts.rb
117
118
  - lib/seatsio/domain.rb