Sha256: bc8647b94c260b9e89e46648e6734c0ea5fd31fb5609eb66644a6d909ba6b43a

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

module KrakenClient
  module Endpoints
    class Public < Base

      def perform(endpoint_name, args)
        response = request_manager.call(url(endpoint_name), args)
        hash = JSON.parse(response.body).with_indifferent_access
        hash[:result]
      end

      def data
        {
          :Time       => :server_time,
          :AssetPairs => :asset_pairs,
          :Depth      => :order_book,
          :Ticker     => :ticker,
          :OHLC       => [:ohlc,  params: [:pair, :last, :interval]],
          :Trades     => :trades,
          :Spread     => :spread,
          :Assets     => :assets,
        }
      end

      private

      def url(endpoint_name)
        @url = config.base_uri + '/' + config.api_version.to_s + '/public/' + endpoint_name
      end

      def raise_exception(*)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kraken_client-1.2.1 lib/kraken_client/endpoints/public.rb
kraken_client-1.2 lib/kraken_client/endpoints/public.rb