Class: Wasserstand::Provider::WaterwayMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/wasserstand/provider/waterway_mapper.rb

Overview

<gewaesser>

  <name>BODENSEE</name>
  <item>
    <no>8</no>
    <psmgr>320</psmgr>
    <pegelname>KONSTANZ</pegelname>
    <messwert>380,7</messwert>
    <km>0</km>
    <pnp>391,89</pnp>
    <tendenz>Gleich</tendenz>
    <datum>13.09.2012</datum>
    <uhrzeit>20:00:00</uhrzeit>
    <pegelnummer>0906</pegelnummer>
  </item>
</gewaesser>

Class Method Summary collapse

Class Method Details

.map(node) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/wasserstand/provider/waterway_mapper.rb', line 22

def map(node)
  Waterway.new(node.xpath('name').text).tap do |ww|
    node.xpath('item').each do |item|
      level = LevelMapper.map(item)
      level.waterway = ww
      ww.levels[level.name] = level
    end
  end
end