Sha256: 75ab90ba5e1951cfbc81f29eb77864b3786b71789fe5134ae4c6c9417785bfcc

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

require_relative "configuration"
require_relative "requests"

module Tika
  class Client

    include Requests

    class << self
      def config
        @config ||= Configuration.new
      end

      def configure
        yield config
      end
    end

    attr_reader :host, :port

    def initialize(opts={})
      @host = opts.fetch(:host, config.host)
      @port = opts.fetch(:port, config.port)
    end

    def get_text(opts={})
      GetTextRequest.execute(connection, opts)
    end

    def get_metadata(opts={})
      GetMetadataRequest.execute(connection, opts)
    end

    private

    def config
      self.class.config
    end

    def connection
      @connection ||= Net::HTTP.new(host, port)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tika-client-0.1.1 lib/tika/client.rb