ttc_feed 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ttc_feed/ttc_urls.rb +14 -13
- data/lib/ttc_feed/version.rb +1 -1
- data/spec/url_spec.rb +1 -1
- metadata +8 -8
data/lib/ttc_feed/ttc_urls.rb
CHANGED
@@ -1,32 +1,33 @@
|
|
1
1
|
require "ttc_feed/version"
|
2
2
|
require "ttc_feed/zurl"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
class TtcUrls
|
5
|
+
attr_accessor :base
|
6
|
+
|
7
|
+
def initialize(agency_tag = "ttc")
|
8
|
+
@agency_tag = agency_tag
|
9
|
+
@base = Zurl.new("http://webservices.nextbus.com/service/publicXMLFeed")
|
7
10
|
end
|
8
11
|
|
9
|
-
def
|
10
|
-
base.command("routeList").a(
|
12
|
+
def route_list
|
13
|
+
@base.command("routeList").a(@agency_tag).to_s
|
11
14
|
end
|
12
15
|
|
13
16
|
# route_tag = "512"
|
14
|
-
def
|
15
|
-
base.command("routeConfig").a(agency_tag).r(route_tag).to_s
|
17
|
+
def route_config(route_tag)
|
18
|
+
@base.command("routeConfig").a(@agency_tag).r(route_tag).to_s
|
16
19
|
end
|
17
20
|
|
18
21
|
# stop_id = "14935"
|
19
22
|
# route_tag = "512"
|
20
|
-
def
|
21
|
-
base.stopId(stop_id).r(route_tag).a(
|
23
|
+
def predictions(stop_id, route_tag)
|
24
|
+
@base.stopId(stop_id).r(route_tag).a(@agency_tag).to_s
|
22
25
|
end
|
23
26
|
|
24
27
|
# route_tag = "512"
|
25
|
-
def
|
26
|
-
url = base.command("vehicleLocations").a(
|
27
|
-
|
28
|
+
def vehicle_locations(route_tag, last_timestamp = nil)
|
29
|
+
url = @base.command("vehicleLocations").a(@agency_tag).r(route_tag)
|
28
30
|
url = url.t(last_timestamp) if last_timestamp
|
29
|
-
|
30
31
|
url.to_s
|
31
32
|
end
|
32
33
|
|
data/lib/ttc_feed/version.rb
CHANGED
data/spec/url_spec.rb
CHANGED
@@ -2,6 +2,6 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "TtcUrls" do
|
4
4
|
it "should have the proper base url set" do
|
5
|
-
TtcUrls.base.to_s.should == "http://webservices.nextbus.com/service/publicXMLFeed"
|
5
|
+
TtcUrls.new.base.to_s.should == "http://webservices.nextbus.com/service/publicXMLFeed"
|
6
6
|
end
|
7
7
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttc_feed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70197634059860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70197634059860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &70197634058860 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70197634058860
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: nokogiri
|
38
|
-
requirement: &
|
38
|
+
requirement: &70197634058240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70197634058240
|
47
47
|
description: Access some simple metrics provided by the TTC via their open data feed
|
48
48
|
email:
|
49
49
|
- davidwright@gmail.com
|