Sha256: 91548ac72050001909d8a9ef62d64fadaccc93452c714cc19b97193c4689ad29
Contents?: true
Size: 660 Bytes
Versions: 19
Compression:
Stored size: 660 Bytes
Contents
module Geoblacklight class FeatureInfoResponse def initialize(response) @response = response end def check if error? @response else format end end def format page = Nokogiri::HTML(@response.body) table_values = { values: [] } page.css('th').each do |th| table_values[:values].push([th.text]) end page.css('td').each_with_index do |td, index| table_values[:values][index].push(td.text) end table_values end def error? @response[:error] || @response.headers['content-type'].slice(0, 9) == 'text/xml' end end end
Version data entries
19 entries across 19 versions & 1 rubygems