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 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
- CgnsSearch.get('/gnss-srt/api', { :query => query }).to_json
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=#{1.week}"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atlas_middleware
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Casey