class RatesSname::Api

Constants

API

Public Class Methods

exchange(amount, from, to) click to toggle source
# File lib/rates_sname.rb, line 13
def self.exchange(amount, from, to)
  endpoint = "#{API}?symbols=#{from},#{to}"
  response = Excon.get(endpoint)

  body = JSON.parse(response.body)
  rate = body["rates"][from]
  amount.to_f / rate.to_f
end
working() click to toggle source
# File lib/rates_sname.rb, line 22
def self.working
  puts "I am working"
end