Sha256: 92f5417057ca0307a427fd57cc24c043eab94480b4e8ca86dacbdcdf1b0e11a4

Contents?: true

Size: 736 Bytes

Versions: 15

Compression:

Stored size: 736 Bytes

Contents

# frozen_string_literal: true
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

15 entries across 15 versions & 1 rubygems

Version Path
discourse_api-0.45.0 lib/discourse_api/api/search.rb
discourse_api-0.44.0 lib/discourse_api/api/search.rb
discourse_api-0.43.1 lib/discourse_api/api/search.rb
discourse_api-0.43.0 lib/discourse_api/api/search.rb
discourse_api-0.42.0 lib/discourse_api/api/search.rb
discourse_api-0.41.0 lib/discourse_api/api/search.rb
discourse_api-0.40.0 lib/discourse_api/api/search.rb
discourse_api-0.39.3 lib/discourse_api/api/search.rb
discourse_api-0.39.2 lib/discourse_api/api/search.rb
discourse_api-0.39.1 lib/discourse_api/api/search.rb
discourse_api-0.39.0 lib/discourse_api/api/search.rb
discourse_api-0.38.0 lib/discourse_api/api/search.rb
discourse_api-0.37.0 lib/discourse_api/api/search.rb
discourse_api-0.36.0 lib/discourse_api/api/search.rb
discourse_api-0.35.0 lib/discourse_api/api/search.rb