Module: Bort::Station

Defined in:
lib/bort/station.rb

Defined Under Namespace

Classes: Station

Class Method Summary collapse

Class Method Details

.access_info(station, print_legend = false) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/bort/station.rb', line 63

def self.access_info(station, print_legend=false)

  download_options = {
    :action => 'stn',
    :cmd => 'stnaccess',
    :orig => station,
    :l => print_legend ? '1' : '0',
  }

  xml = Util.download(download_options)
  data = Hpricot(xml)

  puts (data/:legend).inner_text if print_legend
  Station.parse((data/:station).first)
end

.info(abbreviation) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/bort/station.rb', line 79

def self.info(abbreviation)
  download_options = {
    :action => 'stn',
    :cmd => 'stninfo',
    :orig => abbreviation,
  }

  xml = Util.download(download_options)
  data = Hpricot(xml)

  Station.parse((data/:station).first)
end

.stationsObject



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/bort/station.rb', line 92

def self.stations

  download_options = {
    :action => 'stn',
    :cmd => 'stns',
  }

  xml = Util.download(download_options)
  data = Hpricot(xml)

  (data/:station).map{|station| Station.parse(station)}
end