seatsio 33.0.0 → 33.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/Gemfile.lock +1 -1
- data/README.md +36 -4
- 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: 33473b549ec1ccc19d4cd335a986402488cb147e6578a5f02cfb841ef319e3a3
|
4
|
+
data.tar.gz: e0242b450577e6497845bd29a43435169f5e7c9425912c2097282382d5636bee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d66a102bba053bffd67fe4c99d8f43e57307aa2b4d8c90fd79c19ccea7b5c8f7ab5c58bf84cef2312555ae0c4adab0bb1075546147d0b146582232d7cc06dad3
|
7
|
+
data.tar.gz: 37904aca59ceb8321f4cf1ffdb75ce4f445222737cf4aab12536064848b8cd23b3824a9130938ac8eeb04d29710870f35d4fe7ce5bdc7852b130b03c4c7cfc16
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -52,6 +52,22 @@ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
|
52
52
|
client.events.change_object_status("<EVENT KEY>", ["A-1", "A-2"], "my-custom-status")
|
53
53
|
```
|
54
54
|
|
55
|
+
### Retrieving object category and status (and other information)
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
require('seatsio')
|
59
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
60
|
+
object_infos = client.events.retrieve_object_infos key: event.key, labels: ['A-1', 'A-2']
|
61
|
+
|
62
|
+
puts object_infos['A-1'].category_key
|
63
|
+
puts object_infos['A-1'].category_label
|
64
|
+
puts object_infos['A-1'].status
|
65
|
+
|
66
|
+
puts object_infos['A-2'].category_key
|
67
|
+
puts object_infos['A-2'].category_label
|
68
|
+
puts object_infos['A-2'].status
|
69
|
+
```
|
70
|
+
|
55
71
|
### Listing all charts
|
56
72
|
|
57
73
|
```ruby
|
@@ -73,7 +89,8 @@ Each page is Enumerable, and it has `next_page_starts_after` and `previous_page_
|
|
73
89
|
|
74
90
|
```ruby
|
75
91
|
# ... user initially opens the screen ...
|
76
|
-
|
92
|
+
require('seatsio')
|
93
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
77
94
|
firstPage = client.charts.list.first_page()
|
78
95
|
firstPage.each do |chart|
|
79
96
|
puts chart.key
|
@@ -82,7 +99,8 @@ end
|
|
82
99
|
|
83
100
|
```ruby
|
84
101
|
# ... user clicks on 'next page' button ...
|
85
|
-
|
102
|
+
require('seatsio')
|
103
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
86
104
|
nextPage = client.charts.list.page_after(firstPage.next_page_starts_after)
|
87
105
|
nextPage.each do |chart|
|
88
106
|
puts chart.key
|
@@ -91,7 +109,8 @@ end
|
|
91
109
|
|
92
110
|
```ruby
|
93
111
|
# ... user clicks on 'previous page' button ...
|
94
|
-
|
112
|
+
require('seatsio')
|
113
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
95
114
|
previousPage = client.charts.list.page_before(nextPage.previous_page_ends_before)
|
96
115
|
previousPage.each do |chart|
|
97
116
|
puts chart.key
|
@@ -102,10 +121,21 @@ end
|
|
102
121
|
|
103
122
|
```ruby
|
104
123
|
require('seatsio')
|
105
|
-
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key")
|
124
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key") # can be found on https://app.seats.io/company-settings
|
106
125
|
client.workspaces.create name: "a workspace"
|
107
126
|
```
|
108
127
|
|
128
|
+
### Creating a chart and an event with the company admin key
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
require('seatsio')
|
132
|
+
# company admin key can be found on https://app.seats.io/company-settings
|
133
|
+
# workspace public key can be found on https://app.seats.io/workspace-settings
|
134
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-company-admin-key", "my-workspace-public-key")
|
135
|
+
chart = client.charts.create
|
136
|
+
event = client.events.create chart_key: chart.key
|
137
|
+
```
|
138
|
+
|
109
139
|
# Error handling
|
110
140
|
|
111
141
|
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 +153,8 @@ This library supports [exponential backoff](https://en.wikipedia.org/wiki/Expone
|
|
123
153
|
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
154
|
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
155
|
|
156
|
+
We throw a `RateLimitExceededException` (which is a subclass of `SeatsioException`) when exponential backoff eventually fails.
|
157
|
+
|
126
158
|
To change the maximum number of retries, create the client as follows:
|
127
159
|
|
128
160
|
```ruby
|
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: 33.
|
4
|
+
version: 33.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-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|