seatsio 18 → 19
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/lib/seatsio.rb +9 -9
- data/lib/seatsio/accounts.rb +2 -2
- data/lib/seatsio/chart_reports.rb +2 -2
- data/lib/seatsio/charts.rb +3 -3
- data/lib/seatsio/domain.rb +21 -2
- data/lib/seatsio/event_reports.rb +2 -2
- data/lib/seatsio/events.rb +6 -6
- data/lib/seatsio/hold_tokens.rb +2 -2
- data/lib/seatsio/httpClient.rb +5 -1
- data/lib/seatsio/subaccounts.rb +2 -2
- data/lib/seatsio/usage_reports.rb +4 -4
- 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: 7c448a03cd150ad6717cc4e84292ddce1a1b414fcf8a7fc47f85adbfc40da4f6
|
4
|
+
data.tar.gz: 77ca98873d3e6ac9ba23b7b13315837daee4fe7d37ebc1f1e8892154c2c0db17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7e0df3a115dfe0d2112db3873709941a84e1d8b5adbc5538fc7b07148c0757f35d8fb520646c92d87fa54d888e82012f66aec404a1b8a61a0648ae466bcd530
|
7
|
+
data.tar.gz: 736f061e98d078704713d3e6136e411c4e09448358ea248e771264bfcf66b521ad881b38c3bb42732990e58b8713bb2e321d91730043176e70e245340165164d
|
data/lib/seatsio.rb
CHANGED
@@ -14,15 +14,15 @@ module Seatsio
|
|
14
14
|
attr_reader :charts, :accounts, :subaccounts, :events,
|
15
15
|
:hold_tokens, :chart_reports, :event_reports, :usage_reports
|
16
16
|
|
17
|
-
def initialize(secret_key, base_url = 'https://api.seatsio.net')
|
18
|
-
@charts = ChartsClient.new(secret_key, base_url)
|
19
|
-
@accounts = AccountsClient.new(secret_key, base_url)
|
20
|
-
@subaccounts = SubaccountsClient.new(secret_key, base_url)
|
21
|
-
@events = EventsClient.new(secret_key, base_url)
|
22
|
-
@hold_tokens = HoldTokensClient.new(secret_key, base_url)
|
23
|
-
@chart_reports = ChartReportsClient.new(secret_key, base_url)
|
24
|
-
@event_reports = EventReportsClient.new(secret_key, base_url)
|
25
|
-
@usage_reports = UsageReportsClient.new(secret_key, base_url)
|
17
|
+
def initialize(secret_key, workspace_key = nil, base_url = 'https://api.seatsio.net')
|
18
|
+
@charts = ChartsClient.new(secret_key, workspace_key, base_url)
|
19
|
+
@accounts = AccountsClient.new(secret_key, workspace_key, base_url)
|
20
|
+
@subaccounts = SubaccountsClient.new(secret_key, workspace_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)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
data/lib/seatsio/accounts.rb
CHANGED
@@ -8,8 +8,8 @@ require "seatsio/domain"
|
|
8
8
|
|
9
9
|
module Seatsio
|
10
10
|
class AccountsClient
|
11
|
-
def initialize(secret_key, base_url)
|
12
|
-
@http_client = ::Seatsio::HttpClient.new(secret_key, base_url)
|
11
|
+
def initialize(secret_key, workspace_key, base_url)
|
12
|
+
@http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
|
13
13
|
end
|
14
14
|
|
15
15
|
def retrieve_my_account
|
@@ -6,8 +6,8 @@ require 'cgi'
|
|
6
6
|
|
7
7
|
module Seatsio
|
8
8
|
class ChartReportsClient
|
9
|
-
def initialize(secret_key, base_url)
|
10
|
-
@http_client = ::Seatsio::HttpClient.new(secret_key, base_url)
|
9
|
+
def initialize(secret_key, workspace_key, base_url)
|
10
|
+
@http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
|
11
11
|
end
|
12
12
|
|
13
13
|
def by_label(chart_key)
|
data/lib/seatsio/charts.rb
CHANGED
@@ -11,8 +11,8 @@ module Seatsio
|
|
11
11
|
class ChartsClient
|
12
12
|
attr_reader :archive
|
13
13
|
|
14
|
-
def initialize(secret_key, base_url)
|
15
|
-
@http_client = Seatsio::HttpClient.new(secret_key, base_url)
|
14
|
+
def initialize(secret_key, workspace_key, base_url)
|
15
|
+
@http_client = Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
|
16
16
|
@archive = Pagination::Cursor.new(Domain::Chart, 'charts/archive', @http_client)
|
17
17
|
end
|
18
18
|
|
@@ -95,7 +95,7 @@ module Seatsio
|
|
95
95
|
|
96
96
|
cursor.set_query_param('expand', 'events') if expand_events
|
97
97
|
cursor.set_query_param('validation', with_validation) if with_validation
|
98
|
-
|
98
|
+
|
99
99
|
cursor
|
100
100
|
end
|
101
101
|
|
data/lib/seatsio/domain.rb
CHANGED
@@ -157,6 +157,21 @@ module Seatsio::Domain
|
|
157
157
|
end
|
158
158
|
|
159
159
|
class Subaccount < Account
|
160
|
+
attr_reader :workspace
|
161
|
+
|
162
|
+
def initialize(data)
|
163
|
+
super
|
164
|
+
@workspace = Workspace.new(data['workspace']) if data['workspace'] != nil
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
class Workspace
|
169
|
+
attr_reader :id, :key
|
170
|
+
|
171
|
+
def initialize(data)
|
172
|
+
@id = data['id']
|
173
|
+
@key = data['key']
|
174
|
+
end
|
160
175
|
end
|
161
176
|
|
162
177
|
class ObjectStatus
|
@@ -189,12 +204,13 @@ module Seatsio::Domain
|
|
189
204
|
|
190
205
|
class HoldToken
|
191
206
|
|
192
|
-
attr_reader :hold_token, :expires_at, :expires_in_seconds
|
207
|
+
attr_reader :hold_token, :expires_at, :expires_in_seconds, :workspace_key
|
193
208
|
|
194
209
|
def initialize(data)
|
195
210
|
@hold_token = data['holdToken']
|
196
211
|
@expires_at = Time.parse(data['expiresAt'])
|
197
212
|
@expires_in_seconds = data['expiresInSeconds']
|
213
|
+
@workspace_key = data['workspaceKey']
|
198
214
|
end
|
199
215
|
end
|
200
216
|
|
@@ -414,7 +430,7 @@ module Seatsio::Domain
|
|
414
430
|
end
|
415
431
|
|
416
432
|
class StatusChange
|
417
|
-
attr_reader :extra_data, :object_label, :date, :id, :status, :event_id, :origin
|
433
|
+
attr_reader :extra_data, :object_label, :date, :id, :status, :event_id, :origin, :order_id, :quantity, :hold_token
|
418
434
|
|
419
435
|
def initialize(data)
|
420
436
|
@id = data['id']
|
@@ -424,6 +440,9 @@ module Seatsio::Domain
|
|
424
440
|
@event_id = data['eventId']
|
425
441
|
@extra_data = data['extraData']
|
426
442
|
@origin = StatusChangeOrigin.new(data['origin'])
|
443
|
+
@order_id = data['orderId']
|
444
|
+
@quantity = data['quantity']
|
445
|
+
@hold_token = data['holdToken']
|
427
446
|
end
|
428
447
|
end
|
429
448
|
|
@@ -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, base_url)
|
11
|
-
@http_client = ::Seatsio::HttpClient.new(secret_key, base_url)
|
10
|
+
def initialize(secret_key, workspace_key, base_url)
|
11
|
+
@http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
|
12
12
|
end
|
13
13
|
|
14
14
|
def summary_by_status(event_key)
|
data/lib/seatsio/events.rb
CHANGED
@@ -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, base_url)
|
15
|
-
@http_client = ::Seatsio::HttpClient.new(secret_key, base_url)
|
14
|
+
def initialize(secret_key, workspace_key, base_url)
|
15
|
+
@http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
|
16
16
|
end
|
17
17
|
|
18
18
|
def create(chart_key: nil, event_key: nil, book_whole_tables: nil, table_booking_modes: nil)
|
@@ -75,12 +75,12 @@ module Seatsio
|
|
75
75
|
Domain::BestAvailableObjects.new(response)
|
76
76
|
end
|
77
77
|
|
78
|
-
def book_best_available(key, number, categories: nil, hold_token: nil, order_id: nil, keep_extra_data: nil)
|
79
|
-
change_best_available_object_status(key, number, Domain::ObjectStatus::BOOKED, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data)
|
78
|
+
def book_best_available(key, number, categories: nil, hold_token: nil, order_id: nil, keep_extra_data: nil, extra_data: nil)
|
79
|
+
change_best_available_object_status(key, number, Domain::ObjectStatus::BOOKED, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, extra_data: extra_data)
|
80
80
|
end
|
81
81
|
|
82
|
-
def hold_best_available(key, number, hold_token, categories: nil, order_id: nil, keep_extra_data: nil)
|
83
|
-
change_best_available_object_status(key, number, Domain::ObjectStatus::HELD, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data)
|
82
|
+
def hold_best_available(key, number, hold_token, categories: nil, order_id: nil, keep_extra_data: nil, extra_data: nil)
|
83
|
+
change_best_available_object_status(key, number, Domain::ObjectStatus::HELD, categories: categories, hold_token: hold_token, order_id: order_id, keep_extra_data: keep_extra_data, extra_data: extra_data)
|
84
84
|
end
|
85
85
|
|
86
86
|
def release(event_key_or_keys, object_or_objects, hold_token = nil, order_id = nil, keep_extra_data = nil)
|
data/lib/seatsio/hold_tokens.rb
CHANGED
@@ -11,8 +11,8 @@ module Seatsio
|
|
11
11
|
|
12
12
|
class HoldTokensClient
|
13
13
|
# @return [Seatsio::HoldTokensClient]
|
14
|
-
def initialize(secret_key, base_url)
|
15
|
-
@http_client = ::Seatsio::HttpClient.new(secret_key, base_url)
|
14
|
+
def initialize(secret_key, workspace_key, base_url)
|
15
|
+
@http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
|
16
16
|
end
|
17
17
|
|
18
18
|
def create(expires_in_minutes: nil)
|
data/lib/seatsio/httpClient.rb
CHANGED
@@ -6,14 +6,18 @@ require "uri"
|
|
6
6
|
|
7
7
|
module Seatsio
|
8
8
|
class HttpClient
|
9
|
-
def initialize(secret_key, base_url)
|
9
|
+
def initialize(secret_key, workspace_key, base_url)
|
10
10
|
@secret_key = Base64.encode64(secret_key)
|
11
|
+
@workspace_key = workspace_key
|
11
12
|
@base_url = base_url
|
12
13
|
end
|
13
14
|
|
14
15
|
def execute(*args)
|
15
16
|
begin
|
16
17
|
headers = {:Authorization => "Basic #{@secret_key}"}
|
18
|
+
unless @workspace_key.nil?
|
19
|
+
headers[:'X-Workspace-Key'] = @workspace_key
|
20
|
+
end
|
17
21
|
if args[2].include? :params
|
18
22
|
headers[:params] = args[2][:params]
|
19
23
|
end
|
data/lib/seatsio/subaccounts.rb
CHANGED
@@ -8,8 +8,8 @@ require "seatsio/domain"
|
|
8
8
|
|
9
9
|
module Seatsio
|
10
10
|
class SubaccountsClient
|
11
|
-
def initialize(secret_key, base_url)
|
12
|
-
@http_client = ::Seatsio::HttpClient.new(secret_key, base_url)
|
11
|
+
def initialize(secret_key, workspace_key, base_url)
|
12
|
+
@http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
|
13
13
|
end
|
14
14
|
|
15
15
|
def create(name: nil, email: nil)
|
@@ -6,8 +6,8 @@ require 'cgi'
|
|
6
6
|
|
7
7
|
module Seatsio
|
8
8
|
class UsageReportsClient
|
9
|
-
def initialize(secret_key, base_url)
|
10
|
-
@http_client = ::Seatsio::HttpClient.new(secret_key, base_url)
|
9
|
+
def initialize(secret_key, workspace_key, base_url)
|
10
|
+
@http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
|
11
11
|
end
|
12
12
|
|
13
13
|
def summary_for_all_months
|
@@ -19,13 +19,13 @@ module Seatsio
|
|
19
19
|
def details_for_month(month)
|
20
20
|
url = "reports/usage/month/" + month.serialize
|
21
21
|
body = @http_client.get(url)
|
22
|
-
body.map {|item| Domain::UsageDetails.new(item)}
|
22
|
+
body.map { |item| Domain::UsageDetails.new(item) }
|
23
23
|
end
|
24
24
|
|
25
25
|
def details_for_event_in_month(eventId, month)
|
26
26
|
url = "reports/usage/month/" + month.serialize + "/event/" + eventId.to_s
|
27
27
|
body = @http_client.get(url)
|
28
|
-
body.map {|item| Domain::UsageForObject.new(item)}
|
28
|
+
body.map { |item| Domain::UsageForObject.new(item) }
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
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: '19'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seats.io
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|