Sha256: 4edfd4981a7a5d9d8655e4f9cd0f0ddd4313aaa4483b57c906cb669359c009ea

Contents?: true

Size: 727 Bytes

Versions: 7

Compression:

Stored size: 727 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', options.merge(q: term))
        response[:body]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
discourse_api-1.1.0 lib/discourse_api/api/search.rb
discourse_api-1.0.0 lib/discourse_api/api/search.rb
discourse_api-0.48.1 lib/discourse_api/api/search.rb
discourse_api-0.48.0 lib/discourse_api/api/search.rb
discourse_api-0.47.0 lib/discourse_api/api/search.rb
discourse_api-0.46.0 lib/discourse_api/api/search.rb
discourse_api-0.45.1 lib/discourse_api/api/search.rb