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 +4 -4
- data/.github/workflows/build.yml +1 -1
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +41 -5
- data/lib/seatsio/domain.rb +2 -2
- data/lib/seatsio/event_reports.rb +18 -6
- data/lib/seatsio/events/change_object_status_request.rb +3 -1
- data/lib/seatsio/events.rb +3 -3
- data/lib/seatsio/exception.rb +3 -0
- data/lib/seatsio/httpClient.rb +5 -2
- data/lib/seatsio/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e9e68de3cd7eac52d0604ab81e6572bc897bfed4ef71ec40f0ef2bf598d5ef0
|
4
|
+
data.tar.gz: 999a8991efff73ef71f0c4b0b18bb41d589c0a7aaf7a11784d2f65db5f803b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b40d67fadfc461bbf774d2ae580b467dc7b81d63e0f245b92c3532a571e061cb0ee73b0e6f3650496c0a3dbbd523756ce70414f3c243014286134143a6af434
|
7
|
+
data.tar.gz: 06776edd55219aee088bc763bd91e657c0b8c3f72a9358e7d6ca9b6b84fcc1149aaa8f63d9c1401008201511f7ff96870aba496690917e7b3a97fd3310cff304
|
data/.github/workflows/build.yml
CHANGED
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.0
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,12 +3,16 @@
|
|
3
3
|
[](https://github.com/seatsio/seatsio-ruby/actions/workflows/build.yml)
|
4
4
|
[](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.
|
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
|
data/lib/seatsio/domain.rb
CHANGED
@@ -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, :
|
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
|
-
@
|
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
|
75
|
-
fetch_report('
|
74
|
+
def by_availability(event_key, availability = nil)
|
75
|
+
fetch_report('byAvailability', event_key, availability)
|
76
76
|
end
|
77
77
|
|
78
|
-
def
|
79
|
-
fetch_summary_report('
|
78
|
+
def summary_by_availability(event_key)
|
79
|
+
fetch_summary_report('byAvailability', event_key)
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
83
|
-
fetch_deep_summary_report('
|
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
|
|
data/lib/seatsio/events.rb
CHANGED
@@ -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("
|
70
|
+
response = @http_client.post("events/groups/actions/change-object-status", request)
|
71
71
|
ChangeObjectStatusResult.new(response)
|
72
72
|
end
|
73
73
|
|
data/lib/seatsio/exception.rb
CHANGED
data/lib/seatsio/httpClient.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/seatsio/version.rb
CHANGED
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:
|
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-
|
11
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|