module Weese::Rail::RequiresStation

These requests require a Station

Public Instance Methods

elevator_and_escalator_incidents(station = nil) click to toggle source

List of reported elevator and escalator outages at a given station. {developer.wmata.com/docs/services/54763641281d83086473f232/operations/54763641281d830c946a3d76 WMATA Documentation}

@param [String] station A station code

@raise [WeeseError] If request or JSON parse fails

@return [Hash] JSON Response

# File lib/weese/rail/station.rb, line 145
def elevator_and_escalator_incidents(station = nil)
  query = station ? { StationCode: station } : {}

  fetch(
    Requests::Request.new(
      @api_key,
      Rail::Urls::ELEVATOR_AND_ESCALATOR_INCIDENTS,
      query
    )
  )
end
incidents(station = nil) click to toggle source

Reported rail incidents (significant disruptions and delays to normal service) {developer.wmata.com/docs/services/54763641281d83086473f232/operations/54763641281d830c946a3d77 WMATA Documentation}

@param [String] station A station code

@raise [WeeseError] If request or JSON parse fails

@return [Hash] JSON Response

# File lib/weese/rail/station.rb, line 167
def incidents(station = nil)
  query = station ? { StationCode: station } : {}

  fetch(
    Requests::Request.new(
      @api_key,
      Rail::Urls::INCIDENTS,
      query
    )
  )
end
next_trains(station) click to toggle source

Next train arrivals for the given station. {developer.wmata.com/docs/services/547636a6f9182302184cda78/operations/547636a6f918230da855363f WMATA Documentation}

@param [String] station A station code

@raise [WeeseError] If request or JSON parse fails

@return [Hash] JSON Response

# File lib/weese/rail/station.rb, line 189
def next_trains(station)
  fetch(
    Requests::Request.new(
      @api_key,
      [Rail::Urls::NEXT_TRAINS, station].join('/'),
      {}
    )
  )
end
parking_information(station) click to toggle source

Parking information for the given station. {developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe330d WMATA Documentation}

@param [String] station A station code

@raise [WeeseError] If request or JSON parse fails

@return [Hash] JSON Response

# File lib/weese/rail/station.rb, line 229
def parking_information(station)
  fetch(
    Requests::Request.new(
      @api_key,
      Rail::Urls::PARKING_INFORMATION,
      StationCode: station
    )
  )
end
path_from(station, to_destination_station) click to toggle source

Stations and distances between two stations on the same line. {developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe330e WMATA Documentation}

@param [String] station Starting station code @param [String] to_destination_station Destination station code

@raise [WeeseError] If request or JSON parse fails

@return [Hash] JSON Response

# File lib/weese/rail/station.rb, line 250
def path_from(station, to_destination_station)
  fetch(
    Requests::Request.new(
      @api_key,
      Rail::Urls::PATH,
      FromStationCode: station,
      ToStationCode: to_destination_station
    )
  )
end
station_information(station) click to toggle source

Location and address information at the given station. {developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe3310 WMATA Documentation}

@param [String] station A station code

@raise [WeeseError] If request or JSON parse fails

@return [Hash] JSON Response

# File lib/weese/rail/station.rb, line 209
def station_information(station)
  fetch(
    Requests::Request.new(
      @api_key,
      Rail::Urls::INFORMATION,
      StationCode: station
    )
  )
end
station_to_station(from_station = nil, to_destination_station = nil) click to toggle source

Distance, fare information, and estimated travel time between any two stations, including those on different lines. {developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe3313 WMATA Documentation}

@param [String] from_station Station code to start trip at. Optional. @param [String] to_destination_station Destination station code. Optional.

@raise [WeeseError] If request or JSON parse fails

@return [Hash] JSON Response

# File lib/weese/rail/station.rb, line 119
def station_to_station(from_station = nil, to_destination_station = nil)
  query = {}

  query['FromStationCode'] = from_station if from_station

  query['ToStationCode'] = to_destination_station if to_destination_station

  fetch(
    Requests::Request.new(
      @api_key,
      Rail::Urls::STATION_TO_STATION,
      query
    )
  )
end
timings(station) click to toggle source

Opening and scheduled first/last train times for the given station. {developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe3312 WMATA Documentation}

@param [String] station A station code

@raise [WeeseError] If request or JSON parse fails

@return [Hash] JSON Response

# File lib/weese/rail/station.rb, line 271
def timings(station)
  fetch(
    Requests::Request.new(
      @api_key,
      Rail::Urls::TIMINGS,
      StationCode: station
    )
  )
end