Sha256: e3d829e5a486c8f2d225f9c876dc08d253ec9320e446ae470ad43bbba8f7000a

Contents?: true

Size: 657 Bytes

Versions: 5

Compression:

Stored size: 657 Bytes

Contents

module PostmonRuby
  module Finders
    class Finder
      def endpoint
        raise NotImplementedError
      end

      def arguments_size
        raise NotImplementedError
      end      

      def search(finder, *arguments)
        arguments.flatten!
        finder = PostmonRuby::Finders::Finders.get_finder(finder)
        raise ArgumentError.new("wrong number of arguments (#{arguments.size} for #{finder.arguments_size})") if finder.arguments_size != arguments.size
        finder.search(arguments)
      end

      def arguments_uri(arguments)
        URI::encode("#{ENDPOINT}/#{self.endpoint}/#{arguments.join("/")}")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
postmon_ruby-2.1.3 lib/postmon_ruby/finders/finder.rb
postmon_ruby-2.1.2 lib/postmon_ruby/finders/finder.rb
postmon_ruby-2.1.1 lib/postmon_ruby/finders/finder.rb
postmon_ruby-2.1.0 lib/postmon_ruby/finders/finder.rb
postmon_ruby-2.0.0 lib/postmon_ruby/finders/finder.rb