Class: Bmtc::BusStop
- Inherits:
-
Object
- Object
- Bmtc::BusStop
- Defined in:
- lib/bmtc/bus_stop.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
- .buses_in_stop(id) ⇒ Object
- .nearest_stop(latitude, longitude, radius = 2) ⇒ Object
- .search(query) ⇒ Object
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ BusStop
constructor
A new instance of BusStop.
Constructor Details
#initialize(options = {}) ⇒ BusStop
Returns a new instance of BusStop.
4 5 6 7 8 9 |
# File 'lib/bmtc/bus_stop.rb', line 4 def initialize( = {}) @id = ['StopId'] @name = ['StopName'] @latitude = ['StopLat'] @longitude = ['StopLong'] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/bmtc/bus_stop.rb', line 3 def id @id end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
3 4 5 |
# File 'lib/bmtc/bus_stop.rb', line 3 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
3 4 5 |
# File 'lib/bmtc/bus_stop.rb', line 3 def longitude @longitude end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/bmtc/bus_stop.rb', line 3 def name @name end |
Class Method Details
.buses_in_stop(id) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/bmtc/bus_stop.rb', line 16 def self.buses_in_stop(id) = { 'stopID' => id } JSON.parse(Bmtc.post_request('/itsstopwise/details', )) end |
.nearest_stop(latitude, longitude, radius = 2) ⇒ Object
23 24 25 |
# 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 |