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.
@@ -1,32 +1,33 @@
1
1
  require "ttc_feed/version"
2
2
  require "ttc_feed/zurl"
3
3
 
4
- module TtcUrls
5
- def self.base
6
- Zurl.new("http://webservices.nextbus.com/service/publicXMLFeed")
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 self.route_list
10
- base.command("routeList").a("ttc").to_s
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 self.route_config(route_tag)
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 self.predictions(stop_id, route_tag)
21
- base.stopId(stop_id).r(route_tag).a("ttc").to_s
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 self.vehicle_locations(route_tag, last_timestamp = nil)
26
- url = base.command("vehicleLocations").a("ttc").r(route_tag)
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
 
@@ -1,3 +1,3 @@
1
1
  module TtcFeed
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-24 00:00:00.000000000 Z
12
+ date: 2012-01-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70136355075420 !ruby/object:Gem::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: *70136355075420
24
+ version_requirements: *70197634059860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: faraday
27
- requirement: &70136355074920 !ruby/object:Gem::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: *70136355074920
35
+ version_requirements: *70197634058860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nokogiri
38
- requirement: &70136355512920 !ruby/object:Gem::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: *70136355512920
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