Merge branch 'master' of github.com:papercavalier/fixer-io

Conflicts:
	.ruby-version
	Gemfile.lock
	lib/snapshot.rb
	spec/api_spec.rb
This commit is contained in:
hakanensari 2014-05-16 20:39:14 +01:00
commit 36a49d848c
8 changed files with 23 additions and 7 deletions

View File

@ -5,6 +5,7 @@ ruby '2.1.2'
gem 'fixer'
gem 'honeybadger'
gem 'newrelic_rpm'
gem 'librato-rack'
gem 'rake'
gem 'sequel_pg'
gem 'sinatra-jsonp'

View File

@ -1,6 +1,7 @@
GEM
remote: http://rubygems.org/
specs:
aggregate (0.2.2)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
@ -10,6 +11,8 @@ GEM
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
equalizer (0.0.9)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
fixer (0.5.0)
nokogiri (~> 1.5)
honeybadger (1.13.1)
@ -17,9 +20,16 @@ GEM
ice_nine (0.11.0)
json (1.8.1)
kgio (2.9.2)
librato-metrics (1.3.2)
aggregate (~> 0.2.2)
faraday (~> 0.7)
multi_json
librato-rack (0.4.5)
librato-metrics (~> 1.1)
mini_portile (0.6.0)
minitest (5.3.4)
multi_json (1.10.0)
multipart-post (2.0.0)
newrelic_rpm (3.8.1.221)
nokogiri (1.6.2.1)
mini_portile (= 0.6.0)
@ -63,6 +73,7 @@ PLATFORMS
DEPENDENCIES
fixer
honeybadger
librato-rack
minitest
newrelic_rpm
rack-test

View File

@ -1,5 +1,4 @@
require './config/environment'
require 'api'
use Honeybadger::Rack
run Sinatra::Application

View File

@ -0,0 +1 @@
GC::Profiler.enable

View File

@ -3,8 +3,4 @@ require 'honeybadger'
Honeybadger.configure do |config|
config.environment_name = App.env
config.api_key = ENV['HONEYBADGER_API_KEY']
config.async do |notice|
Thread.new { notice.deliver }
end
end

View File

@ -7,6 +7,10 @@ set :root, File.expand_path('..', File.dirname(__FILE__))
configure :production do
require 'newrelic_rpm'
require 'librato-rack'
use Honeybadger::Rack
use Librato::Rack
end
helpers do
@ -26,7 +30,7 @@ helpers do
end
def halt_with_meaningful_response(status, message)
halt status, "#{message}. Please read http://fixer.io."
halt status, message
end
end

View File

@ -31,7 +31,6 @@ class Snapshot
if base.upcase! != 'EUR'
denominator = rates.update('EUR' => 1.0).delete(base)
raise ArgumentError.new('Invalid base') unless denominator
rates.each do |iso_code, rate|
rates[iso_code] = round(rate / denominator)
end

View File

@ -26,4 +26,9 @@ describe 'the API' do
get '/latest?base=UAH'
last_response.must_be :unprocessable?
end
it 'handles malformed queries' do
get 'latest?base=USD?callback=?'
last_response.must_be :unprocessable?
end
end