openactive-dataset_site 0.1.0 → 0.1.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 +4 -4
- data/README.md +134 -0
- data/examples/{example.rb → basic_example.rb} +0 -0
- data/examples/dataset_example.rb +74 -0
- data/examples/dataset_patch.rb +37 -0
- data/examples/specific_feed_override_example.rb +44 -0
- data/examples/specific_feed_override_example2.rb +46 -0
- data/lib/openactive/dataset_site/meta.rb +1 -1
- data/lib/openactive/dataset_site/settings.rb +29 -14
- data/lib/openactive/dataset_site/template_renderer.rb +1 -1
- data/lib/openactive/dataset_site/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27bda3050fa7bc5b745fe5f70a05bccd414031dc
|
|
4
|
+
data.tar.gz: 67d724394a705936913b5cbcddcf18ef1b34146a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae03e4c8ef2033020fb154a9d0987a6b656007276c489632596cae4d81548780b44ac1fcfbe2db228a168176578f2bb9454187ec2d2bbf983acd0ce8668bb048
|
|
7
|
+
data.tar.gz: 1078436fecde29e78b4ae0d77fb8892908278c57ad62f36050521348984c61c576a9dae043a10fa1549a729d088e6a22adae93b9e6569724eb794c90edddba3a
|
data/README.md
CHANGED
|
@@ -62,6 +62,140 @@ settings = OpenActive::DatasetSite::Settings.new(
|
|
|
62
62
|
)
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
|
|
66
|
+
### Feed-level customisation
|
|
67
|
+
If you need to do feed specific overrides, then you may do this by overriding the method.
|
|
68
|
+
```ruby
|
|
69
|
+
settings = Class.new(OpenActive::DatasetSite::Settings) do
|
|
70
|
+
def data_download(feed_type)
|
|
71
|
+
val = super(feed_type)
|
|
72
|
+
|
|
73
|
+
case feed_type
|
|
74
|
+
when OpenActive::DatasetSite::FeedType::SESSION_SERIES
|
|
75
|
+
val.content_url = open_data_feed_base_url + "session_series"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
val
|
|
79
|
+
end
|
|
80
|
+
end.new(
|
|
81
|
+
data_feed_types: [
|
|
82
|
+
OpenActive::DatasetSite::FeedType::FACILITY_USE,
|
|
83
|
+
OpenActive::DatasetSite::FeedType::SCHEDULED_SESSION,
|
|
84
|
+
OpenActive::DatasetSite::FeedType::SESSION_SERIES,
|
|
85
|
+
OpenActive::DatasetSite::FeedType::SLOT,
|
|
86
|
+
],
|
|
87
|
+
# rest of your settings here.
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
To match the PHP/.NET usage, you may alternatively use this approach, however it's less advised as there are more details to get right (and it risks a mismatch between the downloads and the advertised feed types):
|
|
92
|
+
```ruby
|
|
93
|
+
settings = OpenActive::DatasetSite::Settings.new(
|
|
94
|
+
# your settings here,
|
|
95
|
+
data_feed_types: [
|
|
96
|
+
OpenActive::DatasetSite::FeedType::SESSION_SERIES,
|
|
97
|
+
],
|
|
98
|
+
data_downloads: [
|
|
99
|
+
OpenActive::Models::DataDownload.new(
|
|
100
|
+
name: "SessionSeries",
|
|
101
|
+
additional_type: "https://openactive.io/SessionSeries",
|
|
102
|
+
encoding_format: OpenActive::DatasetSite::Meta.RPDE_MEDIA_TYPE,
|
|
103
|
+
content_url: open_data_feed_base_url + "session-series",
|
|
104
|
+
)
|
|
105
|
+
]
|
|
106
|
+
)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Dataset
|
|
110
|
+
```ruby
|
|
111
|
+
dataset = OpenActive::Models::Dataset.new(
|
|
112
|
+
id: "http://example.com/dataset/",
|
|
113
|
+
description:
|
|
114
|
+
"Near real-time availability and rich descriptions relating to the facilities and sessions available from Simpleweb",
|
|
115
|
+
url: "http://example.com/dataset/",
|
|
116
|
+
dateModified: "2019-12-09T15:36:15+00:00",
|
|
117
|
+
keywords:
|
|
118
|
+
["Facilities",
|
|
119
|
+
"Sessions",
|
|
120
|
+
"Activities",
|
|
121
|
+
"Sports",
|
|
122
|
+
"Physical Activity",
|
|
123
|
+
"OpenActive"],
|
|
124
|
+
schemaVersion: "https://www.openactive.io/modelling-opportunity-data/2.0/",
|
|
125
|
+
license: "https://creativecommons.org/licenses/by/4.0/",
|
|
126
|
+
publisher:
|
|
127
|
+
OpenActive::Models::Organization.new(
|
|
128
|
+
name: "Simpleweb",
|
|
129
|
+
description:
|
|
130
|
+
"Simpleweb is a purpose driven software company that specialises in new technologies, product development, and human interaction.",
|
|
131
|
+
url: "https://www.simpleweb.co.uk/",
|
|
132
|
+
legalName: "Simpleweb Ltd",
|
|
133
|
+
logo:
|
|
134
|
+
OpenActive::Models::ImageObject.new(
|
|
135
|
+
url:
|
|
136
|
+
"https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
|
|
137
|
+
),
|
|
138
|
+
email: "spam@simpleweb.co.uk",
|
|
139
|
+
),
|
|
140
|
+
discussionUrl: "https://github.com/simpleweb/sw-oa-php-test-site",
|
|
141
|
+
datePublished: "2019-11-05T00:00:00+00:00",
|
|
142
|
+
inLanguage: ["en-GB"],
|
|
143
|
+
distribution:
|
|
144
|
+
[OpenActive::Models::DataDownload.new(
|
|
145
|
+
name: "FacilityUse",
|
|
146
|
+
additionalType: "https://openactive.io/FacilityUse",
|
|
147
|
+
encodingFormat: "application/vnd.openactive.rpde+json; version=1",
|
|
148
|
+
contentUrl: "http://example.com/feed/facility-uses",
|
|
149
|
+
),
|
|
150
|
+
OpenActive::Models::DataDownload.new(
|
|
151
|
+
name: "ScheduledSession",
|
|
152
|
+
additionalType: "https://openactive.io/ScheduledSession",
|
|
153
|
+
encodingFormat: "application/vnd.openactive.rpde+json; version=1",
|
|
154
|
+
contentUrl: "http://example.com/feed/scheduled-sessions",
|
|
155
|
+
),
|
|
156
|
+
OpenActive::Models::DataDownload.new(
|
|
157
|
+
name: "SessionSeries",
|
|
158
|
+
additionalType: "https://openactive.io/SessionSeries",
|
|
159
|
+
encodingFormat: "application/vnd.openactive.rpde+json; version=1",
|
|
160
|
+
contentUrl: "http://example.com/feed/session_series",
|
|
161
|
+
),
|
|
162
|
+
OpenActive::Models::DataDownload.new(
|
|
163
|
+
name: "Slot",
|
|
164
|
+
additionalType: "https://openactive.io/Slot",
|
|
165
|
+
encodingFormat: "application/vnd.openactive.rpde+json; version=1",
|
|
166
|
+
contentUrl: "http://example.com/feed/slots",
|
|
167
|
+
)],
|
|
168
|
+
backgroundImage:
|
|
169
|
+
OpenActive::Models::ImageObject.new(
|
|
170
|
+
url:
|
|
171
|
+
"https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
|
|
172
|
+
),
|
|
173
|
+
documentation: "https://developer.openactive.io/",
|
|
174
|
+
name: "Simpleweb Facilities and Sessions",
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(dataset)
|
|
178
|
+
|
|
179
|
+
puts renderer.render
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Dataset patching
|
|
183
|
+
The dataset generation should already be good for most purposes, if needing to change just a couple of fields then
|
|
184
|
+
you may be better of patching just those fields.
|
|
185
|
+
```ruby
|
|
186
|
+
settings = OpenActive::DatasetSite::Settings.new(
|
|
187
|
+
# your settings here
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
dataset = settings.to_dataset
|
|
191
|
+
|
|
192
|
+
dataset.description = "Some better non-generated description here."
|
|
193
|
+
|
|
194
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(dataset)
|
|
195
|
+
|
|
196
|
+
puts renderer.render
|
|
197
|
+
```
|
|
198
|
+
|
|
65
199
|
### API
|
|
66
200
|
|
|
67
201
|
#### OpenActive::DatasetSite::Settings
|
|
File without changes
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
description:
|
|
9
|
+
"Near real-time availability and rich descriptions relating to the facilities and sessions available from Simpleweb",
|
|
10
|
+
url: "http://example.com/dataset/",
|
|
11
|
+
date_modified: "2019-12-09T15:36:15+00:00",
|
|
12
|
+
keywords:
|
|
13
|
+
["Facilities",
|
|
14
|
+
"Sessions",
|
|
15
|
+
"Activities",
|
|
16
|
+
"Sports",
|
|
17
|
+
"Physical Activity",
|
|
18
|
+
"OpenActive"],
|
|
19
|
+
schema_version: "https://www.openactive.io/modelling-opportunity-data/2.0/",
|
|
20
|
+
license: "https://creativecommons.org/licenses/by/4.0/",
|
|
21
|
+
publisher:
|
|
22
|
+
OpenActive::Models::Organization.new(
|
|
23
|
+
name: "Simpleweb",
|
|
24
|
+
description:
|
|
25
|
+
"Simpleweb is a purpose driven software company that specialises in new technologies, product development, and human interaction.",
|
|
26
|
+
url: "https://www.simpleweb.co.uk/",
|
|
27
|
+
legalName: "Simpleweb Ltd",
|
|
28
|
+
logo:
|
|
29
|
+
OpenActive::Models::ImageObject.new(
|
|
30
|
+
url:
|
|
31
|
+
"https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
|
|
32
|
+
),
|
|
33
|
+
email: "spam@simpleweb.co.uk",
|
|
34
|
+
),
|
|
35
|
+
discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
|
|
36
|
+
date_published: "2019-11-05T00:00:00+00:00",
|
|
37
|
+
in_language: ["en-GB"],
|
|
38
|
+
distribution:
|
|
39
|
+
[OpenActive::Models::DataDownload.new(
|
|
40
|
+
name: "FacilityUse",
|
|
41
|
+
additional_type: "https://openactive.io/FacilityUse",
|
|
42
|
+
encoding_format: "application/vnd.openactive.rpde+json; version=1",
|
|
43
|
+
content_url: "http://example.com/feed/facility-uses",
|
|
44
|
+
),
|
|
45
|
+
OpenActive::Models::DataDownload.new(
|
|
46
|
+
name: "ScheduledSession",
|
|
47
|
+
additional_type: "https://openactive.io/ScheduledSession",
|
|
48
|
+
encoding_format: "application/vnd.openactive.rpde+json; version=1",
|
|
49
|
+
content_url: "http://example.com/feed/scheduled-sessions",
|
|
50
|
+
),
|
|
51
|
+
OpenActive::Models::DataDownload.new(
|
|
52
|
+
name: "SessionSeries",
|
|
53
|
+
additional_type: "https://openactive.io/SessionSeries",
|
|
54
|
+
encoding_format: "application/vnd.openactive.rpde+json; version=1",
|
|
55
|
+
content_url: "http://example.com/feed/session_series",
|
|
56
|
+
),
|
|
57
|
+
OpenActive::Models::DataDownload.new(
|
|
58
|
+
name: "Slot",
|
|
59
|
+
additional_type: "https://openactive.io/Slot",
|
|
60
|
+
encoding_format: "application/vnd.openactive.rpde+json; version=1",
|
|
61
|
+
content_url: "http://example.com/feed/slots",
|
|
62
|
+
)],
|
|
63
|
+
background_image:
|
|
64
|
+
OpenActive::Models::ImageObject.new(
|
|
65
|
+
url:
|
|
66
|
+
"https://simpleweb.co.uk/wp-content/uploads/2017/06/IMG_8994-500x500-c-default.jpg",
|
|
67
|
+
),
|
|
68
|
+
documentation: "https://developer.openactive.io/",
|
|
69
|
+
name: "Simpleweb Facilities and Sessions",
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(dataset)
|
|
73
|
+
|
|
74
|
+
puts renderer.render
|
|
@@ -0,0 +1,37 @@
|
|
|
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://developer.openactive.io/",
|
|
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", # remember, remember the fifth of November...
|
|
28
|
+
data_feed_types: feed_types,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
dataset = settings.to_dataset
|
|
32
|
+
|
|
33
|
+
dataset.description = "Some better non-generated description here."
|
|
34
|
+
|
|
35
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(dataset)
|
|
36
|
+
|
|
37
|
+
puts renderer.render
|
|
@@ -0,0 +1,44 @@
|
|
|
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 = Class.new(OpenActive::DatasetSite::Settings) do
|
|
14
|
+
def data_download(feed_type)
|
|
15
|
+
val = super(feed_type)
|
|
16
|
+
|
|
17
|
+
case feed_type
|
|
18
|
+
when OpenActive::DatasetSite::FeedType::SESSION_SERIES
|
|
19
|
+
val.content_url = open_data_feed_base_url + "session_series"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
val
|
|
23
|
+
end
|
|
24
|
+
end.new(
|
|
25
|
+
open_data_feed_base_url: "http://example.com/feed/",
|
|
26
|
+
dataset_site_url: "http://example.com/dataset/",
|
|
27
|
+
dataset_discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
|
|
28
|
+
dataset_documentation_url: "https://developer.openactive.io/",
|
|
29
|
+
dataset_languages: ["en-GB"],
|
|
30
|
+
organisation_name: "Simpleweb",
|
|
31
|
+
organisation_url: "https://www.simpleweb.co.uk/",
|
|
32
|
+
organisation_legal_entity: "Simpleweb Ltd",
|
|
33
|
+
organisation_plain_text_description: "Simpleweb is a purpose driven software company that specialises in new "\
|
|
34
|
+
"technologies, product development, and human interaction.",
|
|
35
|
+
organisation_logo_url: "https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
|
|
36
|
+
organisation_email: "spam@simpleweb.co.uk",
|
|
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...
|
|
39
|
+
data_feed_types: feed_types,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(settings)
|
|
43
|
+
|
|
44
|
+
puts renderer.render
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
class CustomDatasetSettings < OpenActive::DatasetSite::Settings
|
|
14
|
+
def data_download(feed_type)
|
|
15
|
+
val = super(feed_type)
|
|
16
|
+
|
|
17
|
+
case feed_type
|
|
18
|
+
when OpenActive::DatasetSite::FeedType::SESSION_SERIES
|
|
19
|
+
val.content_url = open_data_feed_base_url + "session_series"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
val
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
settings = CustomDatasetSettings.new(
|
|
27
|
+
open_data_feed_base_url: "http://example.com/feed/",
|
|
28
|
+
dataset_site_url: "http://example.com/dataset/",
|
|
29
|
+
dataset_discussion_url: "https://github.com/simpleweb/sw-oa-php-test-site",
|
|
30
|
+
dataset_documentation_url: "https://developer.openactive.io/",
|
|
31
|
+
dataset_languages: ["en-GB"],
|
|
32
|
+
organisation_name: "Simpleweb",
|
|
33
|
+
organisation_url: "https://www.simpleweb.co.uk/",
|
|
34
|
+
organisation_legal_entity: "Simpleweb Ltd",
|
|
35
|
+
organisation_plain_text_description: "Simpleweb is a purpose driven software company that specialises in new "\
|
|
36
|
+
"technologies, product development, and human interaction.",
|
|
37
|
+
organisation_logo_url: "https://simpleweb.co.uk/wp-content/uploads/2015/07/facebook-default.png",
|
|
38
|
+
organisation_email: "spam@simpleweb.co.uk",
|
|
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...
|
|
41
|
+
data_feed_types: feed_types,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
renderer = OpenActive::DatasetSite::TemplateRenderer.new(settings)
|
|
45
|
+
|
|
46
|
+
puts renderer.render
|
|
@@ -2,6 +2,8 @@ module OpenActive
|
|
|
2
2
|
module DatasetSite
|
|
3
3
|
class Settings
|
|
4
4
|
def initialize(**params)
|
|
5
|
+
super()
|
|
6
|
+
|
|
5
7
|
params.each do |k, v|
|
|
6
8
|
setter_method = "#{k}="
|
|
7
9
|
|
|
@@ -33,6 +35,7 @@ module OpenActive
|
|
|
33
35
|
attr_accessor :platform_software_version
|
|
34
36
|
|
|
35
37
|
attr_accessor :data_feed_types
|
|
38
|
+
attr_accessor :data_downloads
|
|
36
39
|
|
|
37
40
|
def data_feed_descriptions
|
|
38
41
|
data_feed_types.map do |description|
|
|
@@ -48,6 +51,7 @@ module OpenActive
|
|
|
48
51
|
data_feed_descriptions.to_sentence.downcase
|
|
49
52
|
end
|
|
50
53
|
|
|
54
|
+
# @return [Array<String>] An array of keywords.
|
|
51
55
|
def keywords
|
|
52
56
|
[
|
|
53
57
|
*data_feed_descriptions,
|
|
@@ -64,15 +68,30 @@ module OpenActive
|
|
|
64
68
|
"#{organisation_name}"
|
|
65
69
|
end
|
|
66
70
|
|
|
71
|
+
# @return [OpenActive::Models::DataDownload] A DataDownload object.
|
|
72
|
+
def data_download(feed_type)
|
|
73
|
+
OpenActive::Models::DataDownload.new(
|
|
74
|
+
name: feed_type.name,
|
|
75
|
+
additional_type: feed_type.same_as,
|
|
76
|
+
encoding_format: OpenActive::DatasetSite::Meta::RPDE_MEDIA_TYPE,
|
|
77
|
+
content_url: open_data_feed_base_url + feed_type.default_feed_path,
|
|
78
|
+
)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# @return [Array<OpenActive::Models::DataDownload>] An array of DataDownload objects.
|
|
67
82
|
def data_downloads
|
|
68
|
-
data_feed_types.map
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
@data_downloads || data_feed_types.map { |feed_type| data_download(feed_type) }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# @return [OpenActive::Models::BookingService, nil]
|
|
87
|
+
def booking_service
|
|
88
|
+
return unless platform_name && !platform_name.empty?
|
|
89
|
+
|
|
90
|
+
OpenActive::Models::BookingService.new(
|
|
91
|
+
name: platform_name,
|
|
92
|
+
url: platform_url,
|
|
93
|
+
software_version: platform_software_version,
|
|
94
|
+
)
|
|
76
95
|
end
|
|
77
96
|
|
|
78
97
|
def to_dataset # rubocop:disable Metrics/MethodLength
|
|
@@ -105,12 +124,8 @@ module OpenActive
|
|
|
105
124
|
date_published: date_first_published,
|
|
106
125
|
)
|
|
107
126
|
|
|
108
|
-
if
|
|
109
|
-
dataset.booking_service =
|
|
110
|
-
name: platform_name,
|
|
111
|
-
url: platform_url,
|
|
112
|
-
software_version: platform_software_version,
|
|
113
|
-
)
|
|
127
|
+
if (booking_service_val = booking_service)
|
|
128
|
+
dataset.booking_service = booking_service_val
|
|
114
129
|
end
|
|
115
130
|
|
|
116
131
|
dataset
|
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: 0.1.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: 2019-12-
|
|
11
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mustache
|
|
@@ -137,7 +137,11 @@ files:
|
|
|
137
137
|
- README.md
|
|
138
138
|
- bin/console
|
|
139
139
|
- bin/setup
|
|
140
|
-
- examples/
|
|
140
|
+
- examples/basic_example.rb
|
|
141
|
+
- examples/dataset_example.rb
|
|
142
|
+
- examples/dataset_patch.rb
|
|
143
|
+
- examples/specific_feed_override_example.rb
|
|
144
|
+
- examples/specific_feed_override_example2.rb
|
|
141
145
|
- lib/openactive/dataset_site.rb
|
|
142
146
|
- lib/openactive/dataset_site/datasetsite.mustache
|
|
143
147
|
- lib/openactive/dataset_site/feed_type.rb
|