seatsio 45.1.0 → 46.0.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: 1b59187036878ba734bc06e2de29977d3d7aef057810d0a92de3719c7c1fa784
4
- data.tar.gz: 9b55d3b20b7cbfbc84beaa20fb757595bb407f26995891d07de82ad185cc8dff
3
+ metadata.gz: 8247e7988af6847122d631e25765b37e83fe554b11c3f8ef97d07e95f2fee552
4
+ data.tar.gz: 8b0f1461b961b2c6c98b4d76d987429028a0450bf589aaec3f71d91d7d5b61f0
5
5
  SHA512:
6
- metadata.gz: 4d501ee3bb0bd2bee6368b75270aa4c0cc4fbf7c29a4b8763f481e9344cb0ac0297fdeb6c853b1726b2ecefc86d518d04220b58e4e23082fb52127c12cc84048
7
- data.tar.gz: 37f40fec41daa5a65cc4e4d3aaeebf6d9b2c550efbb88ef4252d09d578fd8dea7e1820e14c3c88d474f1735eeaadff7fd565aefcb15e330191b528d6285c07ad
6
+ metadata.gz: 4334afe03a7a9d5188ab2c7f53742c9feb281c34b595c8cf092b02e1d14a0c0614a0b9f82490f48db01aee8040b563904cffb45095527fdf95226328d3086d9b
7
+ data.tar.gz: 454e992ca71eae144957bf6f460a331c447b513fc74bf08350db54bdc2e1e68ae71b20b5473b91fa0bc53211c982763816b2e80200e251177ceb8cffebe78c56
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (45.1.0)
4
+ seatsio (46.0.0)
5
5
  rest-client (~> 2.0, >= 2.0.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.8.1)
10
+ addressable (2.8.5)
11
11
  public_suffix (>= 2.0.2, < 6.0)
12
12
  crack (0.4.5)
13
13
  rexml
@@ -24,18 +24,18 @@ GEM
24
24
  minitest-parallel_fork (1.3.0)
25
25
  minitest (>= 5.15.0)
26
26
  netrc (0.11.0)
27
- public_suffix (5.0.0)
27
+ public_suffix (5.0.3)
28
28
  rake (13.0.6)
29
29
  rest-client (2.1.0)
30
30
  http-accept (>= 1.7.0, < 2.0)
31
31
  http-cookie (>= 1.0.2, < 2.0)
32
32
  mime-types (>= 1.16, < 4.0)
33
33
  netrc (~> 0.8)
34
- rexml (3.2.5)
34
+ rexml (3.2.6)
35
35
  unf (0.1.4)
36
36
  unf_ext
37
37
  unf_ext (0.0.7.7)
38
- webmock (3.18.1)
38
+ webmock (3.19.1)
39
39
  addressable (>= 2.8.0)
40
40
  crack (>= 0.3.2)
41
41
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -41,7 +41,21 @@ module Seatsio
41
41
  end
42
42
 
43
43
  def replace(key:, channels:)
44
- @http_client.post("events/#{key}/channels/replace", { channels: channels })
44
+ @http_client.post("events/#{key}/channels/replace", { channels: ChannelsClient::channels_to_request(channels) })
45
+ end
46
+
47
+ def self.channels_to_request(channels)
48
+ result = []
49
+ channels.each do |channel|
50
+ r = {}
51
+ r["key"] = channel.key
52
+ r["name"] = channel.name
53
+ r["color"] = channel.color
54
+ r["index"] = channel.index if channel.index != nil
55
+ r["objects"] = channel.objects if channel.objects != nil
56
+ result.push(r)
57
+ end
58
+ result
45
59
  end
46
60
 
47
61
  private
@@ -28,13 +28,13 @@ module Seatsio
28
28
  end
29
29
 
30
30
  def create(name: nil, venue_type: nil, categories: nil)
31
- payload = build_chart_request name: name, venue_type: venue_type, categories: categories
31
+ payload = build_chart_request name, venue_type, categories
32
32
  response = @http_client.post('charts', payload)
33
33
  Chart.new(response)
34
34
  end
35
35
 
36
36
  def update(key:, new_name: nil, categories: nil)
37
- payload = build_chart_request name: new_name, categories: categories
37
+ payload = build_chart_request new_name, nil, categories
38
38
  @http_client.post("charts/#{key}", payload)
39
39
  end
40
40
 
@@ -64,12 +64,6 @@ module Seatsio
64
64
  Chart.new(response)
65
65
  end
66
66
 
67
- def copy_to_subaccount(chart_key, subaccount_id)
68
- url = "charts/#{chart_key}/version/published/actions/copy-to/#{subaccount_id}"
69
- response = @http_client.post url
70
- Chart.new(response)
71
- end
72
-
73
67
  def copy_to_workspace(chart_key, to_workspace_key)
74
68
  url = "charts/#{chart_key}/version/published/actions/copy-to-workspace/#{to_workspace_key}"
75
69
  response = @http_client.post url
@@ -141,7 +135,7 @@ module Seatsio
141
135
 
142
136
  private
143
137
 
144
- def build_chart_request(name: nil, venue_type: nil, categories: nil)
138
+ def build_chart_request(name, venue_type, categories)
145
139
  result = {}
146
140
  result['name'] = name if name
147
141
  result['venueType'] = venue_type if venue_type
@@ -231,19 +231,6 @@ module Seatsio
231
231
  end
232
232
  end
233
233
 
234
- class Subaccount
235
- attr_reader :id, :secret_key, :designer_key, :public_key, :name, :active
236
-
237
- def initialize(data)
238
- @id = data['id']
239
- @public_key = data['publicKey']
240
- @secret_key = data['secretKey']
241
- @designer_key = data['designerKey']
242
- @name = data['name']
243
- @active = data['active']
244
- end
245
- end
246
-
247
234
  class Workspace
248
235
  attr_reader :id, :name, :key, :secret_key, :is_test, :is_active, :is_default
249
236
 
@@ -18,11 +18,8 @@ module Seatsio
18
18
  @channels = ChannelsClient.new(@http_client)
19
19
  end
20
20
 
21
- def create(chart_key: nil, event_key: nil, name: nil, date: nil, table_booking_config: nil, object_categories: nil, categories: nil)
22
- payload = build_event_request(chart_key: chart_key, event_key: event_key,
23
- name: name, date: date,
24
- table_booking_config: table_booking_config,
25
- object_categories: object_categories, categories: categories)
21
+ def create(chart_key: nil, event_key: nil, name: nil, date: nil, table_booking_config: nil, object_categories: nil, categories: nil, channels: nil)
22
+ payload = build_event_request(chart_key, event_key, name, date, table_booking_config, object_categories, categories, channels: channels)
26
23
  response = @http_client.post("events", payload)
27
24
  Event.new(response)
28
25
  end
@@ -34,14 +31,7 @@ module Seatsio
34
31
  end
35
32
 
36
33
  def update(key:, chart_key: nil, event_key: nil, name: nil, date: nil, table_booking_config: nil, object_categories: nil, categories: nil)
37
- payload = build_event_request(
38
- chart_key: chart_key,
39
- event_key: event_key,
40
- name: name,
41
- date: date,
42
- table_booking_config: table_booking_config,
43
- object_categories: object_categories,
44
- categories: categories)
34
+ payload = build_event_request(chart_key, event_key, name, date, table_booking_config, object_categories, categories)
45
35
  @http_client.post("/events/#{key}", payload)
46
36
  end
47
37
 
@@ -169,7 +159,7 @@ module Seatsio
169
159
  payload
170
160
  end
171
161
 
172
- def build_event_request(chart_key: nil, event_key: nil, name: nil, date: nil, table_booking_config: nil, object_categories: nil, categories: nil)
162
+ def build_event_request(chart_key, event_key, name, date, table_booking_config, object_categories, categories, channels: nil)
173
163
  result = {}
174
164
  result["chartKey"] = chart_key if chart_key
175
165
  result["eventKey"] = event_key if event_key
@@ -178,17 +168,18 @@ module Seatsio
178
168
  result["tableBookingConfig"] = table_booking_config_to_request(table_booking_config) if table_booking_config != nil
179
169
  result["objectCategories"] = object_categories if object_categories != nil
180
170
  result["categories"] = categories_to_request(categories) if categories != nil
171
+ result["channels"] = ChannelsClient::channels_to_request(channels) if channels != nil
181
172
  result
182
173
  end
183
174
 
184
175
  def build_events_request(chart_key: nil, event_creation_params: nil)
185
176
  result = {}
186
177
  result["chartKey"] = chart_key
187
- result["events"] = event_creation_params_to_request(params: event_creation_params)
178
+ result["events"] = event_creation_params_to_request(event_creation_params)
188
179
  result
189
180
  end
190
181
 
191
- def event_creation_params_to_request(params: nil)
182
+ def event_creation_params_to_request(params)
192
183
  result = []
193
184
  params.each do |param|
194
185
  r = {}
@@ -198,6 +189,7 @@ module Seatsio
198
189
  r["tableBookingConfig"] = table_booking_config_to_request(param[:table_booking_config]) if param[:table_booking_config] != nil
199
190
  r["objectCategories"] = param[:object_categories] if param[:object_categories] != nil
200
191
  r["categories"] = categories_to_request(param[:categories]) if param[:categories] != nil
192
+ r["channels"] = ChannelsClient::channels_to_request(param[:channels]) if param[:channels] != nil
201
193
  result.push(r)
202
194
  end
203
195
  result
@@ -14,9 +14,8 @@ module Seatsio
14
14
  end
15
15
 
16
16
  def create(chart_key:, key: nil, number_of_events: nil, event_keys: nil,
17
- table_booking_config: 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)
17
+ table_booking_config: nil, channels: nil)
18
+ request = build_create_season_request(chart_key, key, number_of_events, event_keys, table_booking_config, channels)
20
19
  response = @http_client.post('seasons', request)
21
20
  Season.new(response)
22
21
  end
@@ -55,13 +54,14 @@ module Seatsio
55
54
 
56
55
  private
57
56
 
58
- def build_create_season_request(chart_key: nil, key: nil, number_of_events: nil, event_keys: nil, table_booking_config: nil)
57
+ def build_create_season_request(chart_key, key, number_of_events, event_keys, table_booking_config, channels)
59
58
  request = {}
60
59
  request['chartKey'] = chart_key if chart_key
61
60
  request['key'] = key if key
62
61
  request['numberOfEvents'] = number_of_events if number_of_events
63
62
  request['eventKeys'] = event_keys if event_keys
64
63
  request['tableBookingConfig'] = table_booking_config_to_request(table_booking_config) if table_booking_config != nil
64
+ request['channels'] = ChannelsClient::channels_to_request(channels) if channels != nil
65
65
  request
66
66
  end
67
67
 
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "45.1.0"
2
+ VERSION = "46.0.0"
3
3
  end
data/lib/seatsio.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'seatsio/version'
2
2
  require 'seatsio/charts'
3
- require 'seatsio/subaccounts'
4
3
  require 'seatsio/workspaces'
5
4
  require 'seatsio/events'
6
5
  require 'seatsio/seasons'
@@ -11,14 +10,13 @@ require 'seatsio/usage_reports'
11
10
 
12
11
  module Seatsio
13
12
  class Client
14
- attr_reader :charts, :subaccounts, :workspaces, :events, :seasons,
13
+ attr_reader :charts, :workspaces, :events, :seasons,
15
14
  :hold_tokens, :chart_reports, :event_reports, :usage_reports
16
15
 
17
16
  def initialize(region, secret_key, workspace_key = nil, max_retries = 5)
18
17
  base_url = region.url
19
18
  @http_client = Seatsio::HttpClient.new(secret_key, workspace_key, base_url, max_retries)
20
19
  @charts = ChartsClient.new(@http_client)
21
- @subaccounts = SubaccountsClient.new(@http_client)
22
20
  @workspaces = WorkspacesClient.new(@http_client)
23
21
  @events = EventsClient.new(@http_client)
24
22
  @seasons = SeasonsClient.new(@http_client, self)
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: 45.1.0
4
+ version: 46.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: 2023-08-23 00:00:00.000000000 Z
11
+ date: 2023-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -141,7 +141,6 @@ files:
141
141
  - lib/seatsio/httpClient.rb
142
142
  - lib/seatsio/pagination/cursor.rb
143
143
  - lib/seatsio/seasons.rb
144
- - lib/seatsio/subaccounts.rb
145
144
  - lib/seatsio/usage_reports.rb
146
145
  - lib/seatsio/util.rb
147
146
  - lib/seatsio/version.rb
@@ -1,81 +0,0 @@
1
- require "seatsio/exception"
2
- require "base64"
3
- require "seatsio/httpClient"
4
- require "seatsio/domain"
5
- require "json"
6
- require "cgi"
7
- require "seatsio/domain"
8
-
9
- module Seatsio
10
- class SubaccountsClient
11
- def initialize(http_client)
12
- @http_client = http_client
13
- end
14
-
15
- def create(name: nil)
16
- body = {}
17
- body['name'] = name if name
18
-
19
- response = @http_client.post("subaccounts", body)
20
- Subaccount.new(response)
21
- end
22
-
23
- def update(id:, name: nil)
24
- body = {}
25
- body['name'] = name if name
26
- @http_client.post("subaccounts/#{id}", body)
27
- end
28
-
29
- def list(filter: nil)
30
- extended_cursor = cursor
31
- extended_cursor.set_query_param('filter', filter)
32
- extended_cursor
33
- end
34
-
35
- def active
36
- cursor status: 'active'
37
- end
38
-
39
- def inactive
40
- cursor status: 'inactive'
41
- end
42
-
43
- def activate(id:)
44
- @http_client.post("/subaccounts/#{id}/actions/activate")
45
- end
46
-
47
- def deactivate(id:)
48
- @http_client.post("/subaccounts/#{id}/actions/deactivate")
49
- end
50
-
51
- def retrieve(id:)
52
- response = @http_client.get("/subaccounts/#{id}")
53
- Subaccount.new(response)
54
- end
55
-
56
- def copy_chart_to_parent(id: nil, chart_key: nil)
57
- response = @http_client.post("/subaccounts/#{id}/charts/#{chart_key}/actions/copy-to/parent")
58
- Chart.new(response)
59
- end
60
-
61
- def copy_chart_to_subaccount(from_id: nil, to_id: nil, chart_key: nil)
62
- response = @http_client.post("/subaccounts/#{from_id}/charts/#{chart_key}/actions/copy-to/#{to_id}")
63
- Chart.new(response)
64
- end
65
-
66
- def regenerate_secret_key(id:)
67
- @http_client.post("/subaccounts/#{id}/secret-key/actions/regenerate")
68
- end
69
-
70
- def regenerate_designer_key(id:)
71
- @http_client.post("/subaccounts/#{id}/designer-key/actions/regenerate")
72
- end
73
-
74
- private
75
-
76
- def cursor(status: nil)
77
- endpoint = status ? "subaccounts/#{status}" : 'subaccounts'
78
- Pagination::Cursor.new(Subaccount, endpoint, @http_client)
79
- end
80
- end
81
- end