Permalink
Browse files

first passing test! can return bus data now

  • Loading branch information...
1 parent 61811f7 commit 6f76180078b69405361ae1b51b84a8f9b6402582 @joannecheng committed Sep 2, 2011
Showing with 10 additions and 12 deletions.
  1. +1 −0 lib/septa-ruby.rb
  2. +6 −10 lib/septa/bus.rb
  3. BIN septa-ruby-0.0.1.gem
  4. +2 −1 septa-ruby.gemspec
  5. +1 −1 test/septa_spec.rb
View
@@ -2,5 +2,6 @@
module Septa
VERSION = '1.0.0'
+ extend Bus
end
View
@@ -1,16 +1,12 @@
require 'resourceful'
+require 'json'
module Septa
- class Bus
- @septa_url = 'http://:www3.septa.org/transitview/bus_route_data/'
-
- def initialize(bus_number)
- @bus_number = bus_number
- end
-
- def get_positions
- resp = Resourceful.get(@septa_url+@bus_number)
- puts resp.body
+ module Bus
+ def get_bus_data(bus_number)
+ septa_url = 'http://www3.septa.org/transitview/bus_route_data/'+bus_number.to_s
+ resp = Resourceful.get(septa_url)
+ JSON.parse(resp.body)
end
end
end
View
Binary file not shown.
View
@@ -20,7 +20,8 @@ Gem::Specification.new do |s|
# s.add_development_dependency "another", "= 0.9"
# The list of files to be contained in the gem
- s.files = `git ls-files`.split("\n")
+ #s.files = `git ls-files`.split("\n")
+ s.files = ['lib/septa-ruby.rb', 'lib/septa/bus.rb']
# s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
# s.extensions = `git ls-files ext/extconf.rb`.split("\n")
View
@@ -2,7 +2,7 @@
describe 'SEPTA' do
it 'should return septa data' do
- Septa::Bus(42).should_not be nil
+ Septa.get_bus_data(42).should_not be nil
end
end

0 comments on commit 6f76180

Please sign in to comment.