class Geoblacklight::WmsLayer

Public Class Methods

new(params) click to toggle source
# File lib/geoblacklight/wms_layer.rb, line 4
def initialize(params)
  @params = params.to_h.merge(Settings.WMS_PARAMS)
  @response = Geoblacklight::FeatureInfoResponse.new(request_response)
end

Public Instance Methods

feature_info() click to toggle source
# File lib/geoblacklight/wms_layer.rb, line 17
def feature_info
  @response.check
end
request_response() click to toggle source
# File lib/geoblacklight/wms_layer.rb, line 21
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
search_params() click to toggle source
# File lib/geoblacklight/wms_layer.rb, line 13
def search_params
  @params.except('URL')
end
url() click to toggle source
# File lib/geoblacklight/wms_layer.rb, line 9
def url
  @params['URL']
end