Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby gem for public HRT bus location data
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples README, example image
lib Reorder changelog
spec adds syntax
vcr_cassettes Haversine logic for Rider#distance_to_bus
.rspec Initial commit Reorder changelog
Gemfile Initial commit
LICENSE.txt README, example image
Rakefile Initial commit
hrt_bus.gemspec Revert "Update Gemspec homepage and description"


Ruby gem for real-time Hampton Roads Transit bus location data


gem install hrt_bus


A Bus as a Ruby ActiveModel object => "20", :direction => "inbound").bus

  attr_accessor :direction = "inbound",
  attr_accessor :id = "2021",
  attr_accessor :lat = "36.8597919",
  attr_accessor :lon = "-76.2845680",
  attr_accessor :route_id = "20",
  attr_accessor :time = Sat, 03 Mar 2012 23:24:28 +0000,

Is my bus late? => "20", :direction => "inbound").bus.late?

Send yourself a SMS or Tweet when your bus is close!

(1..15).each do |i|

  rider =  => "2",
                             :direction => "inbound",
                             :lat       => "36.870347",
                             :lon       => "-76.301163" )

  if rider.bus.present? && rider.distance_to_bus <= 3
    # Do something really cool like send a SMS or Tweet!

  sleep 30


Generate a static Google Map for a bus => "15", :direction => "outbound").bus.static_map


A collection of HRT buses as JSON



Contributing to hrt_bus

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.


Copyright (c) Brian Douglas Smith. See LICENSE.txt for further details.

Something went wrong with that request. Please try again.