openactive-dataset_site 0.1.1 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/create-dataset-site-template-pr.yaml +63 -0
- data/.github/workflows/release.yaml +39 -0
- data/.github/workflows/tests.yaml +66 -0
- data/README.md +71 -25
- data/Rakefile +6 -0
- data/examples/basic_csp_example_with_booking.rb +41 -0
- data/examples/basic_example.rb +2 -2
- data/examples/basic_example_with_booking.rb +41 -0
- data/examples/basic_example_with_booking_minimal.rb +35 -0
- data/examples/dataset_csp_example_with_booking.rb +92 -0
- data/examples/dataset_example.rb +7 -2
- data/examples/dataset_example_with_booking.rb +92 -0
- data/examples/dataset_patch.rb +3 -3
- data/examples/specific_feed_override_example.rb +2 -2
- data/examples/specific_feed_override_example2.rb +2 -2
- data/lib/openactive/dataset_site/datasetsite-csp.mustache +205 -0
- data/lib/openactive/dataset_site/datasetsite-csp.static.zip +0 -0
- data/lib/openactive/dataset_site/datasetsite.mustache +1158 -829
- data/lib/openactive/dataset_site/settings.rb +76 -8
- data/lib/openactive/dataset_site/template_renderer.rb +15 -5
- data/lib/openactive/dataset_site/version.rb +1 -1
- metadata +14 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0d3e2a2d08572b7e27b405a0dc905409cac23c891bdf9f5abc3ac699bdba48d3
|
4
|
+
data.tar.gz: 967b8743bb67803f64219d5547424a7b2b93c92edad7b19f4ec934a134f69988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a932ddad0242f2eb224fa6424258e0e42d99d48622b5f7e9d151d05142582cbe6dea0d995789c25c01904935292a341c9af771dbdb9f6c2671adcfc2b93bf4de
|
7
|
+
data.tar.gz: b188e7aeb892c75e5e7ab5ec27831a4cd0f7595cddfe45ac88aade37f323f01e9d2c12c2a0898918086b7c4e46f79d6d3736132236b70a108acc7d5ec326684d
|
@@ -0,0 +1,63 @@
|
|
1
|
+
name: Update Dataset Site Template
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
repository_dispatch:
|
6
|
+
types: [dataset-site-template-update]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
generate:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- name: Checkout
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
with:
|
16
|
+
ref: master
|
17
|
+
|
18
|
+
- name: Setup Node.js 14.x
|
19
|
+
uses: actions/setup-node@v1
|
20
|
+
with:
|
21
|
+
node-version: 14.x
|
22
|
+
|
23
|
+
- name: Update dataset site template to latest version
|
24
|
+
run: npx @openactive/dataset-site-template@latest --raw "./lib/openactive/dataset_site/"
|
25
|
+
working-directory: ./
|
26
|
+
|
27
|
+
- name: git stash if material changes have not been made
|
28
|
+
# When considering whether it's worth making a PR, ignore the following:
|
29
|
+
# - The dataset-site-template minor or patch version number updating within the template in datasetsite.mustache and datasetsite-csp.mustache (affects one line)
|
30
|
+
# - Any updates to datasetsite-csp.static.zip
|
31
|
+
# git stashing if no material changes allows the next step to close the PR if one is already open
|
32
|
+
run: if [ "$(git diff --numstat | grep -vc '^1\s.*datasetsite\.mustache\|1\s.*datasetsite-csp\.mustache\|.*datasetsite-csp\.static\.zip$')" -eq "0" ]; then git stash; else echo "Material changes found"; fi
|
33
|
+
working-directory: ./
|
34
|
+
|
35
|
+
- name: Create Pull Request
|
36
|
+
id: cpr
|
37
|
+
uses: peter-evans/create-pull-request@v3
|
38
|
+
with:
|
39
|
+
path: ./
|
40
|
+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
|
41
|
+
commit-message: Update dataset site template
|
42
|
+
committer: openactive-bot <openactive-bot@users.noreply.github.com>
|
43
|
+
author: openactive-bot <openactive-bot@users.noreply.github.com>
|
44
|
+
signoff: false
|
45
|
+
branch: ci/update-data-models
|
46
|
+
delete-branch: true
|
47
|
+
title: 'Update dataset site template'
|
48
|
+
body: |
|
49
|
+
Update to the latest version of the [Dataset Site Template](https://github.com/openactive/dataset-site-template)
|
50
|
+
|
51
|
+
**Reviewer note:** Major version numbers of this library should match those of the `dataset-site-template` on which this library depends. Any updates to the dataset site template files or assets should always be a major version update in both libraries. Hence this PR, once merged, should be released with a major version bump to match its contents.
|
52
|
+
|
53
|
+
labels: |
|
54
|
+
automated pr
|
55
|
+
team-reviewers: |
|
56
|
+
owners
|
57
|
+
maintainers
|
58
|
+
draft: false
|
59
|
+
|
60
|
+
- name: Check outputs
|
61
|
+
run: |
|
62
|
+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
63
|
+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
release:
|
8
|
+
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
steps:
|
12
|
+
- name: Checkout
|
13
|
+
uses: actions/checkout@v2
|
14
|
+
with:
|
15
|
+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
|
16
|
+
|
17
|
+
- name: Identify
|
18
|
+
run: |
|
19
|
+
git config user.name OpenActive Bot
|
20
|
+
git config user.email hello@openactive.io
|
21
|
+
|
22
|
+
- name: Set up Ruby
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: 2.7
|
26
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
27
|
+
|
28
|
+
- name: Run tests
|
29
|
+
run: bundle exec rspec
|
30
|
+
|
31
|
+
- name: Publish to RubyGems
|
32
|
+
run: |
|
33
|
+
mkdir -p $HOME/.gem
|
34
|
+
touch $HOME/.gem/credentials
|
35
|
+
chmod 0600 $HOME/.gem/credentials
|
36
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
37
|
+
bundle exec rake release
|
38
|
+
env:
|
39
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
@@ -0,0 +1,66 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version: ['2.6', '2.7']
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
24
|
+
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rspec
|
27
|
+
|
28
|
+
- name: Create output directory
|
29
|
+
run: mkdir -p ./output/
|
30
|
+
|
31
|
+
- name: Output rendering basic_example as an artifact
|
32
|
+
run: ruby examples/basic_example.rb > ./output/basic_example.html
|
33
|
+
|
34
|
+
- name: Output rendering basic_example_with_booking as an artifact
|
35
|
+
run: ruby examples/basic_example_with_booking.rb > ./output/basic_example_with_booking.html
|
36
|
+
|
37
|
+
- name: Output rendering basic_example_with_booking_minimal as an artifact
|
38
|
+
run: ruby examples/basic_example_with_booking_minimal.rb > ./output/basic_example_with_booking_minimal.html
|
39
|
+
|
40
|
+
- name: Output rendering basic_csp_example_with_booking as an artifact
|
41
|
+
run: ruby examples/basic_csp_example_with_booking.rb > ./output/basic_csp_example_with_booking.html
|
42
|
+
|
43
|
+
- name: Output rendering dataset_example as an artifact
|
44
|
+
run: ruby examples/dataset_example.rb > ./output/dataset_example.html
|
45
|
+
|
46
|
+
- name: Output rendering dataset_example_with_booking as an artifact
|
47
|
+
run: ruby examples/dataset_example_with_booking.rb > ./output/dataset_example_with_booking.html
|
48
|
+
|
49
|
+
- name: Output rendering dataset_csp_example_with_booking as an artifact
|
50
|
+
run: ruby examples/dataset_csp_example_with_booking.rb > ./output/dataset_csp_example_with_booking.html
|
51
|
+
|
52
|
+
- name: Output rendering dataset_patch as an artifact
|
53
|
+
run: ruby examples/dataset_patch.rb > ./output/dataset_patch.html
|
54
|
+
|
55
|
+
- name: Output rendering specific_feed_override_example as an artifact
|
56
|
+
run: ruby examples/specific_feed_override_example.rb > ./output/specific_feed_override_example.html
|
57
|
+
|
58
|
+
- name: Output rendering specific_feed_override_example2 as an artifact
|
59
|
+
run: ruby examples/specific_feed_override_example2.rb > ./output/specific_feed_override_example2.html
|
60
|
+
|
61
|
+
- name: Upload example renderings
|
62
|
+
uses: actions/upload-artifact@v2
|
63
|
+
if: ${{ success() || failure() }}
|
64
|
+
with:
|
65
|
+
name: example-rendering-ruby-${{ matrix.ruby-version }}
|
66
|
+
path: ./output/
|
data/README.md
CHANGED
@@ -34,13 +34,21 @@ renderer = OpenActive::DatasetSite::TemplateRenderer.new(settings)
|
|
34
34
|
puts renderer.render
|
35
35
|
```
|
36
36
|
|
37
|
+
Or to render a [CSP-compatible template](https://developer.openactive.io/publishing-data/dataset-sites#template-hosting-options), first ensure that you are serving the [CSP compatible static assets](/lib/openactive/dataset_site/datasetsite-csp.static.zip) from this version of the Ruby gem at a URL, and then including the following:
|
38
|
+
```ruby
|
39
|
+
|
40
|
+
# Render compiled CSP-compatible template with data
|
41
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(settings, "./path/to/assets")
|
42
|
+
puts renderer.render
|
43
|
+
```
|
44
|
+
|
37
45
|
Where `settings` could be defined like the following (as an example):
|
38
46
|
```ruby
|
39
47
|
settings = OpenActive::DatasetSite::Settings.new(
|
40
48
|
open_data_feed_base_url: "https://customer.example.com/feed/",
|
41
49
|
dataset_site_url: "https://halo-odi.legendonlineservices.co.uk/openactive/",
|
42
50
|
dataset_discussion_url: "https://github.com/gll-better/opendata",
|
43
|
-
dataset_documentation_url: "https://
|
51
|
+
dataset_documentation_url: "https://permalink.openactive.io/dataset-site/open-data-documentation",
|
44
52
|
dataset_languages: ["en-GB"],
|
45
53
|
organisation_name: "Better",
|
46
54
|
organisation_url: "https://www.better.org.uk/",
|
@@ -53,6 +61,12 @@ settings = OpenActive::DatasetSite::Settings.new(
|
|
53
61
|
platform_software_version: "2.0",
|
54
62
|
background_image_url: "https://data.better.org.uk/images/bg.jpg",
|
55
63
|
date_first_published: "2019-10-28",
|
64
|
+
open_booking_api_base_url: "https://reference-implementation.openactive.io/api/openbooking",
|
65
|
+
open_booking_api_authentication_authority_url: "https://auth.reference-implementation.openactive.io",
|
66
|
+
open_booking_api_documentation_url: "https://permalink.openactive.io/dataset-site/open-booking-api-documentation",
|
67
|
+
open_booking_api_terms_service_url: "https://example.com/api-terms-page",
|
68
|
+
open_booking_api_registration_url: "https://example.com/api-landing-page",
|
69
|
+
test_suite_certificate_url: "https://certificates.reference-implementation.openactive.io/examples/all-features/controlled/",
|
56
70
|
data_feed_types: [
|
57
71
|
OpenActive::DatasetSite::FeedType::FACILITY_USE,
|
58
72
|
OpenActive::DatasetSite::FeedType::SCHEDULED_SESSION,
|
@@ -110,9 +124,21 @@ settings = OpenActive::DatasetSite::Settings.new(
|
|
110
124
|
```ruby
|
111
125
|
dataset = OpenActive::Models::Dataset.new(
|
112
126
|
id: "http://example.com/dataset/",
|
127
|
+
url: "http://example.com/dataset/",
|
113
128
|
description:
|
114
129
|
"Near real-time availability and rich descriptions relating to the facilities and sessions available from Simpleweb",
|
115
|
-
|
130
|
+
access_service:
|
131
|
+
OpenActive::Models::WebAPI.new(
|
132
|
+
name: 'Open Booking API',
|
133
|
+
description: "API that allows for seamless booking experiences to be created for facilities and sessions available from Simpleweb",
|
134
|
+
documentation: "https://permalink.openactive.io/dataset-site/open-booking-api-documentation",
|
135
|
+
terms_of_service: "https://example.com/api-terms-page",
|
136
|
+
endpoint_url: "https://reference-implementation.openactive.io/api/openbooking",
|
137
|
+
authentication_authority: "https://auth.reference-implementation.openactive.io",
|
138
|
+
conforms_to: ["https://openactive.io/open-booking-api/EditorsDraft/"],
|
139
|
+
endpoint_description: "https://www.openactive.io/open-booking-api/EditorsDraft/swagger.json",
|
140
|
+
landing_page: "https://example.com/api-landing-page"
|
141
|
+
),
|
116
142
|
dateModified: "2019-12-09T15:36:15+00:00",
|
117
143
|
keywords:
|
118
144
|
["Facilities",
|
@@ -170,8 +196,14 @@ dataset = OpenActive::Models::Dataset.new(
|
|
170
196
|
url:
|
171
197
|
"https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
|
172
198
|
),
|
173
|
-
documentation: "https://
|
199
|
+
documentation: "https://permalink.openactive.io/dataset-site/open-data-documentation",
|
174
200
|
name: "Simpleweb Facilities and Sessions",
|
201
|
+
booking_service:
|
202
|
+
OpenActive::Models::BookingService.new(
|
203
|
+
name: "SimpleWeb Booking",
|
204
|
+
url: "https://www.example.com/",
|
205
|
+
has_credential: "https://certificates.reference-implementation.openactive.io/examples/all-features/controlled/",
|
206
|
+
)
|
175
207
|
)
|
176
208
|
|
177
209
|
renderer = OpenActive::DatasetSite::TemplateRenderer.new(dataset)
|
@@ -203,35 +235,43 @@ Accepts a config hash containing the following keys:
|
|
203
235
|
|
204
236
|
##### Settings
|
205
237
|
|
206
|
-
| Key
|
207
|
-
|
|
208
|
-
| `open_data_feed_base_url`
|
209
|
-
| `dataset_site_url`
|
210
|
-
| `dataset_discussion_url`
|
211
|
-
| `dataset_documentation_url`
|
212
|
-
| `dataset_languages`
|
213
|
-
| `organisation_name`
|
214
|
-
| `organisation_url`
|
215
|
-
| `organisation_legal_entity`
|
216
|
-
| `organisation_plain_text_description`
|
217
|
-
| `organisation_logo_url`
|
218
|
-
| `organisation_email`
|
219
|
-
| `platform_name`
|
220
|
-
| `platform_url`
|
221
|
-
| `platform_software_version`
|
222
|
-
| `background_image_url`
|
223
|
-
| `date_first_published`
|
224
|
-
| `
|
238
|
+
| Key | Type | Description |
|
239
|
+
| ----------------------------------------------- | ----------- | ----------- |
|
240
|
+
| `open_data_feed_base_url` | `string` | The the base URL for the open data feeds |
|
241
|
+
| `dataset_site_url` | `string` | The URL where this dataset site is displayed (the page's own URL) |
|
242
|
+
| `dataset_discussion_url` | `string` | The GitHub issues page for the dataset |
|
243
|
+
| `dataset_documentation_url` | `string` | Any documentation specific to the dataset. Defaults to https://permalink.openactive.io/dataset-site/open-data-documentation if not provided, which should be used if no documentation is available. |
|
244
|
+
| `dataset_languages` | `string[]` | The languages available in the dataset, following the IETF BCP 47 standard. Defaults to `array("en-GB")`. |
|
245
|
+
| `organisation_name` | `string` | The publishing organisation's name |
|
246
|
+
| `organisation_url` | `string` | The publishing organisation's URL |
|
247
|
+
| `organisation_legal_entity` | `string` | The legal name of the publishing organisation of this dataset |
|
248
|
+
| `organisation_plain_text_description` | `string` | A plain text description of this organisation |
|
249
|
+
| `organisation_logo_url` | `string` | An image URL of the publishing organisation's logo, ideally in PNG format |
|
250
|
+
| `organisation_email` | `string` | The contact email of the publishing organisation of this dataset |
|
251
|
+
| `platform_name` | `string` | The software platform's name. Only set this if different from the publishing organisation, otherwise leave as null to exclude platform metadata. |
|
252
|
+
| `platform_url` | `string` | The software platform's website |
|
253
|
+
| `platform_software_version` | `string` | The software platform's software version |
|
254
|
+
| `background_image_url` | `string` | The background image to show on the Dataset Site page |
|
255
|
+
| `date_first_published` | `string` | The date the dataset was first published |
|
256
|
+
| `open_booking_api_base_url` | `string` | The Base URI of this implementation of the Open Booking API |
|
257
|
+
| `open_booking_api_authentication_authority_url` | `string` | The location of the OpenID Provider that must be used to access the API |
|
258
|
+
| `open_booking_api_documentation_url` | `string` | The URL of documentation related to how to use the Open Booking API. Defaults to https://permalink.openactive.io/dataset-site/open-booking-api-documentation if not provided, which should be used if no system-specific documentation is available. |
|
259
|
+
| `open_booking_api_terms_service_url` | `string` | The URL of terms of service related to the use of this API |
|
260
|
+
| `open_booking_api_registration_url` | `string` | The URL of a web page that the Broker may use to obtain access to the API, e.g. via a web form |
|
261
|
+
| `test_suite_certificate_url` | `string` | The URL of the OpenActive Test Suite certificate for this booking system |
|
262
|
+
| `data_feed_types` | `FeedType[]`| A list of supported DataFeed types |
|
225
263
|
|
226
264
|
And `data_feed_types` must be an array of `FeedType` constants, which auto-generates the metadata associated which each feed using best-practice values. See [available types](#feedtype)
|
227
265
|
|
228
|
-
#### OpenActive::DatasetSite::TemplateRenderer.new(settings)
|
266
|
+
#### OpenActive::DatasetSite::TemplateRenderer.new(settings, static_assets_path_url = nil)
|
267
|
+
|
268
|
+
Accepts a [`settings`](#settings) or [`DataSet`](#dataset) object. This is a Mustache engine.
|
229
269
|
|
230
|
-
|
270
|
+
If `static_assets_path_url` is provided, the [CSP-compatible template](https://developer.openactive.io/publishing-data/dataset-sites#template-hosting-options) is rendered. In this case you must ensure that you are serving the contents of the [CSP compatible static assets archive](/lib/openactive/dataset_site/datasetsite-csp.static.zip) at this location, using the assets archive in this version of the Ruby gem.
|
231
271
|
|
232
272
|
##### .render
|
233
273
|
|
234
|
-
Returns a string corresponding to the compiled HTML, based on the `datasetsite.mustache`, the provided [`settings`](#settings)
|
274
|
+
Returns a string corresponding to the compiled HTML, based on the `datasetsite.mustache`, and the provided [`settings`](#settings) or [`DataSet`](#dataset) object
|
235
275
|
|
236
276
|
#### `FeedType`
|
237
277
|
|
@@ -249,3 +289,9 @@ A class containing the supported distribution types:
|
|
249
289
|
| `SCHEDULED_SESSION` | `ScheduledSession` |
|
250
290
|
| `SESSION_SERIES` | `SessionSeries` |
|
251
291
|
| `SLOT` | `Slot` |
|
292
|
+
|
293
|
+
## Contribution
|
294
|
+
|
295
|
+
### Release
|
296
|
+
|
297
|
+
Major version numbers of this library should match those of the `dataset-site-template` on which this library depends. Any updates to the dataset site template files or assets should always be a major version update in both libraries.
|
data/Rakefile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require "openactive/dataset_site"
|
5
|
+
|
6
|
+
feed_types = [
|
7
|
+
OpenActive::DatasetSite::FeedType::FACILITY_USE,
|
8
|
+
OpenActive::DatasetSite::FeedType::SCHEDULED_SESSION,
|
9
|
+
OpenActive::DatasetSite::FeedType::SESSION_SERIES,
|
10
|
+
OpenActive::DatasetSite::FeedType::SLOT,
|
11
|
+
]
|
12
|
+
|
13
|
+
settings = OpenActive::DatasetSite::Settings.new(
|
14
|
+
open_data_feed_base_url: "http://example.com/feed/",
|
15
|
+
dataset_site_url: "http://example.com/dataset/",
|
16
|
+
dataset_discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
|
17
|
+
dataset_documentation_url: "https://permalink.openactive.io/dataset-site/open-data-documentation",
|
18
|
+
dataset_languages: ["en-GB"],
|
19
|
+
organisation_name: "Simpleweb",
|
20
|
+
organisation_url: "https://www.simpleweb.co.uk/",
|
21
|
+
organisation_legal_entity: "Simpleweb Ltd",
|
22
|
+
organisation_plain_text_description: "Simpleweb is a purpose driven software company that specialises in new "\
|
23
|
+
"technologies, product development, and human interaction.",
|
24
|
+
organisation_logo_url: "https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
|
25
|
+
organisation_email: "spam@simpleweb.co.uk",
|
26
|
+
background_image_url: "https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
|
27
|
+
date_first_published: "2019-11-05",
|
28
|
+
platform_name: "AcmeBooker",
|
29
|
+
platform_url: "https://acmebooker.example.com/",
|
30
|
+
open_booking_api_base_url: "https://reference-implementation.openactive.io/api/openbooking",
|
31
|
+
open_booking_api_authentication_authority_url: "https://auth.reference-implementation.openactive.io",
|
32
|
+
open_booking_api_documentation_url: "https://permalink.openactive.io/dataset-site/open-booking-api-documentation",
|
33
|
+
open_booking_api_terms_service_url: "https://example.com/api-terms-page",
|
34
|
+
open_booking_api_registration_url: "https://example.com/api-landing-page",
|
35
|
+
test_suite_certificate_url: "https://certificates.reference-implementation.openactive.io/examples/all-features/controlled/",
|
36
|
+
data_feed_types: feed_types,
|
37
|
+
)
|
38
|
+
|
39
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(settings, "./path/to/assets")
|
40
|
+
|
41
|
+
puts renderer.render
|
data/examples/basic_example.rb
CHANGED
@@ -14,7 +14,7 @@ settings = OpenActive::DatasetSite::Settings.new(
|
|
14
14
|
open_data_feed_base_url: "http://example.com/feed/",
|
15
15
|
dataset_site_url: "http://example.com/dataset/",
|
16
16
|
dataset_discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
|
17
|
-
dataset_documentation_url: "https://
|
17
|
+
dataset_documentation_url: "https://permalink.openactive.io/dataset-site/open-data-documentation",
|
18
18
|
dataset_languages: ["en-GB"],
|
19
19
|
organisation_name: "Simpleweb",
|
20
20
|
organisation_url: "https://www.simpleweb.co.uk/",
|
@@ -24,7 +24,7 @@ settings = OpenActive::DatasetSite::Settings.new(
|
|
24
24
|
organisation_logo_url: "https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
|
25
25
|
organisation_email: "spam@simpleweb.co.uk",
|
26
26
|
background_image_url: "https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
|
27
|
-
date_first_published: "2019-11-05",
|
27
|
+
date_first_published: "2019-11-05",
|
28
28
|
data_feed_types: feed_types,
|
29
29
|
)
|
30
30
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require "openactive/dataset_site"
|
5
|
+
|
6
|
+
feed_types = [
|
7
|
+
OpenActive::DatasetSite::FeedType::FACILITY_USE,
|
8
|
+
OpenActive::DatasetSite::FeedType::SCHEDULED_SESSION,
|
9
|
+
OpenActive::DatasetSite::FeedType::SESSION_SERIES,
|
10
|
+
OpenActive::DatasetSite::FeedType::SLOT,
|
11
|
+
]
|
12
|
+
|
13
|
+
settings = OpenActive::DatasetSite::Settings.new(
|
14
|
+
open_data_feed_base_url: "http://example.com/feed/",
|
15
|
+
dataset_site_url: "http://example.com/dataset/",
|
16
|
+
dataset_discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
|
17
|
+
dataset_documentation_url: "https://permalink.openactive.io/dataset-site/open-data-documentation",
|
18
|
+
dataset_languages: ["en-GB"],
|
19
|
+
organisation_name: "Simpleweb",
|
20
|
+
organisation_url: "https://www.simpleweb.co.uk/",
|
21
|
+
organisation_legal_entity: "Simpleweb Ltd",
|
22
|
+
organisation_plain_text_description: "Simpleweb is a purpose driven software company that specialises in new "\
|
23
|
+
"technologies, product development, and human interaction.",
|
24
|
+
organisation_logo_url: "https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
|
25
|
+
organisation_email: "spam@simpleweb.co.uk",
|
26
|
+
background_image_url: "https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
|
27
|
+
date_first_published: "2019-11-05",
|
28
|
+
platform_name: "AcmeBooker",
|
29
|
+
platform_url: "https://acmebooker.example.com/",
|
30
|
+
open_booking_api_base_url: "https://reference-implementation.openactive.io/api/openbooking",
|
31
|
+
open_booking_api_authentication_authority_url: "https://auth.reference-implementation.openactive.io",
|
32
|
+
open_booking_api_documentation_url: "https://permalink.openactive.io/dataset-site/open-booking-api-documentation",
|
33
|
+
open_booking_api_terms_service_url: "https://example.com/api-terms-page",
|
34
|
+
open_booking_api_registration_url: "https://example.com/api-landing-page",
|
35
|
+
test_suite_certificate_url: "https://certificates.reference-implementation.openactive.io/examples/all-features/controlled/",
|
36
|
+
data_feed_types: feed_types,
|
37
|
+
)
|
38
|
+
|
39
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(settings)
|
40
|
+
|
41
|
+
puts renderer.render
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require "openactive/dataset_site"
|
5
|
+
|
6
|
+
feed_types = [
|
7
|
+
OpenActive::DatasetSite::FeedType::FACILITY_USE,
|
8
|
+
OpenActive::DatasetSite::FeedType::SCHEDULED_SESSION,
|
9
|
+
OpenActive::DatasetSite::FeedType::SESSION_SERIES,
|
10
|
+
OpenActive::DatasetSite::FeedType::SLOT,
|
11
|
+
]
|
12
|
+
|
13
|
+
settings = OpenActive::DatasetSite::Settings.new(
|
14
|
+
open_data_feed_base_url: "http://example.com/feed/",
|
15
|
+
dataset_site_url: "http://example.com/dataset/",
|
16
|
+
dataset_discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
|
17
|
+
dataset_languages: ["en-GB"],
|
18
|
+
organisation_name: "Simpleweb",
|
19
|
+
organisation_url: "https://www.simpleweb.co.uk/",
|
20
|
+
organisation_legal_entity: "Simpleweb Ltd",
|
21
|
+
organisation_plain_text_description: "Simpleweb is a purpose driven software company that specialises in new "\
|
22
|
+
"technologies, product development, and human interaction.",
|
23
|
+
organisation_logo_url: "https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
|
24
|
+
organisation_email: "spam@simpleweb.co.uk",
|
25
|
+
background_image_url: "https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
|
26
|
+
date_first_published: "2019-11-05",
|
27
|
+
open_booking_api_base_url: "https://reference-implementation.openactive.io/api/openbooking",
|
28
|
+
open_booking_api_registration_url: "https://example.com/api-landing-page",
|
29
|
+
test_suite_certificate_url: "https://certificates.reference-implementation.openactive.io/examples/all-features/controlled/",
|
30
|
+
data_feed_types: feed_types,
|
31
|
+
)
|
32
|
+
|
33
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(settings)
|
34
|
+
|
35
|
+
puts renderer.render
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require "openactive/dataset_site"
|
5
|
+
|
6
|
+
dataset = OpenActive::Models::Dataset.new(
|
7
|
+
id: "http://example.com/dataset/",
|
8
|
+
url: "http://example.com/dataset/",
|
9
|
+
description:
|
10
|
+
"Near real-time availability and rich descriptions relating to the facilities and sessions available from Simpleweb",
|
11
|
+
access_service:
|
12
|
+
OpenActive::Models::WebAPI.new(
|
13
|
+
name: 'Open Booking API',
|
14
|
+
description: "API that allows for seamless booking experiences to be created for facilities and sessions available from Simpleweb",
|
15
|
+
documentation: "https://permalink.openactive.io/dataset-site/open-booking-api-documentation",
|
16
|
+
terms_of_service: "https://example.com/api-terms-page",
|
17
|
+
endpoint_url: "https://reference-implementation.openactive.io/api/openbooking",
|
18
|
+
authentication_authority: "https://auth.reference-implementation.openactive.io",
|
19
|
+
conforms_to: ["https://openactive.io/open-booking-api/EditorsDraft/"],
|
20
|
+
endpoint_description: "https://www.openactive.io/open-booking-api/EditorsDraft/swagger.json",
|
21
|
+
landing_page: "https://example.com/api-landing-page"
|
22
|
+
),
|
23
|
+
date_modified: "2019-12-09T15:36:15+00:00",
|
24
|
+
keywords:
|
25
|
+
["Facilities",
|
26
|
+
"Sessions",
|
27
|
+
"Activities",
|
28
|
+
"Sports",
|
29
|
+
"Physical Activity",
|
30
|
+
"OpenActive"],
|
31
|
+
schema_version: "https://www.openactive.io/modelling-opportunity-data/2.0/",
|
32
|
+
license: "https://creativecommons.org/licenses/by/4.0/",
|
33
|
+
publisher:
|
34
|
+
OpenActive::Models::Organization.new(
|
35
|
+
name: "Simpleweb",
|
36
|
+
description:
|
37
|
+
"Simpleweb is a purpose driven software company that specialises in new technologies, product development, and human interaction.",
|
38
|
+
url: "https://www.simpleweb.co.uk/",
|
39
|
+
legalName: "Simpleweb Ltd",
|
40
|
+
logo:
|
41
|
+
OpenActive::Models::ImageObject.new(
|
42
|
+
url:
|
43
|
+
"https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
|
44
|
+
),
|
45
|
+
email: "spam@simpleweb.co.uk",
|
46
|
+
),
|
47
|
+
discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
|
48
|
+
date_published: "2019-11-05T00:00:00+00:00",
|
49
|
+
in_language: ["en-GB"],
|
50
|
+
distribution:
|
51
|
+
[OpenActive::Models::DataDownload.new(
|
52
|
+
name: "FacilityUse",
|
53
|
+
additional_type: "https://openactive.io/FacilityUse",
|
54
|
+
encoding_format: "application/vnd.openactive.rpde+json; version=1",
|
55
|
+
content_url: "http://example.com/feed/facility-uses",
|
56
|
+
),
|
57
|
+
OpenActive::Models::DataDownload.new(
|
58
|
+
name: "ScheduledSession",
|
59
|
+
additional_type: "https://openactive.io/ScheduledSession",
|
60
|
+
encoding_format: "application/vnd.openactive.rpde+json; version=1",
|
61
|
+
content_url: "http://example.com/feed/scheduled-sessions",
|
62
|
+
),
|
63
|
+
OpenActive::Models::DataDownload.new(
|
64
|
+
name: "SessionSeries",
|
65
|
+
additional_type: "https://openactive.io/SessionSeries",
|
66
|
+
encoding_format: "application/vnd.openactive.rpde+json; version=1",
|
67
|
+
content_url: "http://example.com/feed/session_series",
|
68
|
+
),
|
69
|
+
OpenActive::Models::DataDownload.new(
|
70
|
+
name: "Slot",
|
71
|
+
additional_type: "https://openactive.io/Slot",
|
72
|
+
encoding_format: "application/vnd.openactive.rpde+json; version=1",
|
73
|
+
content_url: "http://example.com/feed/slots",
|
74
|
+
)],
|
75
|
+
background_image:
|
76
|
+
OpenActive::Models::ImageObject.new(
|
77
|
+
url:
|
78
|
+
"https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
|
79
|
+
),
|
80
|
+
documentation: "https://permalink.openactive.io/dataset-site/open-data-documentation",
|
81
|
+
name: "Simpleweb Facilities and Sessions",
|
82
|
+
booking_service:
|
83
|
+
OpenActive::Models::BookingService.new(
|
84
|
+
name: "SimpleWeb Booking",
|
85
|
+
url: "https://www.example.com/",
|
86
|
+
has_credential: "https://certificates.reference-implementation.openactive.io/examples/all-features/controlled/",
|
87
|
+
),
|
88
|
+
)
|
89
|
+
|
90
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(dataset, "./path/to/assets")
|
91
|
+
|
92
|
+
puts renderer.render
|
data/examples/dataset_example.rb
CHANGED
@@ -5,9 +5,9 @@ require "openactive/dataset_site"
|
|
5
5
|
|
6
6
|
dataset = OpenActive::Models::Dataset.new(
|
7
7
|
id: "http://example.com/dataset/",
|
8
|
+
url: "http://example.com/dataset/",
|
8
9
|
description:
|
9
10
|
"Near real-time availability and rich descriptions relating to the facilities and sessions available from Simpleweb",
|
10
|
-
url: "http://example.com/dataset/",
|
11
11
|
date_modified: "2019-12-09T15:36:15+00:00",
|
12
12
|
keywords:
|
13
13
|
["Facilities",
|
@@ -65,8 +65,13 @@ dataset = OpenActive::Models::Dataset.new(
|
|
65
65
|
url:
|
66
66
|
"https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
|
67
67
|
),
|
68
|
-
documentation: "https://
|
68
|
+
documentation: "https://permalink.openactive.io/dataset-site/open-data-documentation",
|
69
69
|
name: "Simpleweb Facilities and Sessions",
|
70
|
+
booking_service:
|
71
|
+
OpenActive::Models::BookingService.new(
|
72
|
+
name: "SimpleWeb Booking",
|
73
|
+
url: "https://www.example.com/",
|
74
|
+
),
|
70
75
|
)
|
71
76
|
|
72
77
|
renderer = OpenActive::DatasetSite::TemplateRenderer.new(dataset)
|