Sha256: ca394d1c89cb736e4cc47e423c955e2c939d30303a5b448e431d05f5e7609a60

Contents?: true

Size: 878 Bytes

Versions: 8

Compression:

Stored size: 878 Bytes

Contents

module KrakenClient
  module Endpoints
    class Base

      attr_accessor :config, :options

      def initialize(config, options = {})
        @config  = config
        @options = options

        set_methods
      end

      def request_manager
        @request_manager ||= KrakenClient::Requests::Base.build(config, type)
      end

      private

      def set_methods
        data.each do |method, method_alias|
          self.class.send(:define_method, Array(method_alias).first) do |args = {}|
            raise_exception(Array(method_alias).last, args)

            perform(method.to_s, args)
          end
        end
      end

      def type
        @type ||= self.class.name.demodulize
      end

      def data
        fail ::KrakenClient::NotImplemented
      end

      def raise_exception
        fail ::KrakenClient::NotImplemented
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kraken_client-1.3.0 lib/kraken_client/endpoints/base.rb
kraken_client-1.2.1 lib/kraken_client/endpoints/base.rb
kraken_client-1.2 lib/kraken_client/endpoints/base.rb
kraken_client-1.1.5 lib/kraken_client/endpoints/base.rb
kraken_client-1.1.4 lib/kraken_client/endpoints/base.rb
kraken_client-1.1.3 lib/kraken_client/endpoints/base.rb
kraken_client-1.1.2 lib/kraken_client/endpoints/base.rb
kraken_client-1.1.1 lib/kraken_client/endpoints/base.rb