diff --git a/lib/app.rb b/lib/app.rb index 4fd1044..0933208 100644 --- a/lib/app.rb +++ b/lib/app.rb @@ -6,10 +6,20 @@ require 'yajl' set :root, File.expand_path('..', File.dirname(__FILE__)) helpers do + # Ugly as fuck. def snapshot - Snapshot + symbols = params.delete('symbols') || params.delete('currencies') + + quote = Snapshot .new(params) .quote + + if symbols + symbols = symbols.split ',' + quote[:rates].keep_if { |k, v| symbols.include? k } + end + + quote end end diff --git a/spec/app_spec.rb b/spec/app_spec.rb index 43f311c..adea781 100644 --- a/spec/app_spec.rb +++ b/spec/app_spec.rb @@ -20,7 +20,6 @@ describe 'the application' do end it 'filters symbols' do - skip 'enterprise feature' get '/latest?symbols=USD' json['rates'].keys.must_equal %w(USD) end