bbc-radio-names 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ae07d3a046271886666167da2d96711e68053bd2
4
+ data.tar.gz: 1ce2a9e960aff7655c75448f907190116d338dd6
5
+ SHA512:
6
+ metadata.gz: b07f19eed15cfee62f6f2c32006975ced0653ae30fc131f9e7df3da6ea6921c0511837d90401f95fc52082782eedb0f45a512aff043de3d45918473aa191d9b7
7
+ data.tar.gz: 1a1802b224bedb7c295e8b001535b0ccd9561c02b831b178ad36bc8847dd63369e38f62c62cad7fed96e66c83b8385ebcfac490702f5fb7993fdc47e875c140f
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bbc-radio-names.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Max Lehmann
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # BBC Network Names
2
+
3
+ This gem was created to aid in the testing of the BBC Radio websites, but it is made available to all who might find uses for it.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'bbc-radio-names'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install bbc-radio-names
20
+
21
+ ## Usage
22
+
23
+ ### List all networks
24
+ ```ruby
25
+ BbcRadioNames.list_networks
26
+ ```
27
+ Returns an array of the official names of all the BBC networks.
28
+
29
+ ### Look up a network key
30
+ ```ruby
31
+ BbcRadioNames.get_network_key('BBC Radio Kent')
32
+ ```
33
+ Returns the BBC ID of the network supplied, in this example "bbc_radio_kent"
34
+
35
+ ### Look up a network ID
36
+ ```ruby
37
+ BbcRadioNames.get_network_id('BBC Radio Kent')
38
+ ```
39
+ Returns the BBC ID of the network supplied, in this example "radiokent"
40
+
41
+ ### Get a random network name
42
+ ```ruby
43
+ BbcRadioNames.random_network_name('nationals')
44
+ ```
45
+ Returns a network name of the specified type. Options are 'nationals', 'nations' or 'locals'. If no argument is supplied it will randomise the type it returns.
46
+
47
+ ## Development
48
+
49
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
+
51
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
52
+
53
+
54
+ ## License
55
+
56
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
57
+
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
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bbc-radio-names/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'bbc-radio-names'
8
+ spec.version = BbcRadioNames::VERSION
9
+ spec.authors = ['BBC Sounds']
10
+ spec.email = ['anthony.kaluuma@bbc.co.uk']
11
+
12
+ spec.summary = 'A gem for working with BBC Radio Networks'
13
+ spec.description = 'A gem for working with BBC Radio Networks, this gem exposes network names, IDs and url keys and is intended as a single, up to date, source of truth.'
14
+ spec.homepage = 'https://github.com/bbc/bbc-radio-names'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.required_ruby_version = '>= 1.9.3'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.10'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec', '~> 3.0'
27
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bbc-radio-names"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ # Version number for the current BbcNetworkNames module
2
+ module BbcRadioNames
3
+ VERSION = '1.0.0'
4
+ end
@@ -0,0 +1,274 @@
1
+ require 'bbc-radio-names/version'
2
+
3
+ # Access to BBC Radio network names and information
4
+ module BbcRadioNames
5
+ NATIONALS = {
6
+ 'BBC Radio 1' => {
7
+ bbc_key: 'radio1',
8
+ bbc_id: 'bbc_radio_one'
9
+ },
10
+ 'BBC Radio 1Xtra' => {
11
+ bbc_key: '1xtra',
12
+ bbc_id: 'bbc_1xtra'
13
+ },
14
+ 'BBC Radio 2' => {
15
+ bbc_key: 'radio2',
16
+ bbc_id: 'bbc_radio_two'
17
+ },
18
+ 'BBC Radio 3' => {
19
+ bbc_key: 'radio3',
20
+ bbc_id: 'bbc_radio_three'
21
+ },
22
+ 'BBC Radio 4' => {
23
+ bbc_key: 'radio4',
24
+ bbc_id: 'bbc_radio_four'
25
+ },
26
+ 'BBC Radio 4 Extra' => {
27
+ bbc_key: 'radio4extra',
28
+ bbc_id: 'bbc_radio_four_extra'
29
+ },
30
+ 'BBC Radio 5 Live' => {
31
+ bbc_key: '5live',
32
+ bbc_id: 'bbc_radio_five_live'
33
+ },
34
+ 'BBC Radio 5 Live Sports Extra' => {
35
+ bbc_key: '5livesportsextra',
36
+ bbc_id: 'bbc_radio_five_live_sports_extra'
37
+ },
38
+ 'BBC Radio 6 Music' => {
39
+ bbc_key: '6music',
40
+ bbc_id: 'bbc_6music'
41
+ },
42
+ 'BBC Asian Network' => {
43
+ bbc_key: 'asiannetwork',
44
+ bbc_id: 'bbc_asian_network'
45
+ },
46
+ 'BBC World Service' => {
47
+ bbc_key: 'worldserviceradio',
48
+ bbc_id: 'bbc_world_service'
49
+ }
50
+ }
51
+
52
+ NATIONS = {
53
+ 'BBC Radio Scotland' => {
54
+ bbc_key: 'radioscotland',
55
+ bbc_id: 'bbc_radio_scotland'
56
+ },
57
+ 'BBC Radio Nan Gaidheal' => {
58
+ bbc_key: 'radionangaidheal',
59
+ bbc_id: 'bbc_radio_nan_gaidheal'
60
+ },
61
+ 'BBC Radio Ulster' => {
62
+ bbc_key: 'radioulster',
63
+ bbc_id: 'bbc_radio_ulster'
64
+ },
65
+ 'BBC Radio Foyle' => {
66
+ bbc_key: 'radiofoyle',
67
+ bbc_id: 'bbc_radio_foyle'
68
+ },
69
+ 'BBC Radio Wales' => {
70
+ bbc_key: 'radiowales',
71
+ bbc_id: 'bbc_radio_wales'
72
+ },
73
+ 'BBC Radio Cymru' => {
74
+ bbc_key: 'radiocymru',
75
+ bbc_id: 'bbc_radio_cymru'
76
+ }
77
+ }
78
+
79
+ LOCALS = {
80
+ 'BBC Radio Berkshire' => {
81
+ bbc_key: 'radioberkshire',
82
+ bbc_id: 'bbc_radio_berkshire'
83
+ },
84
+ 'BBC Radio Bristol' => {
85
+ bbc_key: 'radiobristol',
86
+ bbc_id: 'bbc_radio_bristol'
87
+ },
88
+ 'BBC Radio Cambridgeshire' => {
89
+ bbc_key: 'radiocambridgeshire',
90
+ bbc_id: 'bbc_radio_cambridge'
91
+ },
92
+ 'BBC Radio Cornwall' => {
93
+ bbc_key: 'radiocornwall',
94
+ bbc_id: 'bbc_radio_cornwall'
95
+ },
96
+ 'BBC Coventry & Warwickshire' => {
97
+ bbc_key: 'bbccoventryandwarwickshire',
98
+ bbc_id: 'bbc_radio_coventry_warwickshire'
99
+ },
100
+ 'BBC Radio Cumbria' => {
101
+ bbc_key: 'radiocumbria',
102
+ bbc_id: 'bbc_radio_cumbria'
103
+ },
104
+ 'BBC Radio Derby' => {
105
+ bbc_key: 'radioderby',
106
+ bbc_id: 'bbc_radio_derby'
107
+ },
108
+ 'BBC Radio Devon' => {
109
+ bbc_key: 'radiodevon',
110
+ bbc_id: 'bbc_radio_devon'
111
+ },
112
+ 'BBC Essex' => {
113
+ bbc_key: 'bbcessex',
114
+ bbc_id: 'bbc_radio_essex'
115
+ },
116
+ 'BBC Radio Gloucestershire' => {
117
+ bbc_key: 'radiogloucestershire',
118
+ bbc_id: 'bbc_radio_gloucestershire'
119
+ },
120
+ 'BBC Radio Guernsey' => {
121
+ bbc_key: 'radioguernsey',
122
+ bbc_id: 'bbc_radio_guernsey'
123
+ },
124
+ 'BBC Hereford & Worcester' => {
125
+ bbc_key: 'bbcherefordandworcester',
126
+ bbc_id: 'bbc_radio_hereford_worcester'
127
+ },
128
+ 'BBC Radio Humberside' => {
129
+ bbc_key: 'radiohumberside',
130
+ bbc_id: 'bbc_radio_humberside'
131
+ },
132
+ 'BBC Radio Jersey' => {
133
+ bbc_key: 'radiojersey',
134
+ bbc_id: 'bbc_radio_jersey'
135
+ },
136
+ 'BBC Radio Kent' => {
137
+ bbc_key: 'radiokent',
138
+ bbc_id: 'bbc_radio_kent'
139
+ },
140
+ 'BBC Radio Lancashire' => {
141
+ bbc_key: 'radiolancashire',
142
+ bbc_id: 'bbc_radio_lancashire'
143
+ },
144
+ 'BBC Radio Leeds' => {
145
+ bbc_key: 'radioleeds',
146
+ bbc_id: 'bbc_radio_leeds'
147
+ },
148
+ 'BBC Radio Leicester' => {
149
+ bbc_key: 'radioleicester',
150
+ bbc_id: 'bbc_radio_leicester'
151
+ },
152
+ 'BBC Radio Lincolnshire' => {
153
+ bbc_key: 'radiolincolnshire',
154
+ bbc_id: 'bbc_radio_lincolnshire'
155
+ },
156
+ 'BBC Radio London' => {
157
+ bbc_key: 'radiolondon',
158
+ bbc_id: 'bbc_london'
159
+ },
160
+ 'BBC Radio Manchester' => {
161
+ bbc_key: 'radiomanchester',
162
+ bbc_id: 'bbc_radio_manchester'
163
+ },
164
+ 'BBC Radio Merseyside' => {
165
+ bbc_key: 'radiomerseyside',
166
+ bbc_id: 'bbc_radio_merseyside'
167
+ },
168
+ 'BBC Newcastle' => {
169
+ bbc_key: 'bbcnewcastle',
170
+ bbc_id: 'bbc_radio_newcastle'
171
+ },
172
+ 'BBC Radio Norfolk' => {
173
+ bbc_key: 'radionorfolk',
174
+ bbc_id: 'bbc_radio_norfolk'
175
+ },
176
+ 'BBC Radio Northampton' => {
177
+ bbc_key: 'radionorthampton',
178
+ bbc_id: 'bbc_radio_northampton'
179
+ },
180
+ 'BBC Radio Nottingham' => {
181
+ bbc_key: 'radionottingham',
182
+ bbc_id: 'bbc_radio_nottingham'
183
+ },
184
+ 'BBC Radio Oxford' => {
185
+ bbc_key: 'radiooxford',
186
+ bbc_id: 'bbc_radio_oxford'
187
+ },
188
+ 'BBC Radio Sheffield' => {
189
+ bbc_key: 'radiosheffield',
190
+ bbc_id: 'bbc_radio_sheffield'
191
+ },
192
+ 'BBC Radio Shropshire' => {
193
+ bbc_key: 'radioshropshire',
194
+ bbc_id: 'bbc_radio_shropshire'
195
+ },
196
+ 'BBC Radio Solent' => {
197
+ bbc_key: 'radiosolent',
198
+ bbc_id: 'bbc_radio_solent'
199
+ },
200
+ 'BBC Somerset' => {
201
+ bbc_key: 'bbcsomerset',
202
+ bbc_id: 'bbc_radio_somerset_sound'
203
+ },
204
+ 'BBC Radio Stoke' => {
205
+ bbc_key: 'radiostoke',
206
+ bbc_id: 'bbc_radio_stoke'
207
+ },
208
+ 'BBC Radio Suffolk' => {
209
+ bbc_key: 'radiosuffolk',
210
+ bbc_id: 'bbc_radio_suffolk'
211
+ },
212
+ 'BBC Surrey' => {
213
+ bbc_key: 'bbcsurrey',
214
+ bbc_id: 'bbc_radio_surrey'
215
+ },
216
+ 'BBC Sussex' => {
217
+ bbc_key: 'bbcsussex',
218
+ bbc_id: 'bbc_radio_sussex'
219
+ },
220
+ 'BBC Tees' => {
221
+ bbc_key: 'bbctees',
222
+ bbc_id: 'bbc_tees'
223
+ },
224
+ 'BBC Three Counties Radio' => {
225
+ bbc_key: 'threecountiesradio',
226
+ bbc_id: 'bbc_three_counties_radio'
227
+ },
228
+ 'BBC Wiltshire' => {
229
+ bbc_key: 'bbcwiltshire',
230
+ bbc_id: 'bbc_radio_wiltshire'
231
+ },
232
+ 'BBC WM 95.6' => {
233
+ bbc_key: 'wm',
234
+ bbc_id: 'bbc_wm'
235
+ },
236
+ 'BBC Radio York' => {
237
+ bbc_key: 'radioyork',
238
+ bbc_id: 'bbc_radio_york'
239
+ }
240
+ }
241
+
242
+ ALL_NETWORKS = NATIONALS.merge(NATIONS).merge(LOCALS)
243
+
244
+ NETWORK_TYPES = {
245
+ 'nationals' => NATIONALS,
246
+ 'nations' => NATIONS,
247
+ 'locals' => LOCALS
248
+ }
249
+
250
+ # Looks up a network key by network name
251
+ def self.get_network_key(network_name)
252
+ ALL_NETWORKS[network_name][:bbc_key]
253
+ end
254
+
255
+ # Looks up a network ID by network name
256
+ def self.get_network_id(network_name)
257
+ ALL_NETWORKS[network_name][:bbc_id]
258
+ end
259
+
260
+ # Returns an array of all networks' user friendly names
261
+ def self.list_networks
262
+ ALL_NETWORKS.keys
263
+ end
264
+
265
+ # Returns a random network name
266
+ def self.random_network_name(type = 'all_networks')
267
+ if type == 'all_networks'
268
+ network_type = NETWORK_TYPES.keys.sample
269
+ NETWORK_TYPES[network_type].keys.sample
270
+ else
271
+ NETWORK_TYPES[type].keys.sample
272
+ end
273
+ end
274
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bbc-radio-names
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - BBC Sounds
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: A gem for working with BBC Radio Networks, this gem exposes network names,
56
+ IDs and url keys and is intended as a single, up to date, source of truth.
57
+ email:
58
+ - anthony.kaluuma@bbc.co.uk
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - bbc-radio-names.gemspec
68
+ - bin/console
69
+ - bin/setup
70
+ - lib/bbc-radio-names.rb
71
+ - lib/bbc-radio-names/version.rb
72
+ homepage: https://github.com/bbc/bbc-radio-names
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 1.9.3
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.6.12
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: A gem for working with BBC Radio Networks
96
+ test_files: []