seatsio 35.0.0 → 35.3.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: 874fcd1fd4238073124c6f5e5eb058dd38fc5a724d248b14eded7eef774f5c7f
4
- data.tar.gz: 264386019f1f5a6260d54c6b0c94a42eb7ca4d5620717f9de2369e13e6fe0195
3
+ metadata.gz: '04119e53fff832a017f6e2b8976af5006b59ec234d45d926ad9dc786d70dfcc4'
4
+ data.tar.gz: 06d4f2e2ea5307fe7fdcdde2f5f2b757ac8514bc1f5be6fb3fb689a27e6f5060
5
5
  SHA512:
6
- metadata.gz: 63e8eefcf42622491e89bddc697773d6056629f89aa7d70ef6a6deeb08e6d3961fcaedc74d708fffed9ec5fc001bef1bb94e00a59e666a768878dc39536c9e64
7
- data.tar.gz: 6feb7bbe4410abfbe5742ec81c4164093a9187ec1b13ae6be92650e89f4da5d17f485d150f1c8e969a8fea42c3266a993854434eeafb96d4a3553817411f096e
6
+ metadata.gz: c7e4439a3bcd67965ec3bb38e16a855085d13fec62f5fa778ecf60cf27a16983c1029455270e6b35c2b29680306d04e43b224192a287bcba39a6c6ab9fc07478
7
+ data.tar.gz: 361bd672805ef4cadd8789dd61ecc187dac2c7fe86eae8cf66229fefd09bb85d45fdd7539921ccff37d00a8e8ff68ee5d366e700caaeab514ec5b19c8da84b82
@@ -12,7 +12,7 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
  strategy:
14
14
  matrix:
15
- ruby-version: ['2.4']
15
+ ruby-version: ['2.4', '3.0']
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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seatsio (35.0.0)
4
+ seatsio (35.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -19,7 +19,7 @@ GEM
19
19
  mime-types (3.3.1)
20
20
  mime-types-data (~> 3.2015)
21
21
  mime-types-data (3.2021.0225)
22
- minitest (5.14.4)
22
+ minitest (5.15.0)
23
23
  netrc (0.11.0)
24
24
  public_suffix (4.0.6)
25
25
  rake (13.0.6)
data/README.md CHANGED
@@ -13,13 +13,34 @@ seatsio-ruby follows semver since v23.3.0.
13
13
 
14
14
  You can find a full API reference at https://www.rubydoc.info/gems/seatsio/
15
15
 
16
- ## Examples
16
+ ## Usage
17
+
18
+ ### General instructions
19
+
20
+ To use this library, you'll need to create a `Seatsio::Client`:
21
+
22
+ ```ruby
23
+ require('seatsio')
24
+ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
25
+ ...
26
+ ```
27
+
28
+ You can find your _workspace secret key_ in the [settings section of the workspace](https://app.seats.io/workspace-settings).
29
+
30
+ The region should correspond to the region of your account:
31
+
32
+ - `Seatsio::Region.EU()`: Europe
33
+ - `Seatsio::Region.NA()`: North-America
34
+ - `Seatsio::Region.SA()`: South-America
35
+ - `Seatsio::Region.OC()`: Oceania
36
+
37
+ If you're unsure about your region, have a look at your [company settings page](https://app.seats.io/company-settings).
17
38
 
18
39
  ### Creating a chart and an event
19
40
 
20
41
  ```ruby
21
42
  require('seatsio')
22
- client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key") # can be found on https://app.seats.io/workspace-settings
43
+ client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
23
44
  chart = client.charts.create
24
45
  event = client.events.create chart_key: chart.key
25
46
  ```
@@ -11,28 +11,54 @@ module Seatsio
11
11
  end
12
12
 
13
13
  def by_label(chart_key, book_whole_tables = nil)
14
- get_chart_report('byLabel', chart_key, book_whole_tables)
14
+ fetch_chart_report('byLabel', chart_key, book_whole_tables)
15
15
  end
16
16
 
17
17
  def by_object_type(chart_key, book_whole_tables = nil)
18
- get_chart_report('byObjectType', chart_key, book_whole_tables)
18
+ fetch_chart_report('byObjectType', chart_key, book_whole_tables)
19
+ end
20
+
21
+ def summary_by_object_type(chart_key, book_whole_tables = nil)
22
+ fetch_summary_report('byObjectType', chart_key, book_whole_tables)
19
23
  end
20
24
 
21
25
  def by_category_key(chart_key, book_whole_tables = nil)
22
- get_chart_report('byCategoryKey', chart_key, book_whole_tables)
26
+ fetch_chart_report('byCategoryKey', chart_key, book_whole_tables)
27
+ end
28
+
29
+ def summary_by_category_key(chart_key, book_whole_tables = nil)
30
+ fetch_summary_report('byCategoryKey', chart_key, book_whole_tables)
23
31
  end
24
32
 
25
33
  def by_category_label(chart_key, book_whole_tables = nil)
26
- get_chart_report('byCategoryLabel', chart_key, book_whole_tables)
34
+ fetch_chart_report('byCategoryLabel', chart_key, book_whole_tables)
35
+ end
36
+
37
+ def summary_by_category_label(chart_key, book_whole_tables = nil)
38
+ fetch_summary_report('byCategoryLabel', chart_key, book_whole_tables)
39
+ end
40
+
41
+ def by_section(chart_key, book_whole_tables = nil)
42
+ fetch_chart_report('bySection', chart_key, book_whole_tables)
43
+ end
44
+
45
+ def summary_by_section(event_key, book_whole_tables = nil)
46
+ fetch_summary_report('bySection', event_key, book_whole_tables)
27
47
  end
28
48
 
29
49
  private
30
50
 
31
- def get_chart_report(report_type, chart_key, book_whole_tables)
51
+ def fetch_chart_report(report_type, chart_key, book_whole_tables)
32
52
  params = book_whole_tables.nil? ? {} : { bookWholeTables: book_whole_tables }
33
53
  url = "reports/charts/#{chart_key}/#{report_type}"
34
54
  body = @http_client.get(url, params)
35
55
  ChartReport.new(body)
36
56
  end
57
+
58
+ def fetch_summary_report(report_type, event_key, book_whole_tables)
59
+ params = book_whole_tables.nil? ? {} : { bookWholeTables: book_whole_tables }
60
+ url = "reports/charts/#{event_key}/#{report_type}/summary"
61
+ @http_client.get(url, params)
62
+ end
37
63
  end
38
64
  end
@@ -83,6 +83,18 @@ module Seatsio
83
83
  fetch_deep_summary_report('byAvailability', event_key)
84
84
  end
85
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)
96
+ end
97
+
86
98
  def by_channel(event_key, channelKey = nil)
87
99
  fetch_report('byChannel', event_key, channelKey)
88
100
  end
@@ -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,8 +62,8 @@ 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
  }
@@ -19,7 +19,7 @@ module Seatsio
19
19
  @first_page = false
20
20
  end
21
21
 
22
- def each(start = 0)
22
+ def each(start = 0, &block)
23
23
  return to_enum(:each, start) unless block_given?
24
24
 
25
25
  Array(@collection[start..-1]).each do |element|
@@ -30,7 +30,7 @@ module Seatsio
30
30
 
31
31
  start = [@collection.size, start].max
32
32
  fetch_next_page
33
- each(start, &Proc.new)
33
+ each(start, &block)
34
34
  end
35
35
 
36
36
  def set_query_param(key, value)
@@ -1,3 +1,3 @@
1
1
  module Seatsio
2
- VERSION = "35.0.0"
2
+ VERSION = "35.3.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: 35.0.0
4
+ version: 35.3.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-12-14 00:00:00.000000000 Z
11
+ date: 2022-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler