openactive-dataset_site 0.1.1 → 6.0.1
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 +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
@@ -37,6 +37,18 @@ module OpenActive
|
|
37
37
|
attr_accessor :data_feed_types
|
38
38
|
attr_accessor :data_downloads
|
39
39
|
|
40
|
+
# **** OPEN BOOKING ****
|
41
|
+
|
42
|
+
attr_accessor :open_booking_api_base_url
|
43
|
+
attr_accessor :open_booking_api_documentation_url
|
44
|
+
attr_accessor :open_booking_api_terms_service_url
|
45
|
+
attr_accessor :open_booking_api_registration_url
|
46
|
+
attr_accessor :open_booking_api_authentication_authority_url
|
47
|
+
|
48
|
+
# **** TEST SUITE CERTIFICATE ****
|
49
|
+
|
50
|
+
attr_accessor :test_suite_certificate_url
|
51
|
+
|
40
52
|
def data_feed_descriptions
|
41
53
|
data_feed_types.map do |description|
|
42
54
|
description.respond_to?(:display_name) ? description.display_name : description
|
@@ -62,12 +74,18 @@ module OpenActive
|
|
62
74
|
]
|
63
75
|
end
|
64
76
|
|
65
|
-
def
|
77
|
+
def dataset_description
|
66
78
|
"Near real-time availability and rich descriptions relating to the "\
|
67
79
|
"#{data_feed_descriptions_sentence} available from "\
|
68
80
|
"#{organisation_name}"
|
69
81
|
end
|
70
82
|
|
83
|
+
def webapi_description
|
84
|
+
"API that allows for seamless booking experiences to be created for "\
|
85
|
+
"#{data_feed_descriptions_sentence} available from "\
|
86
|
+
"#{organisation_name}"
|
87
|
+
end
|
88
|
+
|
71
89
|
# @return [OpenActive::Models::DataDownload] A DataDownload object.
|
72
90
|
def data_download(feed_type)
|
73
91
|
OpenActive::Models::DataDownload.new(
|
@@ -85,13 +103,55 @@ module OpenActive
|
|
85
103
|
|
86
104
|
# @return [OpenActive::Models::BookingService, nil]
|
87
105
|
def booking_service
|
88
|
-
return unless platform_name && !platform_name.empty?
|
106
|
+
return unless (platform_name && !platform_name.empty?) || (test_suite_certificate_url && !test_suite_certificate_url.empty?)
|
107
|
+
|
108
|
+
booking_service = OpenActive::Models::BookingService.new()
|
109
|
+
|
110
|
+
if (platform_name_val = platform_name)
|
111
|
+
booking_service.name = platform_name_val
|
112
|
+
end
|
113
|
+
|
114
|
+
if (platform_url_val = platform_url)
|
115
|
+
booking_service.url = platform_url_val
|
116
|
+
end
|
117
|
+
|
118
|
+
if (platform_software_version_val = platform_software_version)
|
119
|
+
booking_service.software_version = platform_software_version_val
|
120
|
+
end
|
89
121
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
122
|
+
if (has_credential_val = test_suite_certificate_url)
|
123
|
+
booking_service.has_credential = has_credential_val
|
124
|
+
end
|
125
|
+
|
126
|
+
booking_service
|
127
|
+
end
|
128
|
+
|
129
|
+
def access_service
|
130
|
+
return unless open_booking_api_base_url && !open_booking_api_base_url.empty?
|
131
|
+
|
132
|
+
access_service = OpenActive::Models::WebAPI.new(
|
133
|
+
name: 'Open Booking API',
|
134
|
+
description: webapi_description,
|
135
|
+
documentation: "https://permalink.openactive.io/dataset-site/open-booking-api-documentation",
|
136
|
+
endpoint_url: open_booking_api_base_url,
|
137
|
+
conforms_to: ["https://openactive.io/open-booking-api/EditorsDraft/"],
|
138
|
+
endpoint_description: "https://www.openactive.io/open-booking-api/EditorsDraft/swagger.json",
|
139
|
+
landing_page: open_booking_api_registration_url
|
94
140
|
)
|
141
|
+
|
142
|
+
if (open_booking_api_documentation_url_val = open_booking_api_documentation_url)
|
143
|
+
access_service.documentation = open_booking_api_documentation_url_val
|
144
|
+
end
|
145
|
+
|
146
|
+
if (open_booking_api_authentication_authority_url_val = open_booking_api_authentication_authority_url)
|
147
|
+
access_service.authentication_authority = open_booking_api_authentication_authority_url_val
|
148
|
+
end
|
149
|
+
|
150
|
+
if (open_booking_api_terms_service_url_val = open_booking_api_terms_service_url)
|
151
|
+
access_service.terms_of_service = open_booking_api_terms_service_url_val
|
152
|
+
end
|
153
|
+
|
154
|
+
access_service
|
95
155
|
end
|
96
156
|
|
97
157
|
def to_dataset # rubocop:disable Metrics/MethodLength
|
@@ -99,11 +159,11 @@ module OpenActive
|
|
99
159
|
id: dataset_site_url,
|
100
160
|
url: dataset_site_url,
|
101
161
|
name: name,
|
102
|
-
description:
|
162
|
+
description: dataset_description,
|
103
163
|
keywords: keywords,
|
104
164
|
license: "https://creativecommons.org/licenses/by/4.0/",
|
105
165
|
discussion_url: dataset_discussion_url,
|
106
|
-
documentation:
|
166
|
+
documentation: "https://permalink.openactive.io/dataset-site/open-data-documentation",
|
107
167
|
in_language: dataset_languages,
|
108
168
|
schema_version: "https://www.openactive.io/modelling-opportunity-data/2.0/",
|
109
169
|
publisher: OpenActive::Models::Organization.new(
|
@@ -124,10 +184,18 @@ module OpenActive
|
|
124
184
|
date_published: date_first_published,
|
125
185
|
)
|
126
186
|
|
187
|
+
if (dataset_documentation_url_val = dataset_documentation_url)
|
188
|
+
dataset.documentation = dataset_documentation_url_val
|
189
|
+
end
|
190
|
+
|
127
191
|
if (booking_service_val = booking_service)
|
128
192
|
dataset.booking_service = booking_service_val
|
129
193
|
end
|
130
194
|
|
195
|
+
if (access_service_val = access_service)
|
196
|
+
dataset.access_service = access_service_val
|
197
|
+
end
|
198
|
+
|
131
199
|
dataset
|
132
200
|
end
|
133
201
|
end
|
@@ -3,22 +3,32 @@ require 'mustache'
|
|
3
3
|
module OpenActive
|
4
4
|
module DatasetSite
|
5
5
|
class TemplateRenderer < Mustache
|
6
|
-
|
6
|
+
attr_reader :settings
|
7
7
|
|
8
|
-
def initialize(settings)
|
8
|
+
def initialize(settings, static_assets_path_url = nil)
|
9
9
|
@settings = settings
|
10
|
+
if static_assets_path_url.nil? then
|
11
|
+
@template_file = "#{__dir__}/datasetsite.mustache"
|
12
|
+
else
|
13
|
+
@template_file = "#{__dir__}/datasetsite-csp.mustache"
|
14
|
+
@static_assets_path_url = static_assets_path_url.chomp("/")
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
18
|
def dataset
|
13
|
-
return
|
19
|
+
return settings if settings.is_a?(OpenActive::Models::Dataset)
|
14
20
|
|
15
|
-
@dataset ||=
|
21
|
+
@dataset ||= settings.to_dataset
|
16
22
|
end
|
17
23
|
|
18
|
-
def
|
24
|
+
def jsonld
|
19
25
|
dataset.to_json(schema: true, pretty: true)
|
20
26
|
end
|
21
27
|
|
28
|
+
def staticAssetsPathUrl
|
29
|
+
@static_assets_path_url
|
30
|
+
end
|
31
|
+
|
22
32
|
def method_missing(orig_method_name, *args)
|
23
33
|
method_name = orig_method_name.to_s.underscore
|
24
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openactive-dataset_site
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenActive Community
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mustache
|
@@ -129,20 +129,31 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".github/workflows/create-dataset-site-template-pr.yaml"
|
133
|
+
- ".github/workflows/release.yaml"
|
134
|
+
- ".github/workflows/tests.yaml"
|
132
135
|
- ".gitignore"
|
133
136
|
- ".rubocop.yml"
|
134
137
|
- Gemfile
|
135
138
|
- LICENSE
|
136
139
|
- Makefile
|
137
140
|
- README.md
|
141
|
+
- Rakefile
|
138
142
|
- bin/console
|
139
143
|
- bin/setup
|
144
|
+
- examples/basic_csp_example_with_booking.rb
|
140
145
|
- examples/basic_example.rb
|
146
|
+
- examples/basic_example_with_booking.rb
|
147
|
+
- examples/basic_example_with_booking_minimal.rb
|
148
|
+
- examples/dataset_csp_example_with_booking.rb
|
141
149
|
- examples/dataset_example.rb
|
150
|
+
- examples/dataset_example_with_booking.rb
|
142
151
|
- examples/dataset_patch.rb
|
143
152
|
- examples/specific_feed_override_example.rb
|
144
153
|
- examples/specific_feed_override_example2.rb
|
145
154
|
- lib/openactive/dataset_site.rb
|
155
|
+
- lib/openactive/dataset_site/datasetsite-csp.mustache
|
156
|
+
- lib/openactive/dataset_site/datasetsite-csp.static.zip
|
146
157
|
- lib/openactive/dataset_site/datasetsite.mustache
|
147
158
|
- lib/openactive/dataset_site/feed_type.rb
|
148
159
|
- lib/openactive/dataset_site/meta.rb
|
@@ -169,8 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
180
|
- !ruby/object:Gem::Version
|
170
181
|
version: '0'
|
171
182
|
requirements: []
|
172
|
-
|
173
|
-
rubygems_version: 2.5.2
|
183
|
+
rubygems_version: 3.1.6
|
174
184
|
signing_key:
|
175
185
|
specification_version: 4
|
176
186
|
summary: Simplifies creation of dataset sites using templates.
|