Class: OpenAustralia::XmlGetter

Inherits:
Object
  • Object
show all
Defined in:
lib/openaustralia/api.rb

Overview

XmlGetter is a dependency for fetching a URL and parsing it as XML. We’re using a separate dependency so we can inject a different one for unit testing

Instance Method Summary collapse

Instance Method Details

#fetch(url) ⇒ Object

fetch the specified URL and parse into a REXML document



241
242
243
244
245
# File 'lib/openaustralia/api.rb', line 241

def fetch(url)
  open(url) do |f|
    return REXML::Document.new f
  end
end