mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 11:02: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 'fixer'
|
||||||
gem 'honeybadger'
|
gem 'honeybadger'
|
||||||
gem 'newrelic_rpm'
|
gem 'newrelic_rpm'
|
||||||
|
gem 'librato-rack'
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
gem 'sequel_pg'
|
gem 'sequel_pg'
|
||||||
gem 'sinatra-jsonp'
|
gem 'sinatra-jsonp'
|
||||||
|
11
Gemfile.lock
11
Gemfile.lock
@ -1,6 +1,7 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
aggregate (0.2.2)
|
||||||
axiom-types (0.1.1)
|
axiom-types (0.1.1)
|
||||||
descendants_tracker (~> 0.0.4)
|
descendants_tracker (~> 0.0.4)
|
||||||
ice_nine (~> 0.11.0)
|
ice_nine (~> 0.11.0)
|
||||||
@ -10,6 +11,8 @@ GEM
|
|||||||
descendants_tracker (0.0.4)
|
descendants_tracker (0.0.4)
|
||||||
thread_safe (~> 0.3, >= 0.3.1)
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
equalizer (0.0.9)
|
equalizer (0.0.9)
|
||||||
|
faraday (0.9.0)
|
||||||
|
multipart-post (>= 1.2, < 3)
|
||||||
fixer (0.5.0)
|
fixer (0.5.0)
|
||||||
nokogiri (~> 1.5)
|
nokogiri (~> 1.5)
|
||||||
honeybadger (1.13.1)
|
honeybadger (1.13.1)
|
||||||
@ -17,9 +20,16 @@ GEM
|
|||||||
ice_nine (0.11.0)
|
ice_nine (0.11.0)
|
||||||
json (1.8.1)
|
json (1.8.1)
|
||||||
kgio (2.9.2)
|
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)
|
mini_portile (0.6.0)
|
||||||
minitest (5.3.4)
|
minitest (5.3.4)
|
||||||
multi_json (1.10.0)
|
multi_json (1.10.0)
|
||||||
|
multipart-post (2.0.0)
|
||||||
newrelic_rpm (3.8.1.221)
|
newrelic_rpm (3.8.1.221)
|
||||||
nokogiri (1.6.2.1)
|
nokogiri (1.6.2.1)
|
||||||
mini_portile (= 0.6.0)
|
mini_portile (= 0.6.0)
|
||||||
@ -63,6 +73,7 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
fixer
|
fixer
|
||||||
honeybadger
|
honeybadger
|
||||||
|
librato-rack
|
||||||
minitest
|
minitest
|
||||||
newrelic_rpm
|
newrelic_rpm
|
||||||
rack-test
|
rack-test
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
require './config/environment'
|
require './config/environment'
|
||||||
require 'api'
|
require 'api'
|
||||||
|
|
||||||
use Honeybadger::Rack
|
|
||||||
run Sinatra::Application
|
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|
|
Honeybadger.configure do |config|
|
||||||
config.environment_name = App.env
|
config.environment_name = App.env
|
||||||
config.api_key = ENV['HONEYBADGER_API_KEY']
|
config.api_key = ENV['HONEYBADGER_API_KEY']
|
||||||
|
|
||||||
config.async do |notice|
|
|
||||||
Thread.new { notice.deliver }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -7,6 +7,10 @@ set :root, File.expand_path('..', File.dirname(__FILE__))
|
|||||||
|
|
||||||
configure :production do
|
configure :production do
|
||||||
require 'newrelic_rpm'
|
require 'newrelic_rpm'
|
||||||
|
require 'librato-rack'
|
||||||
|
|
||||||
|
use Honeybadger::Rack
|
||||||
|
use Librato::Rack
|
||||||
end
|
end
|
||||||
|
|
||||||
helpers do
|
helpers do
|
||||||
@ -26,7 +30,7 @@ helpers do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def halt_with_meaningful_response(status, message)
|
def halt_with_meaningful_response(status, message)
|
||||||
halt status, "#{message}. Please read http://fixer.io."
|
halt status, message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ class Snapshot
|
|||||||
if base.upcase! != 'EUR'
|
if base.upcase! != 'EUR'
|
||||||
denominator = rates.update('EUR' => 1.0).delete(base)
|
denominator = rates.update('EUR' => 1.0).delete(base)
|
||||||
raise ArgumentError.new('Invalid base') unless denominator
|
raise ArgumentError.new('Invalid base') unless denominator
|
||||||
|
|
||||||
rates.each do |iso_code, rate|
|
rates.each do |iso_code, rate|
|
||||||
rates[iso_code] = round(rate / denominator)
|
rates[iso_code] = round(rate / denominator)
|
||||||
end
|
end
|
||||||
|
@ -26,4 +26,9 @@ describe 'the API' do
|
|||||||
get '/latest?base=UAH'
|
get '/latest?base=UAH'
|
||||||
last_response.must_be :unprocessable?
|
last_response.must_be :unprocessable?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'handles malformed queries' do
|
||||||
|
get 'latest?base=USD?callback=?'
|
||||||
|
last_response.must_be :unprocessable?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user