Sha256: 9125893778a3182afba246d1e72612ccd237f168556acf069483d232670dd93e

Contents?: true

Size: 885 Bytes

Versions: 7

Compression:

Stored size: 885 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

7 entries across 7 versions & 1 rubygems

Version Path
kraken_client-1.1.0 lib/kraken_client/endpoints/base.rb
kraken_client-1.0.3 lib/kraken_client/endpoints/base.rb
kraken_client-1.0.2 lib/kraken_client/endpoints/base.rb
kraken_client-1.0.1 lib/kraken_client/endpoints/base.rb
kraken_client-1.0.0 lib/kraken_client/endpoints/base.rb
kraken_client-0.2.1 lib/kraken_client/endpoints/base.rb
kraken_client-0.2.0 lib/kraken_client/endpoints/base.rb