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 = []
|
messages = []
|
||||||
end
|
end
|
||||||
|
|
||||||
{ :id => line["Name"].first.downcase.gsub(/ (&)?/, ""),
|
name = weekend_line_mapping(line["Name"].first)
|
||||||
:name => line["Name"].first,
|
|
||||||
|
{ :id => name.downcase.gsub(/[^a-z]+/, "-"),
|
||||||
|
:name => name,
|
||||||
:status => line["Status"].first["Text"].first.downcase,
|
:status => line["Status"].first["Text"].first.downcase,
|
||||||
:messages => messages }
|
:messages => messages }
|
||||||
end
|
end
|
||||||
@ -50,4 +52,10 @@ class Tubestatus < Sinatra::Base
|
|||||||
content_type :json
|
content_type :json
|
||||||
JSON data
|
JSON data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def weekend_line_mapping(name)
|
||||||
|
mapping = { 'H\'smith & City' => 'Hammersmith and City',
|
||||||
|
'Waterloo & City' => 'Waterloo and City' }
|
||||||
|
mapping[name] || name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user