class CompareCrypto::Gateway
Constants
- API_KEY
- BASE_URL
Public Class Methods
new(args)
click to toggle source
# File lib/compare-crypto/gateway.rb, line 10 def initialize args @source = args[:source] #BTC @target = args[:target] #USD end
Public Instance Methods
get_price()
click to toggle source
# File lib/compare-crypto/gateway.rb, line 15 def get_price response = send_request prepare_url "price?fsym=#{@source}&tsyms=#{@target}" {body: response.body, code: response.code} end
prepare_url(path)
click to toggle source
# File lib/compare-crypto/gateway.rb, line 20 def prepare_url path URI(BASE_URL + path) end
Private Instance Methods
send_request(url)
click to toggle source
# File lib/compare-crypto/gateway.rb, line 25 def send_request url HTTParty.get(url) end