mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-25 12:32:30 +01:00
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:
commit
36a49d848c
1
Gemfile
1
Gemfile
@ -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'
|
||||
|
11
Gemfile.lock
11
Gemfile.lock
@ -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
|
||||
|
@ -1,5 +1,4 @@
|
||||
require './config/environment'
|
||||
require 'api'
|
||||
|
||||
use Honeybadger::Rack
|
||||
run Sinatra::Application
|
||||
|
1
config/initializers/gc_profiler.rb
Normal file
1
config/initializers/gc_profiler.rb
Normal file
@ -0,0 +1 @@
|
||||
GC::Profiler.enable
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user