Class: Geoblacklight::WmsLayer
- Inherits:
-
Object
- Object
- Geoblacklight::WmsLayer
- Defined in:
- lib/geoblacklight/wms_layer.rb
Instance Method Summary collapse
- #feature_info ⇒ Object
-
#initialize(params) ⇒ WmsLayer
constructor
A new instance of WmsLayer.
- #request_response ⇒ Object
- #search_params ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(params) ⇒ WmsLayer
Returns a new instance of WmsLayer.
3 4 5 6 |
# File 'lib/geoblacklight/wms_layer.rb', line 3 def initialize(params) @params = params.to_h.merge(Settings.WMS_PARAMS) @response = Geoblacklight::FeatureInfoResponse.new(request_response) end |
Instance Method Details
#feature_info ⇒ Object
16 17 18 |
# File 'lib/geoblacklight/wms_layer.rb', line 16 def feature_info @response.check end |
#request_response ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/geoblacklight/wms_layer.rb', line 20 def request_response conn = Faraday.new(url: url) conn.get do |request| request.params = search_params request..timeout = Settings.TIMEOUT_WMS request..open_timeout = Settings.TIMEOUT_WMS end rescue Faraday::Error::ConnectionFailed => error Geoblacklight.logger.error error.inspect { error: error.inspect } rescue Faraday::Error::TimeoutError => error Geoblacklight.logger.error error.inspect { error: error.inspect } end |
#search_params ⇒ Object
12 13 14 |
# File 'lib/geoblacklight/wms_layer.rb', line 12 def search_params @params.except('URL') end |
#url ⇒ Object
8 9 10 |
# File 'lib/geoblacklight/wms_layer.rb', line 8 def url @params['URL'] end |