seatsio 33.0.0 → 35.1.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: eb9b9ede155afb77e4c55fac2ac7a9da697e5cf7f4f80e9a772002879718166d
4
- data.tar.gz: ed80c3e21eca4567f4e613bfe1ed7e4dba90e62f4605dc2b4b47d1aface142aa
3
+ metadata.gz: 4e9e68de3cd7eac52d0604ab81e6572bc897bfed4ef71ec40f0ef2bf598d5ef0
4
+ data.tar.gz: 999a8991efff73ef71f0c4b0b18bb41d589c0a7aaf7a11784d2f65db5f803b8a
5
5
  SHA512:
6
- metadata.gz: d4e792dcbdc73e9967de1c377b3a092dc4ba0f00615e8b57724580aa3cd93e29dcad82086f1ec1e9cd6ffc494ed6be4b85addcc01f422c4dd5462e286df836db
7
- data.tar.gz: 31648860929a47b3b368504c32d573dda0f3bfa2b6f679d645c8c7577a0764aedf27660061f81800c2852769386e238b2644b892fc728bb2e55785631738fa13
6
+ metadata.gz: 2b40d67fadfc461bbf774d2ae580b467dc7b81d63e0f245b92c3532a571e061cb0ee73b0e6f3650496c0a3dbbd523756ce70414f3c243014286134143a6af434
7
+ data.tar.gz: 06776edd55219aee088bc763bd91e657c0b8c3f72a9358e7d6ca9b6b84fcc1149aaa8f63d9c1401008201511f7ff96870aba496690917e7b3a97fd3310cff304
@@ -12,7 +12,7 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
  strategy:
14
14
  matrix:
15
- ruby-version: ['2.3']
15
+ ruby-version: ['2.4']
16
16
 
17
17
  steps:
18
18
  - uses: actions/checkout@v2
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /tmp/
9
9
  /.idea
10
10
  /seatsio-ruby.iml
11
+ /out
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.4.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (33.0.0)
4
+ seatsio (35.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -49,4 +49,4 @@ DEPENDENCIES
49
49
  webmock (~> 3.4, >= 3.4.2)
50
50
 
51
51
  BUNDLED WITH
52
- 1.17.2
52
+ 2.1.4
data/README.md CHANGED
@@ -3,12 +3,16 @@
3
3
  [![Build](https://github.com/seatsio/seatsio-ruby/workflows/Build/badge.svg)](https://github.com/seatsio/seatsio-ruby/actions/workflows/build.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/seatsio.svg)](https://badge.fury.io/rb/seatsio)
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
+ This is the official Ruby client library for the [Seats.io V2 REST API](https://docs.seats.io/docs/api-overview), supporting Ruby 2.4.0+
7
7
 
8
8
  ## Versioning
9
9
 
10
10
  seatsio-ruby follows semver since v23.3.0.
11
11
 
12
+ ## API reference
13
+
14
+ You can find a full API reference at https://www.rubydoc.info/gems/seatsio/
15
+
12
16
  ## Examples
13
17
 
14
18
  ### Creating a chart and an event
@@ -52,6 +56,22 @@ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
52
56
  client.events.change_object_status("<EVENT KEY>", ["A-1", "A-2"], "my-custom-status")
53
57
  ```
54
58
 
59
+ ### Retrieving object category and status (and other information)
60
+
61
+ ```ruby
62
+ require('seatsio')
63
+ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
64
+ object_infos = client.events.retrieve_object_infos key: event.key, labels: ['A-1', 'A-2']
65
+
66
+ puts object_infos['A-1'].category_key
67
+ puts object_infos['A-1'].category_label
68
+ puts object_infos['A-1'].status
69
+
70
+ puts object_infos['A-2'].category_key
71
+ puts object_infos['A-2'].category_label
72
+ puts object_infos['A-2'].status
73
+ ```
74
+
55
75
  ### Listing all charts
56
76
 
57
77
  ```ruby
@@ -73,7 +93,8 @@ Each page is Enumerable, and it has `next_page_starts_after` and `previous_page_
73
93
 
74
94
  ```ruby
75
95
  # ... user initially opens the screen ...
76
-
96
+ require('seatsio')
97
+ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
77
98
  firstPage = client.charts.list.first_page()
78
99
  firstPage.each do |chart|
79
100
  puts chart.key
@@ -82,7 +103,8 @@ end
82
103
 
83
104
  ```ruby
84
105
  # ... user clicks on 'next page' button ...
85
-
106
+ require('seatsio')
107
+ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
86
108
  nextPage = client.charts.list.page_after(firstPage.next_page_starts_after)
87
109
  nextPage.each do |chart|
88
110
  puts chart.key
@@ -91,7 +113,8 @@ end
91
113
 
92
114
  ```ruby
93
115
  # ... user clicks on 'previous page' button ...
94
-
116
+ require('seatsio')
117
+ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
95
118
  previousPage = client.charts.list.page_before(nextPage.previous_page_ends_before)
96
119
  previousPage.each do |chart|
97
120
  puts chart.key
@@ -102,10 +125,21 @@ end
102
125
 
103
126
  ```ruby
104
127
  require('seatsio')
105
- client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key")
128
+ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key") # can be found on https://app.seats.io/company-settings
106
129
  client.workspaces.create name: "a workspace"
107
130
  ```
108
131
 
132
+ ### Creating a chart and an event with the company admin key
133
+
134
+ ```ruby
135
+ require('seatsio')
136
+ # company admin key can be found on https://app.seats.io/company-settings
137
+ # workspace public key can be found on https://app.seats.io/workspace-settings
138
+ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key", "my-workspace-public-key")
139
+ chart = client.charts.create
140
+ event = client.events.create chart_key: chart.key
141
+ ```
142
+
109
143
  # Error handling
110
144
 
111
145
  When an API call results in a 4xx or 5xx error (e.g. when a chart could not be found), a SeatsioException is thrown.
@@ -123,6 +157,8 @@ This library supports [exponential backoff](https://en.wikipedia.org/wiki/Expone
123
157
  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
158
  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
159
 
160
+ We throw a `RateLimitExceededException` (which is a subclass of `SeatsioException`) when exponential backoff eventually fails.
161
+
126
162
  To change the maximum number of retries, create the client as follows:
127
163
 
128
164
  ```ruby
@@ -315,7 +315,7 @@ module Seatsio
315
315
  :category_key, :entrance, :object_type, :hold_token, :category_label,
316
316
  :ticket_type, :num_booked, :num_free, :num_held, :for_sale, :section,
317
317
  :is_accessible, :is_companion_seat, :has_restricted_view, :displayed_object_type,
318
- :left_neighbour, :right_neighbour, :is_selectable, :is_disabled_by_social_distancing, :channel,
318
+ :left_neighbour, :right_neighbour, :is_available, :is_disabled_by_social_distancing, :channel,
319
319
  :book_as_a_whole, :distance_to_focal_point, :holds
320
320
 
321
321
  def initialize(data)
@@ -343,7 +343,7 @@ module Seatsio
343
343
  @displayed_object_type = data['displayedObjectType']
344
344
  @left_neighbour = data['leftNeighbour']
345
345
  @right_neighbour = data['rightNeighbour']
346
- @is_selectable = data['isSelectable']
346
+ @is_available = data['isAvailable']
347
347
  @is_disabled_by_social_distancing = data['isDisabledBySocialDistancing']
348
348
  @channel = data['channel']
349
349
  @book_as_a_whole = data['bookAsAWhole']
@@ -71,16 +71,28 @@ module Seatsio
71
71
  fetch_deep_summary_report('bySection', event_key)
72
72
  end
73
73
 
74
- def by_selectability(event_key, selectability = nil)
75
- fetch_report('bySelectability', event_key, selectability)
74
+ def by_availability(event_key, availability = nil)
75
+ fetch_report('byAvailability', event_key, availability)
76
76
  end
77
77
 
78
- def summary_by_selectability(event_key)
79
- fetch_summary_report('bySelectability', event_key)
78
+ def summary_by_availability(event_key)
79
+ fetch_summary_report('byAvailability', event_key)
80
80
  end
81
81
 
82
- def deep_summary_by_selectability(event_key)
83
- fetch_deep_summary_report('bySelectability', event_key)
82
+ def deep_summary_by_availability(event_key)
83
+ fetch_deep_summary_report('byAvailability', event_key)
84
+ end
85
+
86
+ def by_availability_reason(event_key, availability_reason = nil)
87
+ fetch_report('byAvailabilityReason', event_key, availability_reason)
88
+ end
89
+
90
+ def summary_by_availability_reason(event_key)
91
+ fetch_summary_report('byAvailabilityReason', event_key)
92
+ end
93
+
94
+ def deep_summary_by_availability_reason(event_key)
95
+ fetch_deep_summary_report('byAvailabilityReason', event_key)
84
96
  end
85
97
 
86
98
  def by_channel(event_key, channelKey = nil)
@@ -1,4 +1,4 @@
1
- def create_change_object_status_request(object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, ignore_social_distancing)
1
+ def create_change_object_status_request(object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, ignore_social_distancing, allowed_previous_statuses, rejected_previous_statuses)
2
2
  result = {}
3
3
  result[:objects] = normalize(object_or_objects)
4
4
  result[:status] = status
@@ -13,6 +13,8 @@ def create_change_object_status_request(object_or_objects, status, hold_token, o
13
13
  result[:ignoreChannels] = ignore_channels if ignore_channels != nil
14
14
  result[:channelKeys] = channel_keys if channel_keys != nil
15
15
  result[:ignoreSocialDistancing] = ignore_social_distancing if ignore_social_distancing != nil
16
+ result[:allowedPreviousStatuses] = allowed_previous_statuses if allowed_previous_statuses != nil
17
+ result[:rejectedPreviousStatuses] = rejected_previous_statuses if rejected_previous_statuses != nil
16
18
  result
17
19
  end
18
20
 
@@ -62,12 +62,12 @@ module Seatsio
62
62
  self.change_object_status(event_key_or_keys, object_or_objects, Seatsio::EventObjectInfo::BOOKED, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, ignore_channels: ignore_channels, channel_keys: channel_keys, ignore_social_distancing: ignore_social_distancing)
63
63
  end
64
64
 
65
- 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, ignore_social_distancing: nil)
66
- request = create_change_object_status_request(object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, ignore_social_distancing)
65
+ 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, ignore_social_distancing: nil, allowed_previous_statuses: nil, rejected_previous_statuses: nil)
66
+ request = create_change_object_status_request(object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, ignore_social_distancing, allowed_previous_statuses, rejected_previous_statuses)
67
67
  request[:params] = {
68
68
  :expand => 'objects'
69
69
  }
70
- response = @http_client.post("seasons/actions/change-object-status", request)
70
+ response = @http_client.post("events/groups/actions/change-object-status", request)
71
71
  ChangeObjectStatusResult.new(response)
72
72
  end
73
73
 
@@ -3,6 +3,9 @@ module Seatsio
3
3
  class SeatsioException < StandardError
4
4
  end
5
5
 
6
+ class RateLimitExceededException < SeatsioException
7
+ end
8
+
6
9
  class NoMorePagesException < SeatsioException
7
10
  end
8
11
 
@@ -31,7 +31,6 @@ module Seatsio
31
31
  end
32
32
  end
33
33
 
34
-
35
34
  request_options = { method: args[0], url: url, headers: headers }
36
35
 
37
36
  if args[0] == :post
@@ -49,7 +48,11 @@ module Seatsio
49
48
  rescue RestClient::NotFound => e
50
49
  raise Exception::NotFoundException.new(e.response)
51
50
  rescue RestClient::ExceptionWithResponse => e
52
- raise Exception::SeatsioException.new(e.response)
51
+ if e.response.code == 429
52
+ raise Exception::RateLimitExceededException.new(e.response)
53
+ else
54
+ raise Exception::SeatsioException.new(e.response)
55
+ end
53
56
  rescue RestClient::Exceptions::Timeout
54
57
  raise Exception::SeatsioException.new("Timeout ERROR")
55
58
  rescue SocketError
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "33.0.0"
2
+ VERSION = "35.1.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: 33.0.0
4
+ version: 35.1.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-09-28 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler