mirror of
https://github.com/danbee/tube-status-server
synced 2025-03-04 08:39:12 +00:00
Add mapping for weekend line names.
This commit is contained in:
parent
6b96a8a73c
commit
f93dc44949
@ -41,8 +41,10 @@ class Tubestatus < Sinatra::Base
|
||||
messages = []
|
||||
end
|
||||
|
||||
{ :id => line["Name"].first.downcase.gsub(/ (&)?/, ""),
|
||||
:name => line["Name"].first,
|
||||
name = weekend_line_mapping(line["Name"].first)
|
||||
|
||||
{ :id => name.downcase.gsub(/[^a-z]+/, "-"),
|
||||
:name => name,
|
||||
:status => line["Status"].first["Text"].first.downcase,
|
||||
:messages => messages }
|
||||
end
|
||||
@ -50,4 +52,10 @@ class Tubestatus < Sinatra::Base
|
||||
content_type :json
|
||||
JSON data
|
||||
end
|
||||
|
||||
def weekend_line_mapping(name)
|
||||
mapping = { 'H\'smith & City' => 'Hammersmith and City',
|
||||
'Waterloo & City' => 'Waterloo and City' }
|
||||
mapping[name] || name
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user