Module: NDBC::StationTable

Included in:
Station
Defined in:
lib/ndbc/station_table.rb

Class Method Summary collapse

Class Method Details

.station_table_dataObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ndbc/station_table.rb', line 4

def station_table_data
  response = Connection.new.get(NDBC.config[:urls][:station_table])
  rows = response.split("\n").drop(2)
  rows.map do |station|
    station_parts = cleanup_parts!(station.split('|'))

    {
      id:         station_parts[0],
      owner:      station_parts[1],
      type:       station_parts[2],
      hull:       station_parts[3],
      name:       station_parts[4],
      payload:    station_parts[5],
      location:   extract_location(station_parts[6]),
      time_zone:  station_parts[7],
      forecast:   station_parts[8],
      note:       station_parts[9],
      active:     active?(station_parts),
      tide_station_id: tide_station_id(station_parts[4])
    }
  end
end