atlas_middleware 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cgns_search.rb +3 -1
- data/lib/map_server_legend_info.rb +1 -1
- metadata +1 -1
data/lib/cgns_search.rb
CHANGED
@@ -3,6 +3,7 @@ require 'activesupport'
|
|
3
3
|
require 'httparty'
|
4
4
|
|
5
5
|
class CgnsSearch
|
6
|
+
ALLOWED_PARAMS = %w(geoname)
|
6
7
|
include HTTParty
|
7
8
|
base_uri "gnss.nrcan.gc.ca"
|
8
9
|
default_params :output => 'xml', :regionCode => 13
|
@@ -25,6 +26,7 @@ class CgnsSearch
|
|
25
26
|
|
26
27
|
private
|
27
28
|
def find(query = {})
|
28
|
-
|
29
|
+
safe_query = query.delete_if { |key,value| !ALLOWED_PARAMS.include?(key) }
|
30
|
+
CgnsSearch.get('/gnss-srt/api', { :query => safe_query }).to_json
|
29
31
|
end
|
30
32
|
end
|
@@ -10,7 +10,7 @@ class MapServerLegendInfo
|
|
10
10
|
begin
|
11
11
|
response = Rack::Response.new(get_legends(request), 200, headers)
|
12
12
|
# set caching information
|
13
|
-
response.headers['Cache-Control'] = "public, max-age=#{
|
13
|
+
response.headers['Cache-Control'] = "public, max-age=#{30.minutes}"
|
14
14
|
rescue Exception => e
|
15
15
|
response = Rack::Response.new({ :error => e.message }.to_json, 500, headers)
|
16
16
|
end
|