class WMATA::Client
Public Class Methods
new(api_key)
click to toggle source
# File lib/client.rb, line 7 def initialize(api_key) @options = {query: {api_key: api_key} } end
Public Instance Methods
next_trains(stations='A06')
click to toggle source
# File lib/client.rb, line 11 def next_trains(stations='A06') response = self.class.get("/StationPrediction.svc/json/GetPrediction/#{stations}", @options) JSON.parse(response.body)["Trains"] end
train_incidents()
click to toggle source
# File lib/client.rb, line 29 def train_incidents response = self.class.get("/Incidents.svc/json/Incidents", @options) JSON.parse(response.body)["Incidents"] end
train_path(from,to)
click to toggle source
# File lib/client.rb, line 22 def train_path(from,to) @options[:query][:FromStationCode] = from @options[:query][:ToStationCode] = to response = self.class.get("/Rail.svc/json/jPath", @options) JSON.parse(response.body)["Path"] end
train_stations(line='RD', formated=true)
click to toggle source
# File lib/client.rb, line 16 def train_stations(line='RD', formated=true) @options[:query][:LineCode]=line response = self.class.get("/Rail.svc/json/jStations", @options) JSON.parse(response.body)["Stations"] end