openactive-dataset_site 0.1.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 27bda3050fa7bc5b745fe5f70a05bccd414031dc
4
- data.tar.gz: 67d724394a705936913b5cbcddcf18ef1b34146a
2
+ SHA256:
3
+ metadata.gz: d2902c20149703083193d00af98941fdc09b9441f3fdf4bfc0f92d659c1c8610
4
+ data.tar.gz: 0e78849b3f6839f78dca7d14b30c58c641c4a4e4a6c25874f7cc2778b5b663bc
5
5
  SHA512:
6
- metadata.gz: ae03e4c8ef2033020fb154a9d0987a6b656007276c489632596cae4d81548780b44ac1fcfbe2db228a168176578f2bb9454187ec2d2bbf983acd0ce8668bb048
7
- data.tar.gz: 1078436fecde29e78b4ae0d77fb8892908278c57ad62f36050521348984c61c576a9dae043a10fa1549a729d088e6a22adae93b9e6569724eb794c90edddba3a
6
+ metadata.gz: 783a20e7737802746b0f0a9b18a2778e2976d3c2005f12cda49e3bead00dcec6ed245e09769e21b50a2bf2a662f51d820fc229f01cd95fad6dfb26f8ac4bc84c
7
+ data.tar.gz: 45d28ecc9d3cc266811c2f103180e03d39f83de60d097126dce83abf82485c1bebc41841430b450709149e1668280b6bc63ec37ef32fd62e472c7fa83aeb4f83
@@ -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,26 @@
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
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -37,6 +37,14 @@ 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
47
+
40
48
  def data_feed_descriptions
41
49
  data_feed_types.map do |description|
42
50
  description.respond_to?(:display_name) ? description.display_name : description
@@ -94,6 +102,20 @@ module OpenActive
94
102
  )
95
103
  end
96
104
 
105
+ def access_service
106
+ OpenActive::Models::WebAPI.new(
107
+ name: 'Open Booking API',
108
+ description: "API that allows for seamless booking experiences to be created for #{data_feed_descriptions.to_sentence.downcase} available from #{organisation_name}",
109
+ documentation: open_booking_api_documentation_url,
110
+ terms_of_service: open_booking_api_terms_service_url,
111
+ endpoint_url: open_booking_api_base_url,
112
+ authentication_authority: open_booking_api_authentication_authority,
113
+ conforms_to: ["https://openactive.io/open-booking-api/EditorsDraft/"],
114
+ endpoint_description: "https://www.openactive.io/open-booking-api/EditorsDraft/swagger.json",
115
+ landing_page: open_booking_api_registration_url
116
+ )
117
+ end
118
+
97
119
  def to_dataset # rubocop:disable Metrics/MethodLength
98
120
  dataset = OpenActive::Models::Dataset.new(
99
121
  id: dataset_site_url,
@@ -122,6 +144,7 @@ module OpenActive
122
144
  ),
123
145
  distribution: data_downloads,
124
146
  date_published: date_first_published,
147
+ access_service: access_service,
125
148
  )
126
149
 
127
150
  if (booking_service_val = booking_service)
@@ -3,6 +3,8 @@ require 'mustache'
3
3
  module OpenActive
4
4
  module DatasetSite
5
5
  class TemplateRenderer < Mustache
6
+ attr_reader :settings
7
+
6
8
  self.template_file = "#{__dir__}/datasetsite.mustache"
7
9
 
8
10
  def initialize(settings)
@@ -10,9 +12,9 @@ module OpenActive
10
12
  end
11
13
 
12
14
  def dataset
13
- return @settings if @settings.is_a?(OpenActive::Models::Dataset)
15
+ return settings if settings.is_a?(OpenActive::Models::Dataset)
14
16
 
15
- @dataset ||= @settings.to_dataset
17
+ @dataset ||= settings.to_dataset
16
18
  end
17
19
 
18
20
  def json
@@ -1,5 +1,5 @@
1
1
  module OpenActive
2
2
  module DatasetSite
3
- VERSION = "0.1.1".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  end
5
5
  end
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.1
4
+ version: 0.2.0
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-10 00:00:00.000000000 Z
11
+ date: 2021-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mustache
@@ -129,12 +129,15 @@ executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
+ - ".github/workflows/release.yaml"
133
+ - ".github/workflows/tests.yaml"
132
134
  - ".gitignore"
133
135
  - ".rubocop.yml"
134
136
  - Gemfile
135
137
  - LICENSE
136
138
  - Makefile
137
139
  - README.md
140
+ - Rakefile
138
141
  - bin/console
139
142
  - bin/setup
140
143
  - examples/basic_example.rb
@@ -169,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
172
  - !ruby/object:Gem::Version
170
173
  version: '0'
171
174
  requirements: []
172
- rubyforge_project:
173
- rubygems_version: 2.5.2
175
+ rubygems_version: 3.1.6
174
176
  signing_key:
175
177
  specification_version: 4
176
178
  summary: Simplifies creation of dataset sites using templates.