Class: Devinci::Bixi

Inherits:
Base
  • Object
show all
Defined in:
lib/devinci/bixi.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#filename, #options

Instance Method Summary collapse

Methods inherited from Base

#downloaded_on, #initialize, #io

Constructor Details

This class inherits a constructor from Devinci::Base

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



3
4
5
# File 'lib/devinci/bixi.rb', line 3

def document
  @document
end

Instance Method Details

#parseObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/devinci/bixi.rb', line 5

def parse
  @document = Nokogiri::XML(io)

  @document.xpath('/stations/station').map do |node|
    parse_station(node)
  end
rescue Exception => e
  raise Devinci::ParseError, "Error parsing the input from XML: #{e.message}", e.backtrace
ensure
  io.close
end