Sha256: 09cede3944f4f1b001934b354378545915567156bb23df02a40d80470eeab35b

Contents?: true

Size: 765 Bytes

Versions: 14

Compression:

Stored size: 765 Bytes

Contents

require 'nokogiri'
require 'geoblacklight/wms_layer/feature_info_response'
class WmsLayer

  def initialize(params)
    @params = params.merge(Settings.WMS_PARAMS)
    @response = FeatureInfoResponse.new(request_response)
  end

  def url
    @params['URL']
  end

  def search_params
    @params.except('URL')
  end

  def get_feature_info
    @response.check
  end

  def request_response
    begin
      conn = Faraday.new(url: url)
      conn.get do |request|
        request.params = search_params
        request.options = {
          timeout: 2,
          open_timeout: 2
        }
      end
    rescue Faraday::Error::ConnectionFailed => error
      { error: error }
    rescue Faraday::Error::TimeoutError => error
      { error: error }
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
geoblacklight-0.3.3 lib/geoblacklight/wms_layer.rb
geoblacklight-0.3.2 lib/geoblacklight/wms_layer.rb
geoblacklight-0.3.1 lib/geoblacklight/wms_layer.rb
geoblacklight-0.3.0 lib/geoblacklight/wms_layer.rb
geoblacklight-0.2.2 lib/geoblacklight/wms_layer.rb
geoblacklight-0.2.1 lib/geoblacklight/wms_layer.rb
geoblacklight-0.2.0 lib/geoblacklight/wms_layer.rb
geoblacklight-0.1.0 lib/geoblacklight/wms_layer.rb
geoblacklight-0.0.8 lib/geoblacklight/wms_layer.rb
geoblacklight-0.0.7 lib/geoblacklight/wms_layer.rb
geoblacklight-0.0.6 lib/geoblacklight/wms_layer.rb
geoblacklight-0.0.5 lib/geoblacklight/wms_layer.rb
geoblacklight-0.0.4 lib/geoblacklight/wms_layer.rb
geoblacklight-0.0.3 lib/geoblacklight/wms_layer.rb