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.34.0 lib/discourse_api/api/search.rb
discourse_api-0.33.0 lib/discourse_api/api/search.rb
discourse_api-0.32.0 lib/discourse_api/api/search.rb
discourse_api-0.31.0 lib/discourse_api/api/search.rb
discourse_api-0.30.0 lib/discourse_api/api/search.rb
discourse_api-0.29.0 lib/discourse_api/api/search.rb
discourse_api-0.28.1 lib/discourse_api/api/search.rb
discourse_api-0.28.0 lib/discourse_api/api/search.rb
discourse_api-0.27.0 lib/discourse_api/api/search.rb
discourse_api-0.26.0 lib/discourse_api/api/search.rb
discourse_api-0.25.0 lib/discourse_api/api/search.rb
discourse_api-0.24.0 lib/discourse_api/api/search.rb
discourse_api-0.23.1 lib/discourse_api/api/search.rb
discourse_api-0.23.0 lib/discourse_api/api/search.rb
discourse_api-0.22.0 lib/discourse_api/api/search.rb
discourse_api-0.20.1 lib/discourse_api/api/search.rb
discourse_api-0.20.0 lib/discourse_api/api/search.rb
discourse_api-0.19.0 lib/discourse_api/api/search.rb
discourse_api-0.18.0 lib/discourse_api/api/search.rb
discourse_api-0.17.0 lib/discourse_api/api/search.rb