seatsio 42.2.0 → 43.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +44 -0
- data/Gemfile.lock +1 -1
- data/README.md +17 -0
- data/lib/seatsio/charts.rb +5 -0
- data/lib/seatsio/domain.rb +13 -7
- data/lib/seatsio/usage_reports.rb +6 -2
- data/lib/seatsio/version.rb +1 -1
- data/release.mjs +93 -0
- metadata +4 -4
- data/.github/workflows/publish.yml +0 -21
- data/releasing.md +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6086a3aa4164457c4c80275d4896ddd4d08d65a83f60d67ab5e1fb110f7cb31a
|
4
|
+
data.tar.gz: b54815b5c766d5d1a0156e799e18228b9bebe1917d5bb72ed0113fe4196a10a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce99bbf39ea1dd5a8d8dddb74ecb66520f2e58c97dcb7d0ee8e11739fe49c30a61887dd43709cb15aad1fb6e468dd7f9270a464bf59d4543e9876d30091ea20b
|
7
|
+
data.tar.gz: 18f911f7512ebeb04906a6f410452d82ef85ec84ee3428217074f5efff801f2bbe1aa7f235cc3c306358c565aca96232a16c6adc5ea90ca313b7ea2bc99b19b0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Very important!
|
2
|
+
# Make sure that the github token has read AND WRITE access on github.
|
3
|
+
# 1. hit https://github.com/seatsio/[REPO]/settings/actions
|
4
|
+
# 2. under "Workflow permissions", make sure "Read and write permissions" is checked instead of the (default?) read only.
|
5
|
+
#
|
6
|
+
|
7
|
+
name: Release
|
8
|
+
run-name: Release ${{ github.repository }}
|
9
|
+
on:
|
10
|
+
workflow_dispatch:
|
11
|
+
inputs:
|
12
|
+
versionToBump:
|
13
|
+
description: 'The version to bump. Major for incompatible API changes, minor for adding BC features'
|
14
|
+
required: true
|
15
|
+
type: choice
|
16
|
+
options:
|
17
|
+
- minor
|
18
|
+
- major
|
19
|
+
jobs:
|
20
|
+
release:
|
21
|
+
runs-on: ubuntu-latest
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v3
|
24
|
+
- uses: fregante/setup-git-user@v2
|
25
|
+
- id: install-zx
|
26
|
+
run: npm i -g zx
|
27
|
+
- id: install-semver-tool
|
28
|
+
run: |
|
29
|
+
wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
|
30
|
+
chmod +x /usr/local/bin/semver
|
31
|
+
- run: zx ./release.mjs -v $VERSION_TO_BUMP
|
32
|
+
env:
|
33
|
+
VERSION_TO_BUMP: ${{ inputs.versionToBump }}
|
34
|
+
GH_TOKEN: ${{ github.token }}
|
35
|
+
- run: |
|
36
|
+
mkdir -p $HOME/.gem
|
37
|
+
touch $HOME/.gem/credentials
|
38
|
+
chmod 0600 $HOME/.gem/credentials
|
39
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
40
|
+
gem build *.gemspec
|
41
|
+
gem push *.gem
|
42
|
+
env:
|
43
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
44
|
+
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -93,6 +93,23 @@ puts object_infos['A-2'].category_label
|
|
93
93
|
puts object_infos['A-2'].status
|
94
94
|
```
|
95
95
|
|
96
|
+
### Listing a chart's categories
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
require('seatsio')
|
100
|
+
client = Seatsio::Client.new(Seatsio::Region.EU(), "my-workspace-secret-key")
|
101
|
+
categories = [
|
102
|
+
{ 'key' => 1, 'label' => 'Category 1', 'color' => '#aaaaaa', 'accessible' => false },
|
103
|
+
{ 'key' => 'cat2', 'label' => 'Category 2', 'color' => '#bbbbbb', 'accessible' => true }
|
104
|
+
]
|
105
|
+
chart = client.charts.create categories: categories
|
106
|
+
|
107
|
+
category_list = client.charts.list_categories(chart.key)
|
108
|
+
category_list.each_with_index do |category, index|
|
109
|
+
puts category.key
|
110
|
+
end
|
111
|
+
```
|
112
|
+
|
96
113
|
### Listing all charts
|
97
114
|
|
98
115
|
```ruby
|
data/lib/seatsio/charts.rb
CHANGED
@@ -46,6 +46,11 @@ module Seatsio
|
|
46
46
|
@http_client.delete("charts/#{key}/categories/#{category_key}")
|
47
47
|
end
|
48
48
|
|
49
|
+
def list_categories(chart_key)
|
50
|
+
response = @http_client.get("charts/#{chart_key}/categories")
|
51
|
+
Category.create_list(response['categories'])
|
52
|
+
end
|
53
|
+
|
49
54
|
def add_tag(key, tag)
|
50
55
|
@http_client.post("charts/#{key}/tags/#{CGI::escape(tag)}")
|
51
56
|
end
|
data/lib/seatsio/domain.rb
CHANGED
@@ -425,7 +425,7 @@ module Seatsio
|
|
425
425
|
end
|
426
426
|
end
|
427
427
|
|
428
|
-
class
|
428
|
+
class UsageSummaryForAllMonths
|
429
429
|
attr_reader :items
|
430
430
|
|
431
431
|
def initialize(data)
|
@@ -441,9 +441,6 @@ module Seatsio
|
|
441
441
|
def initialize(data)
|
442
442
|
@month = Month.from_json(data['month'])
|
443
443
|
@num_used_objects = data['numUsedObjects']
|
444
|
-
@num_first_bookings = data['numFirstBookings']
|
445
|
-
@num_first_bookings_by_status = data['numFirstBookingsByStatus']
|
446
|
-
@num_first_bookings_or_selections = data['numFirstBookingsOrSelections']
|
447
444
|
end
|
448
445
|
end
|
449
446
|
|
@@ -484,8 +481,6 @@ module Seatsio
|
|
484
481
|
def initialize(data)
|
485
482
|
@event = UsageEvent.new(data['event'])
|
486
483
|
@num_used_objects = data['numUsedObjects']
|
487
|
-
@num_first_bookings = data['numFirstBookings']
|
488
|
-
@num_object_selections = data['numObjectSelections']
|
489
484
|
end
|
490
485
|
end
|
491
486
|
|
@@ -499,7 +494,7 @@ module Seatsio
|
|
499
494
|
end
|
500
495
|
end
|
501
496
|
|
502
|
-
class
|
497
|
+
class UsageForObjectV1
|
503
498
|
|
504
499
|
attr_reader :object, :num_first_bookings, :first_booking_date, :num_first_bookings, :num_first_bookings_or_selections
|
505
500
|
|
@@ -512,6 +507,17 @@ module Seatsio
|
|
512
507
|
end
|
513
508
|
end
|
514
509
|
|
510
|
+
class UsageForObjectV2
|
511
|
+
|
512
|
+
attr_reader :object, :num_used_objects, :usage_by_reason
|
513
|
+
|
514
|
+
def initialize(data)
|
515
|
+
@object = data['object']
|
516
|
+
@num_used_objects = data['numUsedObjects']
|
517
|
+
@usage_by_reason = data['usageByReason']
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
515
521
|
class Month
|
516
522
|
|
517
523
|
attr_reader :year, :month
|
@@ -13,7 +13,7 @@ module Seatsio
|
|
13
13
|
def summary_for_all_months
|
14
14
|
url = "reports/usage"
|
15
15
|
body = @http_client.get(url)
|
16
|
-
|
16
|
+
UsageSummaryForAllMonths.new(body)
|
17
17
|
end
|
18
18
|
|
19
19
|
def details_for_month(month)
|
@@ -25,7 +25,11 @@ module Seatsio
|
|
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.
|
28
|
+
if body.empty? or !body[0].key?('usageByReason')
|
29
|
+
body.map { |item| UsageForObjectV1.new(item) }
|
30
|
+
else
|
31
|
+
body.map { |item| UsageForObjectV2.new(item) }
|
32
|
+
end
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end
|
data/lib/seatsio/version.rb
CHANGED
data/release.mjs
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
#!/usr/bin/env zx
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Script to release the seats.io java lib.
|
5
|
+
* - changes the version number in README.md
|
6
|
+
* - changes the version number in build.gradle
|
7
|
+
* - creates the release in Gihub (using gh cli)
|
8
|
+
*
|
9
|
+
*
|
10
|
+
* Prerequisites:
|
11
|
+
* - zx installed (https://github.com/google/zx)
|
12
|
+
* - gh cli installed (https://cli.github.com/)
|
13
|
+
* - semver cli installed (https://github.com/fsaintjacques/semver-tool)
|
14
|
+
*
|
15
|
+
* Usage:
|
16
|
+
* zx ./release.mjs -v major/minor -n "release notes"
|
17
|
+
* */
|
18
|
+
|
19
|
+
// don't output the commands themselves
|
20
|
+
$.verbose = false
|
21
|
+
|
22
|
+
const versionToBump = getVersionToBump()
|
23
|
+
const latestVersion = await fetchLatestReleasedVersionNumber()
|
24
|
+
const nextVersion = await determineNextVersionNumber(latestVersion)
|
25
|
+
|
26
|
+
await pullLastVersion()
|
27
|
+
.then(bumpVersionInFiles)
|
28
|
+
.then(commitAndPush)
|
29
|
+
.then(release)
|
30
|
+
|
31
|
+
function getVersionToBump() {
|
32
|
+
if (!argv.v || !(argv.v === 'minor' || argv.v === 'major')) {
|
33
|
+
throw new Error ("Please specify -v major/minor")
|
34
|
+
}
|
35
|
+
return argv.v
|
36
|
+
}
|
37
|
+
|
38
|
+
function removeLeadingV(tagName) {
|
39
|
+
if (tagName.startsWith('v')) {
|
40
|
+
return tagName.substring(1)
|
41
|
+
}
|
42
|
+
return tagName
|
43
|
+
}
|
44
|
+
|
45
|
+
async function fetchLatestReleasedVersionNumber() {
|
46
|
+
let result = await $`gh release view --json tagName`
|
47
|
+
let tagName = JSON.parse(result).tagName
|
48
|
+
return removeLeadingV(tagName)
|
49
|
+
}
|
50
|
+
|
51
|
+
async function determineNextVersionNumber(previous) {
|
52
|
+
return (await $`semver bump ${versionToBump} ${previous}`).stdout.trim()
|
53
|
+
}
|
54
|
+
|
55
|
+
async function bumpVersionInFiles() {
|
56
|
+
await replaceInFile("./lib/seatsio/version.rb", `VERSION = "${latestVersion}"`, `VERSION = "${nextVersion}"`)
|
57
|
+
await replaceInFile("Gemfile.lock", `seatsio (${latestVersion})`, `seatsio (${nextVersion})`)
|
58
|
+
}
|
59
|
+
|
60
|
+
async function replaceInFile(filename, latestVersion, nextVersion) {
|
61
|
+
return await fs.readFile(filename, 'utf8')
|
62
|
+
.then(text => {
|
63
|
+
if (text.indexOf(latestVersion) < 0) {
|
64
|
+
throw new Error('Not the correct version. Could not find ' + latestVersion + ' in ' + filename)
|
65
|
+
}
|
66
|
+
return text
|
67
|
+
})
|
68
|
+
.then(text => text.replace(latestVersion, nextVersion))
|
69
|
+
.then(text => fs.writeFileSync(filename, text))
|
70
|
+
.then(() => gitAdd(filename))
|
71
|
+
}
|
72
|
+
|
73
|
+
async function pullLastVersion() {
|
74
|
+
await $`git checkout master`
|
75
|
+
await $`git pull origin master`
|
76
|
+
}
|
77
|
+
|
78
|
+
async function gitAdd(filename) {
|
79
|
+
return await $`git add ${filename}`
|
80
|
+
}
|
81
|
+
|
82
|
+
async function commitAndPush() {
|
83
|
+
await $`git commit -m "version bump"`
|
84
|
+
await $`git push origin master`
|
85
|
+
}
|
86
|
+
|
87
|
+
async function release() {
|
88
|
+
const newTag = 'v' + nextVersion
|
89
|
+
return await $`gh release create ${newTag} --generate-notes`.catch(error => {
|
90
|
+
console.error('something went wrong while creating the release. Please revert the version change!')
|
91
|
+
throw error
|
92
|
+
})
|
93
|
+
}
|
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: 43.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: 2023-
|
11
|
+
date: 2023-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,7 +116,7 @@ files:
|
|
116
116
|
- ".editorconfig"
|
117
117
|
- ".github/dependabot.yml"
|
118
118
|
- ".github/workflows/build.yml"
|
119
|
-
- ".github/workflows/
|
119
|
+
- ".github/workflows/release.yml"
|
120
120
|
- ".gitignore"
|
121
121
|
- ".ruby-version"
|
122
122
|
- Gemfile
|
@@ -145,7 +145,7 @@ files:
|
|
145
145
|
- lib/seatsio/util.rb
|
146
146
|
- lib/seatsio/version.rb
|
147
147
|
- lib/seatsio/workspaces.rb
|
148
|
-
-
|
148
|
+
- release.mjs
|
149
149
|
- seatsio.gemspec
|
150
150
|
homepage: http://seats.io
|
151
151
|
licenses: []
|
@@ -1,21 +0,0 @@
|
|
1
|
-
name: 'Publish'
|
2
|
-
|
3
|
-
on:
|
4
|
-
release:
|
5
|
-
types: [created]
|
6
|
-
|
7
|
-
jobs:
|
8
|
-
build:
|
9
|
-
runs-on: ubuntu-latest
|
10
|
-
|
11
|
-
steps:
|
12
|
-
- uses: actions/checkout@v2
|
13
|
-
- run: |
|
14
|
-
mkdir -p $HOME/.gem
|
15
|
-
touch $HOME/.gem/credentials
|
16
|
-
chmod 0600 $HOME/.gem/credentials
|
17
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
18
|
-
gem build *.gemspec
|
19
|
-
gem push *.gem
|
20
|
-
env:
|
21
|
-
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|