Sha256: f0e6457f59ea725cd090e34d990e2148945d5290f3861b8d19142cc9090429e3

Contents?: true

Size: 804 Bytes

Versions: 16

Compression:

Stored size: 804 Bytes

Contents

# frozen_string_literal: true
module Geoblacklight
  class WmsLayer
    def initialize(params)
      @params = params.to_h.merge(Settings.WMS_PARAMS)
      @response = Geoblacklight::FeatureInfoResponse.new(request_response)
    end

    def url
      @params['URL']
    end

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

    def feature_info
      @response.check
    end

    def request_response
      conn = Faraday.new(url: url)
      conn.get do |request|
        request.params = search_params
        request.options.timeout = Settings.TIMEOUT_WMS
        request.options.open_timeout = Settings.TIMEOUT_WMS
      end
    rescue Faraday::ConnectionFailed, Faraday::TimeoutError => error
      Geoblacklight.logger.error error.inspect
      { error: error.inspect }
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
geoblacklight-3.8.1 lib/geoblacklight/wms_layer.rb
geoblacklight-3.8.0 lib/geoblacklight/wms_layer.rb
geoblacklight-4.0.0 lib/geoblacklight/wms_layer.rb
geoblacklight-4.0.0.pre.rc3 lib/geoblacklight/wms_layer.rb
geoblacklight-3.7.0 lib/geoblacklight/wms_layer.rb
geoblacklight-4.0.0.pre.rc2 lib/geoblacklight/wms_layer.rb
geoblacklight-4.0.0.pre.rc1 lib/geoblacklight/wms_layer.rb
geoblacklight-3.6.0 lib/geoblacklight/wms_layer.rb
geoblacklight-3.5.0 lib/geoblacklight/wms_layer.rb
geoblacklight-4.0.0.pre.alpha.3 lib/geoblacklight/wms_layer.rb
geoblacklight-4.0.0.pre.alpha.2 lib/geoblacklight/wms_layer.rb
geoblacklight-4.0.0.pre.alpha.1 lib/geoblacklight/wms_layer.rb
geoblacklight-4.0.0.pre.alpha lib/geoblacklight/wms_layer.rb
geoblacklight-3.4.0 lib/geoblacklight/wms_layer.rb
geoblacklight-3.3.1 lib/geoblacklight/wms_layer.rb
geoblacklight-3.3.0 lib/geoblacklight/wms_layer.rb