Module: Weese::Bus::RequiresRoute
Overview
These requests require a Route
Instance Method Summary collapse
-
#incidents(route = nil) ⇒ Hash
Reported bus incidents/delays for a given route.
-
#path(route, date = nil) ⇒ Hash
For an optional given date, returns the set of ordered latitude/longitude points along a route variant along with the list of stops served.
-
#positions(route = nil, radius_at_coordinates = nil) ⇒ Hash
JSON Response.
-
#route_schedule(route, including_variations, date = nil) ⇒ Hash
Schedules for a given route variant for an optional given date.
Methods included from Requests::Requester
Instance Method Details
#incidents(route = nil) ⇒ Hash
Reported bus incidents/delays for a given route. WMATA Documentation
532 533 534 535 536 537 538 539 540 541 542 543 544 |
# File 'lib/weese/bus/route.rb', line 532 def incidents(route = nil) query = {} query['Route'] = route if route fetch( Requests::Request.new( @api_key, Bus::Urls::INCIDENTS, query ) ) end |
#path(route, date = nil) ⇒ Hash
For an optional given date, returns the set of ordered latitude/longitude points along a route variant along with the list of stops served. WMATA Documentation
558 559 560 561 562 563 564 565 566 567 568 569 570 |
# File 'lib/weese/bus/route.rb', line 558 def path(route, date = nil) query = { 'RouteID': route } query['Date'] = date.to_s if date fetch( Requests::Request.new( @api_key, Bus::Urls::PATH_DETAILS, query ) ) end |
#positions(route = nil, radius_at_coordinates = nil) ⇒ Hash
Returns JSON Response.
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/weese/bus/route.rb', line 506 def positions(route = nil, radius_at_coordinates = nil) query = {} query['Route'] = route if route query.update(radius_at_coordinates.to_h) if radius_at_coordinates fetch( Requests::Request.new( @api_key, Bus::Urls::POSITIONS, query ) ) end |
#route_schedule(route, including_variations, date = nil) ⇒ Hash
Date: Omit date for current date
Variations: Whether or not to include variations if a base route is specified in Route. For example, if B30 is specified and IncludingVariations is set to true, data for all variations of B30 such as B30v1, B30v2, etc. will be returned.
Schedules for a given route variant for an optional given date. https://developer.wmata.com/docs/services/54763629281d83086473f231/operations/5476362a281d830c946a3d6b
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
# File 'lib/weese/bus/route.rb', line 587 def route_schedule(route, including_variations, date = nil) query = { 'RouteID': route } query['IncludingVariations'] = including_variations if including_variations query['Date'] = date.to_s if date fetch( Requests::Request.new( @api_key, Bus::Urls::ROUTE_SCHEDULE, query ) ) end |