seatsio 32.0.0 → 32.6.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: 2a4c05feef8448daa977bdc2148b893bd92986ba8da80765f23b5dc80ac57f9e
4
- data.tar.gz: aa0229bf2f040f406ac18b788b74fa540a16420de533cdecbe8ed1aec5abdf26
3
+ metadata.gz: c59ef6860b18c605ab3c844cac4f320215a981421129ca2eb7d537acaea1f738
4
+ data.tar.gz: 25cd36b90507702986d11172e2f0345686e2bf14a372f3af42323b50b37196a5
5
5
  SHA512:
6
- metadata.gz: 8f6d5d72e8e7defd3f34b8bbb042e60440047a0e705d62b6f71053cd8f59eacc34bdc62f1bf55c56cd44433ba621fa053eff782382bceb8978c8446140f0f23a
7
- data.tar.gz: 2ff422ca32191907b0c22659ad8f6a295f74e4843c2bc3c96be27c2a208486e36ad410696159f27c3665fffc64307ba20e9e64e024b2fc0c46abbfb59d499ddc
6
+ metadata.gz: 0dee64ba2af519b0b0ae00cbbb68a936d280aa2aafc130c3c7d4ca9dbdcefb302971ac577d15b43b1b3e1a89620501825d02e877f298a2763cbdbdc9b08dbfed
7
+ data.tar.gz: 6788d6eea52021eb3d04b97533f9594270af300cee70fe80a6e822407d940a3fccd1f821a151ac78f2218d1db22618fa86c48ac5dd05fb9909917e96c3070217
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: monthly
7
+ open-pull-requests-limit: 10
8
+ ignore:
9
+ - dependency-name: minitest
10
+ versions:
11
+ - 5.14.4
data/Gemfile.lock CHANGED
@@ -1,37 +1,39 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (32.0.0)
4
+ seatsio (32.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- addressable (2.6.0)
10
- public_suffix (>= 2.0.2, < 4.0)
11
- crack (0.4.3)
12
- safe_yaml (~> 1.0.0)
13
- domain_name (0.5.20180417)
9
+ addressable (2.8.0)
10
+ public_suffix (>= 2.0.2, < 5.0)
11
+ crack (0.4.5)
12
+ rexml
13
+ domain_name (0.5.20190701)
14
14
  unf (>= 0.0.5, < 1.0.0)
15
- hashdiff (0.4.0)
15
+ hashdiff (1.0.1)
16
+ http-accept (1.7.0)
16
17
  http-cookie (1.0.3)
17
18
  domain_name (~> 0.5)
18
- mime-types (3.2.2)
19
+ mime-types (3.3.1)
19
20
  mime-types-data (~> 3.2015)
20
- mime-types-data (3.2019.0331)
21
- minitest (5.11.3)
21
+ mime-types-data (3.2021.0225)
22
+ minitest (5.14.4)
22
23
  netrc (0.11.0)
23
- public_suffix (3.1.0)
24
- rake (13.0.1)
25
- rest-client (2.0.2)
24
+ public_suffix (4.0.6)
25
+ rake (13.0.6)
26
+ rest-client (2.1.0)
27
+ http-accept (>= 1.7.0, < 2.0)
26
28
  http-cookie (>= 1.0.2, < 2.0)
27
29
  mime-types (>= 1.16, < 4.0)
28
30
  netrc (~> 0.8)
29
- safe_yaml (1.0.5)
31
+ rexml (3.2.5)
30
32
  unf (0.1.4)
31
33
  unf_ext
32
- unf_ext (0.0.7.6)
33
- webmock (3.6.0)
34
- addressable (>= 2.3.6)
34
+ unf_ext (0.0.7.7)
35
+ webmock (3.14.0)
36
+ addressable (>= 2.8.0)
35
37
  crack (>= 0.3.2)
36
38
  hashdiff (>= 0.4.0, < 2.0.0)
37
39
 
@@ -39,7 +41,7 @@ PLATFORMS
39
41
  ruby
40
42
 
41
43
  DEPENDENCIES
42
- bundler (~> 1.16)
44
+ bundler (~> 2.2)
43
45
  minitest (~> 5.0)
44
46
  rake (~> 13.0)
45
47
  rest-client (~> 2.0, >= 2.0.2)
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # seatsio-ruby, the official Seats.io Ruby client library
2
2
 
3
- ![Build](https://github.com/seatsio/seatsio-ruby/workflows/Build/badge.svg)
3
+ [![Build](https://github.com/seatsio/seatsio-ruby/workflows/Build/badge.svg)](https://github.com/seatsio/seatsio-ruby/actions/workflows/build.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/seatsio.svg)](https://badge.fury.io/rb/seatsio)
4
5
 
5
6
  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
7
 
@@ -16,7 +17,7 @@ seatsio-ruby follows semver since v23.3.0.
16
17
  require('seatsio')
17
18
  client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key") # can be found on https://app.seats.io/workspace-settings
18
19
  chart = client.charts.create
19
- event = client.events.create key: chart.key
20
+ event = client.events.create chart_key: chart.key
20
21
  ```
21
22
 
22
23
  ### Booking objects
@@ -119,5 +120,14 @@ This exception contains a message string describing what went wrong, and also tw
119
120
 
120
121
  This library supports [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff).
121
122
 
122
- When you send too many concurrent requests, the server returns an error `429 - Too Many Requests`. We react to this by waiting for a while, and then retrying the request.
123
- If the request still fails with an error `429`, we wait a little longer, and try again. This happens at most 5 times, before we give up (after approximately 15 seconds).
123
+ When you send too many concurrent requests, the server returns an error `429 - Too Many Requests`. The client reacts to this by waiting for a while, and then retrying the request.
124
+ If the request still fails with an error `429`, it waits a little longer, and try again. By default this happens 5 times, before giving up (after approximately 15 seconds).
125
+
126
+ To change the maximum number of retries, create the client as follows:
127
+
128
+ ```ruby
129
+ require('seatsio')
130
+ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key", max_retries = 3)
131
+ ```
132
+
133
+ Passing in 0 disables exponential backoff completely. In that case, the client will never retry a failed request.
@@ -6,14 +6,18 @@ require 'cgi'
6
6
 
7
7
  module Seatsio
8
8
  class ChartReportsClient
9
- def initialize(secret_key, workspace_key, base_url)
10
- @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
9
+ def initialize(http_client)
10
+ @http_client = http_client
11
11
  end
12
12
 
13
13
  def by_label(chart_key, book_whole_tables = nil)
14
14
  get_chart_report('byLabel', chart_key, book_whole_tables)
15
15
  end
16
16
 
17
+ def by_object_type(chart_key, book_whole_tables = nil)
18
+ get_chart_report('byObjectType', chart_key, book_whole_tables)
19
+ end
20
+
17
21
  def by_category_key(chart_key, book_whole_tables = nil)
18
22
  get_chart_report('byCategoryKey', chart_key, book_whole_tables)
19
23
  end
@@ -11,8 +11,8 @@ module Seatsio
11
11
  class ChartsClient
12
12
  attr_reader :archive
13
13
 
14
- def initialize(secret_key, workspace_key, base_url)
15
- @http_client = Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
14
+ def initialize(http_client)
15
+ @http_client = http_client
16
16
  @archive = Pagination::Cursor.new(Chart, 'charts/archive', @http_client)
17
17
  end
18
18
 
@@ -263,12 +263,13 @@ module Seatsio
263
263
 
264
264
  class ChartReportItem
265
265
 
266
- attr_reader :label, :labels, :category_key, :category_label, :section, :entrance, :capacity, :object_type,
267
- :left_neighbour, :right_neighbour, :book_as_a_whole
266
+ attr_reader :label, :labels, :ids, :category_key, :category_label, :section, :entrance, :capacity, :object_type,
267
+ :left_neighbour, :right_neighbour, :book_as_a_whole, :distance_to_focal_point
268
268
 
269
269
  def initialize(data)
270
270
  @label = data['label']
271
271
  @labels = data['labels']
272
+ @ids = data['ids']
272
273
  @category_label = data['categoryLabel']
273
274
  @category_key = data['categoryKey']
274
275
  @section = data['section']
@@ -278,6 +279,7 @@ module Seatsio
278
279
  @left_neighbour = data['leftNeighbour']
279
280
  @right_neighbour = data['rightNeighbour']
280
281
  @book_as_a_whole = data['bookAsAWhole']
282
+ @distance_to_focal_point = data['distanceToFocalPoint']
281
283
  end
282
284
  end
283
285
 
@@ -324,17 +326,18 @@ module Seatsio
324
326
  end
325
327
 
326
328
  class EventReportItem
327
- attr_reader :labels, :label, :order_id, :extra_data, :capacity, :status,
329
+ attr_reader :labels, :ids, :label, :order_id, :extra_data, :capacity, :status,
328
330
  :category_key, :entrance, :object_type, :hold_token, :category_label,
329
331
  :ticket_type, :num_booked, :num_free, :num_held, :for_sale, :section,
330
332
  :is_accessible, :is_companion_seat, :has_restricted_view, :displayed_object_type,
331
333
  :left_neighbour, :right_neighbour, :is_selectable, :is_disabled_by_social_distancing, :channel,
332
- :book_as_a_whole
334
+ :book_as_a_whole, :distance_to_focal_point
333
335
 
334
336
  def initialize(data)
335
337
  @status = data['status']
336
338
  @label = data['label']
337
339
  @labels = data['labels']
340
+ @ids = data['ids']
338
341
  @category_label = data['categoryLabel']
339
342
  @category_key = data['categoryKey']
340
343
  @ticket_type = data['ticketType']
@@ -359,6 +362,7 @@ module Seatsio
359
362
  @is_disabled_by_social_distancing = data['isDisabledBySocialDistancing']
360
363
  @channel = data['channel']
361
364
  @book_as_a_whole = data['bookAsAWhole']
365
+ @distance_to_focal_point = data['distanceToFocalPoint']
362
366
  end
363
367
  end
364
368
 
@@ -7,8 +7,12 @@ require 'cgi'
7
7
  module Seatsio
8
8
  # Client for fetching event reports
9
9
  class EventReportsClient
10
- def initialize(secret_key, workspace_key, base_url)
11
- @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
10
+ def initialize(http_client)
11
+ @http_client = http_client
12
+ end
13
+
14
+ def by_status(event_key, status = nil)
15
+ fetch_report('byStatus', event_key, status)
12
16
  end
13
17
 
14
18
  def summary_by_status(event_key)
@@ -19,6 +23,22 @@ module Seatsio
19
23
  fetch_deep_summary_report('byStatus', event_key)
20
24
  end
21
25
 
26
+ def by_object_type(event_key, object_type = nil)
27
+ fetch_report('byObjectType', event_key, object_type)
28
+ end
29
+
30
+ def summary_by_object_type(event_key)
31
+ fetch_summary_report('byObjectType', event_key)
32
+ end
33
+
34
+ def deep_summary_by_object_type(event_key)
35
+ fetch_deep_summary_report('byObjectType', event_key)
36
+ end
37
+
38
+ def by_category_key(event_key, category_key = nil)
39
+ fetch_report('byCategoryKey', event_key, category_key)
40
+ end
41
+
22
42
  def summary_by_category_key(event_key)
23
43
  fetch_summary_report('byCategoryKey', event_key)
24
44
  end
@@ -27,6 +47,10 @@ module Seatsio
27
47
  fetch_deep_summary_report('byCategoryKey', event_key)
28
48
  end
29
49
 
50
+ def by_category_label(event_key, category_label = nil)
51
+ fetch_report('byCategoryLabel', event_key, category_label)
52
+ end
53
+
30
54
  def summary_by_category_label(event_key)
31
55
  fetch_summary_report('byCategoryLabel', event_key)
32
56
  end
@@ -35,6 +59,10 @@ module Seatsio
35
59
  fetch_deep_summary_report('byCategoryLabel', event_key)
36
60
  end
37
61
 
62
+ def by_section(event_key, section = nil)
63
+ fetch_report('bySection', event_key, section)
64
+ end
65
+
38
66
  def summary_by_section(event_key)
39
67
  fetch_summary_report('bySection', event_key)
40
68
  end
@@ -43,6 +71,10 @@ module Seatsio
43
71
  fetch_deep_summary_report('bySection', event_key)
44
72
  end
45
73
 
74
+ def by_selectability(event_key, selectability = nil)
75
+ fetch_report('bySelectability', event_key, selectability)
76
+ end
77
+
46
78
  def summary_by_selectability(event_key)
47
79
  fetch_summary_report('bySelectability', event_key)
48
80
  end
@@ -51,6 +83,10 @@ module Seatsio
51
83
  fetch_deep_summary_report('bySelectability', event_key)
52
84
  end
53
85
 
86
+ def by_channel(event_key, channelKey = nil)
87
+ fetch_report('byChannel', event_key, channelKey)
88
+ end
89
+
54
90
  def summary_by_channel(event_key)
55
91
  fetch_summary_report('byChannel', event_key)
56
92
  end
@@ -63,34 +99,10 @@ module Seatsio
63
99
  fetch_report('byLabel', event_key, label)
64
100
  end
65
101
 
66
- def by_status(event_key, status = nil)
67
- fetch_report('byStatus', event_key, status)
68
- end
69
-
70
- def by_category_label(event_key, category_label = nil)
71
- fetch_report('byCategoryLabel', event_key, category_label)
72
- end
73
-
74
- def by_category_key(event_key, category_key = nil)
75
- fetch_report('byCategoryKey', event_key, category_key)
76
- end
77
-
78
102
  def by_order_id(event_key, order_id = nil)
79
103
  fetch_report('byOrderId', event_key, order_id)
80
104
  end
81
105
 
82
- def by_section(event_key, section = nil)
83
- fetch_report('bySection', event_key, section)
84
- end
85
-
86
- def by_selectability(event_key, selectability = nil)
87
- fetch_report('bySelectability', event_key, selectability)
88
- end
89
-
90
- def by_channel(event_key, channelKey = nil)
91
- fetch_report('byChannel', event_key, channelKey)
92
- end
93
-
94
106
  private
95
107
 
96
108
  def fetch_summary_report(report_type, event_key)
@@ -11,8 +11,8 @@ require "seatsio/events/change_best_available_object_status_request"
11
11
  module Seatsio
12
12
 
13
13
  class EventsClient
14
- def initialize(secret_key, workspace_key, base_url)
15
- @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
14
+ def initialize(http_client)
15
+ @http_client = http_client
16
16
  end
17
17
 
18
18
  def create(chart_key: nil, event_key: nil, table_booking_config: nil, social_distancing_ruleset_key: nil)
@@ -11,8 +11,8 @@ module Seatsio
11
11
 
12
12
  class HoldTokensClient
13
13
  # @return [Seatsio::HoldTokensClient]
14
- def initialize(secret_key, workspace_key, base_url)
15
- @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
14
+ def initialize(http_client)
15
+ @http_client = http_client
16
16
  end
17
17
 
18
18
  def create(expires_in_minutes: nil)
@@ -6,10 +6,11 @@ require "uri"
6
6
 
7
7
  module Seatsio
8
8
  class HttpClient
9
- def initialize(secret_key, workspace_key, base_url)
9
+ def initialize(secret_key, workspace_key, base_url, max_retries)
10
10
  @secret_key = Base64.encode64(secret_key)
11
11
  @workspace_key = workspace_key
12
12
  @base_url = base_url
13
+ @max_retries = max_retries
13
14
  end
14
15
 
15
16
  def execute(*args)
@@ -55,7 +56,7 @@ module Seatsio
55
56
  begin
56
57
  return RestClient::Request.execute(request_options)
57
58
  rescue RestClient::ExceptionWithResponse => e
58
- if e.response.code != 429 || retry_count >= 5
59
+ if e.response.code != 429 || retry_count >= @max_retries
59
60
  raise e
60
61
  else
61
62
  wait_time = (2 ** (retry_count + 2)) / 10.0
@@ -8,8 +8,8 @@ require "seatsio/domain"
8
8
 
9
9
  module Seatsio
10
10
  class SubaccountsClient
11
- def initialize(secret_key, workspace_key, base_url)
12
- @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
11
+ def initialize(http_client)
12
+ @http_client = http_client
13
13
  end
14
14
 
15
15
  def create(name: nil)
@@ -6,8 +6,8 @@ require 'cgi'
6
6
 
7
7
  module Seatsio
8
8
  class UsageReportsClient
9
- def initialize(secret_key, workspace_key, base_url)
10
- @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
9
+ def initialize(http_client)
10
+ @http_client = http_client
11
11
  end
12
12
 
13
13
  def summary_for_all_months
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "32.0.0"
2
+ VERSION = "32.6.0"
3
3
  end
@@ -8,8 +8,9 @@ require "seatsio/domain"
8
8
 
9
9
  module Seatsio
10
10
  class WorkspacesClient
11
- def initialize(secret_key, base_url)
12
- @http_client = ::Seatsio::HttpClient.new(secret_key, nil, base_url)
11
+
12
+ def initialize(http_client)
13
+ @http_client = http_client
13
14
  end
14
15
 
15
16
  def create(name:, is_test: nil)
@@ -50,6 +51,18 @@ module Seatsio
50
51
  extended_cursor
51
52
  end
52
53
 
54
+ def active(filter: nil)
55
+ extended_cursor = Pagination::Cursor.new(Workspace, 'workspaces/active', @http_client)
56
+ extended_cursor.set_query_param('filter', filter)
57
+ extended_cursor
58
+ end
59
+
60
+ def inactive(filter: nil)
61
+ extended_cursor = Pagination::Cursor.new(Workspace, 'workspaces/inactive', @http_client)
62
+ extended_cursor.set_query_param('filter', filter)
63
+ extended_cursor
64
+ end
65
+
53
66
  def retrieve(key:)
54
67
  response = @http_client.get("/workspaces/#{key}")
55
68
  Workspace.new(response)
data/lib/seatsio.rb CHANGED
@@ -13,19 +13,22 @@ module Seatsio
13
13
  attr_reader :charts, :subaccounts, :workspaces, :events,
14
14
  :hold_tokens, :chart_reports, :event_reports, :usage_reports
15
15
 
16
- def initialize(region, secret_key, workspace_key = nil)
16
+ def initialize(region, secret_key, workspace_key = nil, max_retries = 5)
17
17
  base_url = region.url
18
- @charts = ChartsClient.new(secret_key, workspace_key, base_url)
19
- @subaccounts = SubaccountsClient.new(secret_key, workspace_key, base_url)
20
- @workspaces = WorkspacesClient.new(secret_key, base_url)
21
- @events = EventsClient.new(secret_key, workspace_key, base_url)
22
- @hold_tokens = HoldTokensClient.new(secret_key, workspace_key, base_url)
23
- @chart_reports = ChartReportsClient.new(secret_key, workspace_key, base_url)
24
- @event_reports = EventReportsClient.new(secret_key, workspace_key, base_url)
25
- @usage_reports = UsageReportsClient.new(secret_key, workspace_key, base_url)
18
+ @http_client = Seatsio::HttpClient.new(secret_key, workspace_key, base_url, max_retries)
19
+ @charts = ChartsClient.new(@http_client)
20
+ @subaccounts = SubaccountsClient.new(@http_client)
21
+ @workspaces = WorkspacesClient.new(@http_client)
22
+ @events = EventsClient.new(@http_client)
23
+ @hold_tokens = HoldTokensClient.new(@http_client)
24
+ @chart_reports = ChartReportsClient.new(@http_client)
25
+ @event_reports = EventReportsClient.new(@http_client)
26
+ @usage_reports = UsageReportsClient.new(@http_client)
26
27
  end
28
+
27
29
  end
28
30
 
31
+
29
32
  class Region
30
33
  attr_reader :url
31
34
 
data/releasing.md CHANGED
@@ -1,4 +1,5 @@
1
1
  *Note: this is internal documentation for the seats.io team*
2
2
 
3
3
  1) Set the correct version number in lib/seatsio/version.rb
4
+ 1) Set the correct version number in Gemfile.lock
4
5
  2) Create the release in GitHub
data/seatsio.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.16"
23
+ spec.add_development_dependency "bundler", "~> 2.2"
24
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'
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: 32.0.0
4
+ version: 32.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seats.io
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-07 00:00:00.000000000 Z
11
+ date: 2021-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '2.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +100,7 @@ extensions: []
100
100
  extra_rdoc_files: []
101
101
  files:
102
102
  - ".editorconfig"
103
+ - ".github/dependabot.yml"
103
104
  - ".github/workflows/build.yml"
104
105
  - ".github/workflows/publish.yml"
105
106
  - ".gitignore"
@@ -133,7 +134,7 @@ files:
133
134
  homepage: http://seats.io
134
135
  licenses: []
135
136
  metadata: {}
136
- post_install_message:
137
+ post_install_message:
137
138
  rdoc_options: []
138
139
  require_paths:
139
140
  - lib
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
150
  version: '0'
150
151
  requirements: []
151
152
  rubygems_version: 3.1.2
152
- signing_key:
153
+ signing_key:
153
154
  specification_version: 4
154
155
  summary: the official Seats.io Ruby client library
155
156
  test_files: []