mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-21 18:42:29 +01:00
Use api subdomain for api reqs
This commit is contained in:
parent
59a8a28ddb
commit
a52fadf715
@ -6,6 +6,12 @@ require 'yajl'
|
||||
set :root, File.expand_path('..', File.dirname(__FILE__))
|
||||
|
||||
helpers do
|
||||
def redirect_to_api
|
||||
if request.host =~ /^f/
|
||||
redirect request.url.sub %r(://f), '://api.f'
|
||||
end
|
||||
end
|
||||
|
||||
# Ugly as fuck.
|
||||
def snapshot
|
||||
symbols = params.delete('symbols') || params.delete('currencies')
|
||||
@ -28,10 +34,12 @@ get '/' do
|
||||
end
|
||||
|
||||
get '/latest' do
|
||||
redirect_to_api if production?
|
||||
jsonp snapshot
|
||||
end
|
||||
|
||||
get '/:date' do
|
||||
redirect_to_api if production?
|
||||
jsonp snapshot
|
||||
end
|
||||
|
||||
|
@ -82,42 +82,48 @@
|
||||
euro.
|
||||
</p>
|
||||
<code>
|
||||
curl http://fixer.io/latest
|
||||
curl http://api.fixer.io/latest
|
||||
</code>
|
||||
|
||||
<p>
|
||||
Get historical rates for any day since 1999.
|
||||
</p>
|
||||
<code>
|
||||
curl http://fixer.io/2000-01-03
|
||||
curl http://api.fixer.io/2000-01-03
|
||||
</code>
|
||||
|
||||
<p>
|
||||
Quote against a currency, both real-time and historically, by setting
|
||||
the <strong>base</strong> parameter in your request.
|
||||
Quote against a currency by setting the <strong>base</strong> parameter
|
||||
in your request.
|
||||
</p>
|
||||
<code>
|
||||
curl http://fixer.io/latest?base=USD
|
||||
curl http://api.fixer.io/latest?base=USD
|
||||
</code>
|
||||
|
||||
<p>
|
||||
Request specific exchange rates, both real-time and historically, by
|
||||
setting the <strong>symbols</strong> or <strong>currencies</strong>
|
||||
parameter.
|
||||
Request specific exchange rates by setting the
|
||||
<strong>symbols</strong> or <strong>currencies</strong> parameter.
|
||||
</p>
|
||||
<code>
|
||||
curl http://fixer.io/latest?symbols=USD,GBP
|
||||
curl http://api.fixer.io/latest?symbols=USD,GBP
|
||||
</code>
|
||||
|
||||
<p>
|
||||
Make cross-domain JSONP requests.
|
||||
Make cross-domain <strong>JSONP</strong> requests.
|
||||
</p>
|
||||
<code>
|
||||
curl http://fixer.io/latest?callback=myCallback
|
||||
curl http://api.fixer.io/latest?callback=myCallback
|
||||
</code>
|
||||
|
||||
<p>
|
||||
Exchange rates are usually updated by 3pm CET.
|
||||
<strong>HTTPS</strong> endpoints are available.
|
||||
</p>
|
||||
<code>
|
||||
curl https://api.fixer.io/latest
|
||||
</code>
|
||||
|
||||
<p>
|
||||
Exchange rates are usually updated by <strong>3pm CET</strong>.
|
||||
</p>
|
||||
|
||||
<footer>
|
||||
|
Loading…
Reference in New Issue
Block a user