# Data call and parsing into xml hash array
http = Net::HTTP.new($uri.host, $uri.port)
request = Net::HTTP::Get.new($xml_url)
response = http.request(request)
$xml = response.body
$doc = Document.new $xml
** VIEW PAGE **
<%=
$doc.each do |item|
puts "{storeID}=#{item}"
end
%>
The $doc object is a nested hash with store locations that each have
other characteristics. Currently the parameters only pull the StoreID
and name. So the loop will need to pull each StoreID, then name, then
repeat loop. I am going to be building the loop around an HTML table,
but that would be extra credit if someone wants to take it on.
If you want to iterate over each nested hash - it totally depends on the depth of the hash and the kind of view you’re trying to build using it. If you dont have knowledge about the other keys that come in the hash, use this pattern.
h = { "a" => 100, "b" => 200 }
h.each {|key, value| puts "#{key} is #{value}" }