Sha256: 22f037b537ff81473a24b4ef886fbf4a1bb58706b530b07b011bc929d098c66e

Contents?: true

Size: 720 Bytes

Versions: 10

Compression:

Stored size: 720 Bytes

Contents

module Ivapi
  class Client
    class Base
      attr_reader :client

      def initialize(client)
        @client = client
      end

      def get(path, options = {})
        request(:get, path, options).body
      end

      private

      def request(method, path, options = {})
        options.merge!(client.authentication)

        response = connection.send(method) do |request|
          request.url(path, options)
        end
        response
      end

      def connection(_options = {})
        conn_opts = client.connection_options
        conn_opts[:url] = client.api_endpoint
        conn_opts[:builder] = client.middleware if client.middleware

        Faraday.new(conn_opts)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ivapi-1.5.0 lib/ivapi/client/base.rb
ivapi-1.4.0 lib/ivapi/client/base.rb
ivapi-1.3.0 lib/ivapi/client/base.rb
ivapi-1.2.0 lib/ivapi/client/base.rb
ivapi-1.1.8 lib/ivapi/client/base.rb
ivapi-1.1.7 lib/ivapi/client/base.rb
ivapi-1.1.6 lib/ivapi/client/base.rb
ivapi-1.1.5 lib/ivapi/client/base.rb
ivapi-1.1.4 lib/ivapi/client/base.rb
ivapi-1.1.3 lib/ivapi/client/base.rb