Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
SEPTA: moved into consolidated Transit namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
mattr555 committed Oct 11, 2014
1 parent b0a52ce commit b53ec1a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions lib/DDG/Spice/SEPTA.pm → lib/DDG/Spice/Transit/SEPTA.pm
@@ -1,4 +1,4 @@
package DDG::Spice::SEPTA;
package DDG::Spice::Transit::SEPTA;

use DDG::Spice;
use YAML qw ( Load );
Expand All @@ -8,7 +8,7 @@ secondary_example_queries "train times to paoli from Villanova";
description "Lookup the next SEPTA train going your way";
name "SEPTA";
source "SEPTA";
code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/SEPTA.pm";
code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Transit/SEPTA.pm";
topics "everyday";
category "time_sensitive";
attribution web => [ 'https://www.duckduckgo.com', 'DuckDuckGo' ],
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
(function(env){
"use strict";
env.ddg_spice_septa = function(api_result){
env.ddg_spice_transit_septa = function(api_result){

if (!api_result ||
api_result.length < 1 ||
Expand All @@ -10,11 +10,11 @@
return Spice.failed('septa');
}

var script = $("[src*='js/spice/septa/']")[0],
var script = $("[src*='js/spice/transit/septa/']")[0],
source = decodeURI($(script).attr("src")),
parts = source.split('/'),
from = parts[4],
to = parts[5],
from = parts[5],
to = parts[6],
now = timeInMins(new Date().toTimeString());

Spice.add({
Expand Down Expand Up @@ -49,7 +49,7 @@
detail: false,
item_detail: false,
options: {
content: Spice.septa.train_item
content: Spice.transit_septa.train_item
}
},
sort_fields: {
Expand Down
18 changes: 9 additions & 9 deletions t/SEPTA.t
Expand Up @@ -12,36 +12,36 @@ my %queries = (

my %tests = map {(
"next train from $_ to $queries{$_}" => test_spice(
'/js/spice/septa/'
'/js/spice/transit/septa/'
. (join '%20', map { ucfirst } split /\s+/, $_)
. '/'
. (join '%20', map { ucfirst } split /\s+/, $queries{$_}),
call_type => 'include',
caller => 'DDG::Spice::SEPTA'
caller => 'DDG::Spice::Transit::SEPTA'
),
"next train to $_ from $queries{$_}" => test_spice(
'/js/spice/septa/'
'/js/spice/transit/septa/'
. (join '%20', map { ucfirst } split /\s+/, $queries{$_})
. '/'
. (join '%20', map { ucfirst } split /\s+/, $_),
call_type => 'include',
caller => 'DDG::Spice::SEPTA'
caller => 'DDG::Spice::Transit::SEPTA'
),
)} keys %queries;

ddg_spice_test(
[qw( DDG::Spice::SEPTA )],
[qw( DDG::Spice::Transit::SEPTA )],
(
%tests,
'septa thorndale to 30th' => test_spice( #test station guessing
'/js/spice/septa/Thorndale/30th%20Street%20Station',
'/js/spice/transit/septa/Thorndale/30th%20Street%20Station',
call_type => 'include',
caller => 'DDG::Spice::SEPTA'
caller => 'DDG::Spice::Transit::SEPTA'
),
'septa drexel to 49th street' => test_spice(
'/js/spice/septa/University%20City/49th%20St',
'/js/spice/transit/septa/University%20City/49th%20St',
call_type => 'include',
caller => 'DDG::Spice::SEPTA'
caller => 'DDG::Spice::Transit::SEPTA'
),
'next train from a station that doesnt exist to another' => undef,
'septa blahblah from villanova to paoli' => undef,
Expand Down

0 comments on commit b53ec1a

Please sign in to comment.