Sha256: f139265269853ad1fe0008feea3acf205e57d3e481a7ec3313414d3e02ea01f3

Contents?: true

Size: 704 Bytes

Versions: 28

Compression:

Stored size: 704 Bytes

Contents

module DiscourseApi
  module API
    module Search
      # Returns search results that match the specified term.
      #
      # @param term [String] a search term
      # @param options [Hash] A customizable set of options
      # @option options [String] :type_filter Returns results of the specified type.
      # @return [Array] Return results as an array of Hashes.
      def search(term, options={})
        raise ArgumentError.new("#{term} is required but not specified") unless term
        raise ArgumentError.new("#{term} is required but not specified") unless !term.empty?

        response = get('/search/query', options.merge(term: term))
        response[:body]
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
discourse_api-0.16.1 lib/discourse_api/api/search.rb
discourse_api-0.16.0 lib/discourse_api/api/search.rb
discourse_api-0.15.0 lib/discourse_api/api/search.rb
discourse_api-0.14.1 lib/discourse_api/api/search.rb
discourse_api-0.14.0 lib/discourse_api/api/search.rb
discourse_api-0.13.0 lib/discourse_api/api/search.rb
discourse_api-0.12.0 lib/discourse_api/api/search.rb
discourse_api-0.10.1 lib/discourse_api/api/search.rb