Class: FreeCurrencyAPI::API
- Inherits:
-
Object
- Object
- FreeCurrencyAPI::API
- Defined in:
- lib/freecurrencyAPI/API.rb
Instance Method Summary collapse
- #available_currencies ⇒ Object
-
#initialize(api_key) ⇒ API
constructor
A new instance of API.
- #latest_exchange_rates ⇒ Object
Constructor Details
#initialize(api_key) ⇒ API
Returns a new instance of API.
7 8 9 10 11 12 13 |
# File 'lib/freecurrencyAPI/API.rb', line 7 def initialize api_key @conn = Faraday.new "https://api.freecurrencyapi.com/v1/" do |c| c.response :json c.adapter :net_http c.headers = {apikey: "#{api_key}"} end end |
Instance Method Details
#available_currencies ⇒ Object
19 20 21 |
# File 'lib/freecurrencyAPI/API.rb', line 19 def available_currencies do_request "currencies" end |
#latest_exchange_rates ⇒ Object
15 16 17 |
# File 'lib/freecurrencyAPI/API.rb', line 15 def latest_exchange_rates do_request "latest" end |