seatsio 32.5.0 → 32.6.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: 4d21c2748ea74524c6c7889fd9ef694673a5fb9d52c31a8feac6b4de8ec43f69
4
- data.tar.gz: 51678457cdd12e5e6f1ea7f0793d91c2b9cb1560b7fd924a3610cf6d09e4aaa9
3
+ metadata.gz: c59ef6860b18c605ab3c844cac4f320215a981421129ca2eb7d537acaea1f738
4
+ data.tar.gz: 25cd36b90507702986d11172e2f0345686e2bf14a372f3af42323b50b37196a5
5
5
  SHA512:
6
- metadata.gz: '08be1edebfa338f7f2563dd4cb00755c2092bb2582c0b24356d0ed33c6764b1b4d3ae8f8e33f4b6b743183d14bafdf063c9e26ab5121fb269e37ff8c62d04c4b'
7
- data.tar.gz: 9394d8015e7314e6543c7de272e687ebfb9267da58cf4d68374f205c98403414765e61c40534fe54ba74b48d43b5bd1929105a722e9897759370ffcb005fa8f3
6
+ metadata.gz: 0dee64ba2af519b0b0ae00cbbb68a936d280aa2aafc130c3c7d4ca9dbdcefb302971ac577d15b43b1b3e1a89620501825d02e877f298a2763cbdbdc9b08dbfed
7
+ data.tar.gz: 6788d6eea52021eb3d04b97533f9594270af300cee70fe80a6e822407d940a3fccd1f821a151ac78f2218d1db22618fa86c48ac5dd05fb9909917e96c3070217
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (32.5.0)
4
+ seatsio (32.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,8 +32,8 @@ GEM
32
32
  unf (0.1.4)
33
33
  unf_ext
34
34
  unf_ext (0.0.7.7)
35
- webmock (3.13.0)
36
- addressable (>= 2.3.6)
35
+ webmock (3.14.0)
36
+ addressable (>= 2.8.0)
37
37
  crack (>= 0.3.2)
38
38
  hashdiff (>= 0.4.0, < 2.0.0)
39
39
 
data/README.md CHANGED
@@ -121,4 +121,13 @@ This exception contains a message string describing what went wrong, and also tw
121
121
  This library supports [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff).
122
122
 
123
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. This happens at most 5 times, before giving up (after approximately 15 seconds).
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,8 +6,8 @@ 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)
@@ -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
 
@@ -7,8 +7,8 @@ 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
12
  end
13
13
 
14
14
  def by_status(event_key, status = nil)
@@ -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.5.0"
2
+ VERSION = "32.6.0"
3
3
  end
@@ -9,8 +9,8 @@ require "seatsio/domain"
9
9
  module Seatsio
10
10
  class WorkspacesClient
11
11
 
12
- def initialize(secret_key, base_url)
13
- @http_client = ::Seatsio::HttpClient.new(secret_key, nil, base_url)
12
+ def initialize(http_client)
13
+ @http_client = http_client
14
14
  end
15
15
 
16
16
  def create(name:, is_test: nil)
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
 
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.5.0
4
+ version: 32.6.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: 2021-08-02 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