class Bmtc::BusStop
Attributes
id[R]
latitude[R]
longitude[R]
name[R]
Public Class Methods
buses_in_stop(id)
click to toggle source
# File lib/bmtc/bus_stop.rb, line 16 def self.buses_in_stop(id) options = { 'stopID' => id } JSON.parse(Bmtc.post_request('/itsstopwise/details', options)) end
nearest_stop(latitude, longitude, radius = 2)
click to toggle source
# File lib/bmtc/bus_stop.rb, line 23 def self.nearest_stop(latitude, longitude, radius = 2) Bmtc.get("/busstops/stopnearby/lat/#{latitude}/lon/#{longitude}/rad/#{radius}") end
new(options = {})
click to toggle source
# File lib/bmtc/bus_stop.rb, line 4 def initialize(options = {}) @id = options['StopId'] @name = options['StopName'] @latitude = options['StopLat'] @longitude = options['StopLong'] end
search(query)
click to toggle source
# File lib/bmtc/bus_stop.rb, line 11 def self.search(query) list = JSON.parse Bmtc.get("/busstops/stopsearch/name/#{query}").body list.map { |stop| BMTC::BusStop.new(stop) } end