Sha256: 8cf1c5d91ada986b53ec3e1abe35521ee6717ee3b0e49b85ad39c67109110014

Contents?: true

Size: 691 Bytes

Versions: 7

Compression:

Stored size: 691 Bytes

Contents

require 'observer'

module KrakenClient
  module Requests
    class Base

      include Observable

      attr_reader :config, :type, :endpoint_name, :url

      def initialize(config, type)
        @config = config
        @type = type
        add_observer(config.limiter_interface)
      end

      def self.build(config, type)
        type = self.type(type)

        "KrakenClient::Requests::#{type}".constantize.new(config, type)
      end

      def call(url, endpoint_name, options = nil)
        changed
        notify_observers(url.split('/').last)
      end

      private

      def self.type(given_type)
        given_type == 'Public' ? 'Get' : 'Post'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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