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.
@@ -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)
91
+
92
+ puts renderer.render
@@ -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://developer.openactive.io/",
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,13 +24,13 @@ 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", # remember, remember the fifth of November...
27
+ date_first_published: "2019-11-05",
28
28
  data_feed_types: feed_types,
29
29
  )
30
30
 
31
31
  dataset = settings.to_dataset
32
32
 
33
- dataset.description = "Some better non-generated description here."
33
+ dataset.description = "Some better non-generated description here"
34
34
 
35
35
  renderer = OpenActive::DatasetSite::TemplateRenderer.new(dataset)
36
36
 
@@ -25,7 +25,7 @@ end.new(
25
25
  open_data_feed_base_url: "http://example.com/feed/",
26
26
  dataset_site_url: "http://example.com/dataset/",
27
27
  dataset_discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
28
- dataset_documentation_url: "https://developer.openactive.io/",
28
+ dataset_documentation_url: "https://permalink.openactive.io/dataset-site/open-data-documentation",
29
29
  dataset_languages: ["en-GB"],
30
30
  organisation_name: "Simpleweb",
31
31
  organisation_url: "https://www.simpleweb.co.uk/",
@@ -35,7 +35,7 @@ end.new(
35
35
  organisation_logo_url: "https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
36
36
  organisation_email: "spam@simpleweb.co.uk",
37
37
  background_image_url: "https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
38
- date_first_published: "2019-11-05", # remember, remember the fifth of November...
38
+ date_first_published: "2019-11-05",
39
39
  data_feed_types: feed_types,
40
40
  )
41
41
 
@@ -27,7 +27,7 @@ settings = CustomDatasetSettings.new(
27
27
  open_data_feed_base_url: "http://example.com/feed/",
28
28
  dataset_site_url: "http://example.com/dataset/",
29
29
  dataset_discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
30
- dataset_documentation_url: "https://developer.openactive.io/",
30
+ dataset_documentation_url: "https://permalink.openactive.io/dataset-site/open-data-documentation",
31
31
  dataset_languages: ["en-GB"],
32
32
  organisation_name: "Simpleweb",
33
33
  organisation_url: "https://www.simpleweb.co.uk/",
@@ -37,7 +37,7 @@ settings = CustomDatasetSettings.new(
37
37
  organisation_logo_url: "https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
38
38
  organisation_email: "spam@simpleweb.co.uk",
39
39
  background_image_url: "https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
40
- date_first_published: "2019-11-05", # remember, remember the fifth of November...
40
+ date_first_published: "2019-11-05",
41
41
  data_feed_types: feed_types,
42
42
  )
43
43
 
@@ -0,0 +1,205 @@
1
+ <!DOCTYPE HTML>
2
+ <!--
3
+ OpenActive Dataset Site Template version 6, from https://unpkg.com/@openactive/dataset-site-template@6.0.0/dist/datasetsite-csp.mustache
4
+
5
+ This HTML file must reference a self-hosted 'datasetsite.styles.v6.css' file, co-located with the rest
6
+ of the static assets from the following archive:
7
+ https://unpkg.com/@openactive/dataset-site-template@6.0.0/dist/datasetsite-csp.static.zip
8
+ -->
9
+ <!--
10
+ Design: Identity by HTML5 UP
11
+ html5up.net | @ajlkn
12
+ Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
13
+
14
+ DCAT Template: Nick Evans / imin
15
+ imin.co | @nickevans / @_imin_
16
+ For openactive.io
17
+ Free for personal and commercial use under the CC-BY v4.0 license (https://creativecommons.org/licenses/by/4.0/)
18
+ -->
19
+ <html prefix="dct: http://purl.org/dc/terms/
20
+ rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
21
+ dcat: http://www.w3.org/ns/dcat#
22
+ foaf: http://xmlns.com/foaf/0.1/
23
+ og: http://ogp.me/ns#
24
+ odrs: http://schema.theodi.org/odrs#"
25
+ lang="en">
26
+ <head>
27
+ <title>{{name}} - Open Data</title>
28
+
29
+ <meta name="title" content="{{name}} - Open Data" />
30
+ <meta name="identifier" content="{{url}}" />
31
+ <meta name="Keywords" content="{{#keywords}}{{.}},{{/keywords}}Open Data" />
32
+ <meta name="Description" content="{{description}}" />
33
+ <meta name="language" content="English" />
34
+
35
+ <meta property="og:title" content="{{name}} - Open Data" />
36
+ <meta property="og:description" content="{{description}}" />
37
+ <meta property="og:locale" content="en_GB" />
38
+ <meta property="og:url" content="{{url}}" />
39
+ <meta property="og:image" content="{{publisher.logo.url}}" />
40
+
41
+ <meta charset="utf-8" />
42
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
43
+
44
+ <!-- JSON-LD conforming to Google Structured Data specification. -->
45
+ <script type="application/ld+json">
46
+ {{{jsonld}}}
47
+ </script>
48
+
49
+ <!--
50
+ This stylesheet href must reference a self-hosted 'datasetsite.styles.v6.css' file in
51
+ the same directory as the other static assets sourced from the following archive:
52
+ https://unpkg.com/@openactive/dataset-site-template@6.0.0/dist/datasetsite-csp.static.zip
53
+ -->
54
+ <link rel="stylesheet" href="{{{staticAssetsPathUrl}}}/datasetsite.styles.v6.css" crossorigin="anonymous">
55
+
56
+ </head>
57
+ <body id="booking" background="{{backgroundImage.url}}">
58
+ <table class="always-hidden" bgcolor="#FFFFFF" width="100%" height="500px"><tr><td align="center">
59
+ <p></p>
60
+ <p><large><strong>Error: Static Assets Not Found</strong><large></p>
61
+ <p>This HTML page must reference self-hosted static assets located at the relative or absolute path configured by "staticAssetsPathUrl" in the mustache template source data.</p>
62
+ <p>"staticAssetsPathUrl" is currently set to "{{staticAssetsPathUrl}}", and this page has failed to access this file: <pre>{{staticAssetsPathUrl}}/datasetsite.styles.v6.css</pre></p>
63
+ <p>Please ensure that the assets at this location exactly match those in
64
+ <a href="https://unpkg.com/@openactive/dataset-site-template@6.0.0/dist/datasetsite-csp.static.zip">datasetsite-csp.static.zip version 6</a>.</p>
65
+ <p></p>
66
+ <p>See the <a href="https://github.com/openactive/dataset-site-template">"CSP compatible template" documentation</a> for more information</p>
67
+ <p></p>
68
+ </td></tr></table>
69
+
70
+ <div class="outerscene">
71
+ <div id="anchor"></div>
72
+ <!-- Wrapper -->
73
+ <div id="wrapper" typeof="dcat:Dataset" resource="{{url}}">
74
+ {{#accessService}}
75
+ <a class="tab left" href="#"><div>Open Data</div></a>
76
+ <a class="tab right" href="#booking"><div><span class="short">Open</span> Booking <span class="short">API</span></div></a>
77
+ {{/accessService}}
78
+ <div class="content">
79
+ <div class="bar">
80
+ {{#disambiguatingDescription}}
81
+ <p class="warning">{{.}}</p>
82
+ {{/disambiguatingDescription}}
83
+ </div>
84
+ <div class="scene">
85
+ <div class="flip">
86
+ <!-- Front -->
87
+ <section id="main" class="front card">
88
+
89
+ <header>
90
+ <div>
91
+ <a href="{{publisher.url}}" about="{{publisher.url}}" property="foaf:homepage">
92
+ <span class="avatar" property="foaf:name" content="{{publisher.name}}"><img class="logo" src="{{publisher.logo.url}}" alt="" /></span>
93
+ </a>
94
+ </div>
95
+
96
+ <h1>Open Data</h1>
97
+
98
+ <h2 property="dct:title">{{name}}</h2>
99
+
100
+ <p class="description">{{description}}, published using <a href='https://www.openactive.io/'>OpenActive</a> <a href='https://openactive.io/realtime-paged-data-exchange/1.0/'>RPDE 1.0</a> and <a href='{{schemaVersion}}'>Model 2.0</a>.</p>
101
+ <p class="metadata" property="dct:description">{{description}}.</p>
102
+ <p class="metadata" property="dct:created" content='{{datePublished}}' datatype='xsd:dateTime'></p>
103
+ {{#keywords}}
104
+ <p class="metadata" property="dcat:keyword">{{.}}</p>
105
+ {{/keywords}}
106
+ <a class="metadata" href="http://purl.org/linked-data/sdmx/2009/code#freq-N" property="dct:accrualPeriodicity">Every minute</a>
107
+ <ul class="icons">
108
+ <li><a href="{{documentation}}" class="fa-info">Documentation</a><br /><span>Documentation</span></li>
109
+ <li><a href="{{discussionUrl}}" class="fa-comments">Discussion</a><br /><span>Discussion</span></li>
110
+ {{#bookingService.hasCredential}}
111
+ <li><a href="{{.}}" class="fa-certificate">Certificate</a><br /><span>Certificate</span></li>
112
+ {{/bookingService.hasCredential}}
113
+ </ul>
114
+ </header>
115
+
116
+ <ul class="download">
117
+ {{#distribution}}
118
+ <li>
119
+ <a property='dcat:distribution' typeof='dcat:Distribution' href='{{contentUrl}}'>
120
+ <i class="fa fa-cloud-download"></i>
121
+ <span property="dct:title">{{name}}</span>
122
+ <span class="metadata" content='{{encodingFormat}}' property='dcat:mediaType'>OpenActive RPDE v1.0 Endpoints conforming to Modelling Specification 2.0.</span>
123
+ </a>
124
+ </li>
125
+ {{/distribution}}
126
+ </ul>
127
+
128
+ <footer>
129
+ <div class="license">
130
+ <span property="dct:license" resource="{{license}}">
131
+ This data is owned by <a property="dct:publisher" href="{{publisher.url}}">{{publisher.legalName}}</a> and is licensed under the
132
+ <a href="{{license}}"><span property="dct:title">Creative Commons Attribution Licence (CC-BY v4.0)</span></a>
133
+ for anyone to access, use and share;
134
+ </span>
135
+ <span property="dct:rights" resource="#rights" typeof="odrs:RightsStatement">
136
+ <span class="metadata" property="rdfs:label">Rights Statement</span>
137
+ <a class="metadata" href="{{license}}" property="odrs:dataLicense">Creative Commons Attribution Licence (CC-BY v4.0)</a>
138
+ <a class="metadata" href="{{license}}" property="odrs:contentLicense">Creative Commons Attribution Licence (CC-BY v4.0)</a>
139
+ using attribution
140
+ "<a href="{{url}}" property="odrs:attributionURL"><span property="odrs:attributionText">{{publisher.name}}</span></a>".
141
+ </span>
142
+ </div>
143
+ <span class="avatar"><a href="https://www.openactive.io/"><div class="logo-sm openactive-logo" alt="OpenActive"></div></a></span>
144
+ </footer>
145
+ </section>
146
+
147
+ <!-- Back -->
148
+ <section id="access" class="back card">
149
+ <header>
150
+ <div>
151
+ <a href="{{publisher.url}}">
152
+ <span class="avatar"><img class="logo" src="{{publisher.logo.url}}" alt="" /></span>
153
+ </a>
154
+ </div>
155
+
156
+ <h1>Open Booking API</h1>
157
+
158
+ <h2>{{name}}</h2>
159
+
160
+ <p class="description">{{accessService.description}}, conforming to <a href='https://www.openactive.io/'>OpenActive</a> <a href='https://openactive.io/open-booking-api/EditorsDraft/1.0CR3/'>Open Booking 1.0 CR3</a>.</p>
161
+ <ul class="icons">
162
+ <li><a href="{{accessService.landingPage}}" class="fa-key">Access</a><br /><span>Access</span></li>
163
+ <li><a href="{{accessService.documentation}}" class="fa-info">Documentation</a><br /><span>Documentation</span></li>
164
+ <li><a href="{{discussionUrl}}" class="fa-comments">Discussion</a><br /><span>Discussion</span></li>
165
+ <li><a href="{{bookingService.hasCredential}}" class="fa-certificate">Certificate</a><br /><span>Certificate</span></li>
166
+ </ul>
167
+ </header>
168
+
169
+ <div class="baseurls">
170
+ <div class="baseurl">
171
+ <label for="txtEndpointUrl">Base URI</label>
172
+ <input id="txtEndpointUrl" type="text" class="code" value="{{accessService.endpointUrl}}" disabled>
173
+ </div>
174
+
175
+ {{#accessService.authenticationAuthority}}
176
+ <div class="baseurl">
177
+ <label for="txtAuthenticationAuthority">Authentication Authority</label>
178
+ <input id="txtAuthenticationAuthority" type="text" class="code" value="{{.}}" disabled>
179
+ </div>
180
+ {{/accessService.authenticationAuthority}}
181
+ </div>
182
+
183
+ <footer>
184
+ {{#accessService.termsOfService}}
185
+ <div class="license">
186
+ Use of this API is governed by specific <a href="{{.}}">Terms of Service</a>.
187
+ </div>
188
+ {{/accessService.termsOfService}}
189
+ <span class="avatar"><a href="https://www.openactive.io/"><div class="logo-sm openactive-logo" alt="OpenActive"></div></a></span>
190
+ </footer>
191
+ </section>
192
+ </div>
193
+ </div>
194
+ </div>
195
+
196
+ <!-- Footer -->
197
+ <footer id="footer">
198
+ <ul class="copyright">
199
+ <li>{{#bookingService}}Platform: <a href="{{url}}">{{name}} {{softwareVersion}}</a>. {{/bookingService}}Design: <a href="http://html5up.net">HTML5 UP</a>.</li>
200
+ </ul>
201
+ </footer>
202
+ </div>
203
+ </div>
204
+ </body>
205
+ </html>