openactive-dataset_site 0.2.0 → 6.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/create-dataset-site-template-pr.yaml +63 -0
- data/.github/workflows/tests.yaml +40 -0
- data/README.md +73 -26
- data/examples/basic_csp_example_with_booking.rb +41 -0
- data/examples/basic_example.rb +2 -2
- data/examples/basic_example_with_booking.rb +42 -0
- data/examples/basic_example_with_booking_minimal.rb +35 -0
- data/examples/dataset_csp_example_with_booking.rb +93 -0
- data/examples/dataset_example.rb +7 -2
- data/examples/dataset_example_with_booking.rb +93 -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 +61 -16
- data/lib/openactive/dataset_site/template_renderer.rb +12 -4
- data/lib/openactive/dataset_site/version.rb +1 -1
- metadata +10 -2
@@ -43,7 +43,11 @@ module OpenActive
|
|
43
43
|
attr_accessor :open_booking_api_documentation_url
|
44
44
|
attr_accessor :open_booking_api_terms_service_url
|
45
45
|
attr_accessor :open_booking_api_registration_url
|
46
|
-
attr_accessor :
|
46
|
+
attr_accessor :open_booking_api_authentication_authority_url
|
47
|
+
|
48
|
+
# **** TEST SUITE CERTIFICATE ****
|
49
|
+
|
50
|
+
attr_accessor :test_suite_certificate_url
|
47
51
|
|
48
52
|
def data_feed_descriptions
|
49
53
|
data_feed_types.map do |description|
|
@@ -70,12 +74,18 @@ module OpenActive
|
|
70
74
|
]
|
71
75
|
end
|
72
76
|
|
73
|
-
def
|
77
|
+
def dataset_description
|
74
78
|
"Near real-time availability and rich descriptions relating to the "\
|
75
79
|
"#{data_feed_descriptions_sentence} available from "\
|
76
80
|
"#{organisation_name}"
|
77
81
|
end
|
78
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
|
+
|
79
89
|
# @return [OpenActive::Models::DataDownload] A DataDownload object.
|
80
90
|
def data_download(feed_type)
|
81
91
|
OpenActive::Models::DataDownload.new(
|
@@ -93,27 +103,55 @@ module OpenActive
|
|
93
103
|
|
94
104
|
# @return [OpenActive::Models::BookingService, nil]
|
95
105
|
def booking_service
|
96
|
-
return unless platform_name && !platform_name.empty?
|
106
|
+
return unless (platform_name && !platform_name.empty?) || (test_suite_certificate_url && !test_suite_certificate_url.empty?)
|
97
107
|
|
98
|
-
OpenActive::Models::BookingService.new(
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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
|
121
|
+
|
122
|
+
if (has_credential_val = test_suite_certificate_url)
|
123
|
+
booking_service.has_credential = has_credential_val
|
124
|
+
end
|
125
|
+
|
126
|
+
booking_service
|
103
127
|
end
|
104
128
|
|
105
129
|
def access_service
|
106
|
-
|
130
|
+
return unless open_booking_api_base_url && !open_booking_api_base_url.empty?
|
131
|
+
|
132
|
+
access_service = OpenActive::Models::WebAPI.new(
|
107
133
|
name: 'Open Booking API',
|
108
|
-
description:
|
109
|
-
documentation:
|
110
|
-
terms_of_service: open_booking_api_terms_service_url,
|
134
|
+
description: webapi_description,
|
135
|
+
documentation: "https://permalink.openactive.io/dataset-site/open-booking-api-documentation",
|
111
136
|
endpoint_url: open_booking_api_base_url,
|
112
|
-
authentication_authority: open_booking_api_authentication_authority,
|
113
137
|
conforms_to: ["https://openactive.io/open-booking-api/EditorsDraft/"],
|
114
138
|
endpoint_description: "https://www.openactive.io/open-booking-api/EditorsDraft/swagger.json",
|
115
139
|
landing_page: open_booking_api_registration_url
|
116
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
|
117
155
|
end
|
118
156
|
|
119
157
|
def to_dataset # rubocop:disable Metrics/MethodLength
|
@@ -121,11 +159,11 @@ module OpenActive
|
|
121
159
|
id: dataset_site_url,
|
122
160
|
url: dataset_site_url,
|
123
161
|
name: name,
|
124
|
-
description:
|
162
|
+
description: dataset_description,
|
125
163
|
keywords: keywords,
|
126
164
|
license: "https://creativecommons.org/licenses/by/4.0/",
|
127
165
|
discussion_url: dataset_discussion_url,
|
128
|
-
documentation:
|
166
|
+
documentation: "https://permalink.openactive.io/dataset-site/open-data-documentation",
|
129
167
|
in_language: dataset_languages,
|
130
168
|
schema_version: "https://www.openactive.io/modelling-opportunity-data/2.0/",
|
131
169
|
publisher: OpenActive::Models::Organization.new(
|
@@ -144,13 +182,20 @@ module OpenActive
|
|
144
182
|
),
|
145
183
|
distribution: data_downloads,
|
146
184
|
date_published: date_first_published,
|
147
|
-
access_service: access_service,
|
148
185
|
)
|
149
186
|
|
187
|
+
if (dataset_documentation_url_val = dataset_documentation_url)
|
188
|
+
dataset.documentation = dataset_documentation_url_val
|
189
|
+
end
|
190
|
+
|
150
191
|
if (booking_service_val = booking_service)
|
151
192
|
dataset.booking_service = booking_service_val
|
152
193
|
end
|
153
194
|
|
195
|
+
if (access_service_val = access_service)
|
196
|
+
dataset.access_service = access_service_val
|
197
|
+
end
|
198
|
+
|
154
199
|
dataset
|
155
200
|
end
|
156
201
|
end
|
@@ -5,10 +5,14 @@ module OpenActive
|
|
5
5
|
class TemplateRenderer < Mustache
|
6
6
|
attr_reader :settings
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
def initialize(settings)
|
8
|
+
def initialize(settings, static_assets_path_url = nil)
|
11
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
|
12
16
|
end
|
13
17
|
|
14
18
|
def dataset
|
@@ -17,10 +21,14 @@ module OpenActive
|
|
17
21
|
@dataset ||= settings.to_dataset
|
18
22
|
end
|
19
23
|
|
20
|
-
def
|
24
|
+
def jsonld
|
21
25
|
dataset.to_json(schema: true, pretty: true)
|
22
26
|
end
|
23
27
|
|
28
|
+
def staticAssetsPathUrl
|
29
|
+
@static_assets_path_url
|
30
|
+
end
|
31
|
+
|
24
32
|
def method_missing(orig_method_name, *args)
|
25
33
|
method_name = orig_method_name.to_s.underscore
|
26
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.2
|
4
|
+
version: 6.0.2
|
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,6 +129,7 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".github/workflows/create-dataset-site-template-pr.yaml"
|
132
133
|
- ".github/workflows/release.yaml"
|
133
134
|
- ".github/workflows/tests.yaml"
|
134
135
|
- ".gitignore"
|
@@ -140,12 +141,19 @@ files:
|
|
140
141
|
- Rakefile
|
141
142
|
- bin/console
|
142
143
|
- bin/setup
|
144
|
+
- examples/basic_csp_example_with_booking.rb
|
143
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
|
144
149
|
- examples/dataset_example.rb
|
150
|
+
- examples/dataset_example_with_booking.rb
|
145
151
|
- examples/dataset_patch.rb
|
146
152
|
- examples/specific_feed_override_example.rb
|
147
153
|
- examples/specific_feed_override_example2.rb
|
148
154
|
- lib/openactive/dataset_site.rb
|
155
|
+
- lib/openactive/dataset_site/datasetsite-csp.mustache
|
156
|
+
- lib/openactive/dataset_site/datasetsite-csp.static.zip
|
149
157
|
- lib/openactive/dataset_site/datasetsite.mustache
|
150
158
|
- lib/openactive/dataset_site/feed_type.rb
|
151
159
|
- lib/openactive/dataset_site/meta.rb
|