Class: DragonsDream::RailwayInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/dragons_dream/railwayinfo.rb

Instance Method Summary collapse

Constructor Details

#initializeRailwayInfo

Returns a new instance of RailwayInfo.



4
5
6
# File 'lib/dragons_dream/railwayinfo.rb', line 4

def initialize
  @baseUrl  = "http://express.heartrails.com/api/json"
end

Instance Method Details

#stations_list(line) ⇒ Array

Returns the list of stations information with given line.

Parameters:

  • line (String)

    name of Railway Route.

Returns:

  • (Array)

    the list of stations information with given line.



10
11
12
13
14
15
# File 'lib/dragons_dream/railwayinfo.rb', line 10

def stations_list(line)
  get_line(line)["station"]
rescue
  raise ArgumentError, "line must not be nil" if line.nil?
  raise
end