class OpenExchangeRate::Api
Attributes
app_id[RW]
https[RW]
Public Class Methods
new( app_id: "insert_app_id", https: false)
click to toggle source
# File lib/open-exchange-rate/open-exchange-rate.rb, line 5 def initialize( app_id: "insert_app_id", https: false) @app_id = app_id @https = https end
Public Instance Methods
currencies()
click to toggle source
# File lib/open-exchange-rate/open-exchange-rate.rb, line 25 def currencies url = "http://openexchangerates.org/api/currencies.json" # no app_id required http = Curl.get url Oj.load(http.body_str) end
latest()
click to toggle source
# File lib/open-exchange-rate/open-exchange-rate.rb, line 13 def latest if @https prefix = "https" else prefix = "http" end url = "#{prefix}://openexchangerates.org/api/latest.json?app_id=#{app_id}" http = Curl.get url Oj.load(http.body_str) end