class Cryptoexchange::Exchanges::Tokenjar::Services::Pairs

Constants

PAIRS_URL

Public Instance Methods

adapt(output) click to toggle source
# File lib/cryptoexchange/exchanges/tokenjar/services/pairs.rb, line 13
def adapt(output)
  market_pairs = []
  output.each do |pair|
    if pair[1]['isFrozen'] == "0"
      base, target = pair[0].gsub(' ', '').split('_')
      market_pairs << Cryptoexchange::Models::MarketPair.new(
                        base: base,
                        target: target,
                        market: Tokenjar::Market::NAME
                      )
    end
   end
  market_pairs
end
fetch() click to toggle source
# File lib/cryptoexchange/exchanges/tokenjar/services/pairs.rb, line 7
def fetch
  raw_output = HTTP.get("#{PAIRS_URL}")
  output = JSON.parse(raw_output)
  adapt(output)
end