Sha256: 3873a1811d23a92c42ba7e8b52a9e08e7b0027df90325bd2e6df7f252afde719

Contents?: true

Size: 678 Bytes

Versions: 8

Compression:

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

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