Sha256: 2a7489462866bf0d81e07cf0fc7cee78bef00896ed53a61f137c7b2af98cff08

Contents?: true

Size: 582 Bytes

Versions: 8

Compression:

Stored size: 582 Bytes

Contents

module TrackerApi
  module Endpoints
    class Search
      attr_accessor :client

      def initialize(client)
        @client = client
      end

      def get(project_id, query, options={})
        raise ArgumentError, 'Valid query string required to search' unless query.is_a?(String)

        options[:params] = { query: query }
        data = client.get("/projects/#{project_id}/search", options).body

        raise Errors::UnexpectedData, 'Hash of search results expect' unless data.is_a? Hash

        Resources::SearchResultContainer.new(data)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tracker_api-1.16.0 lib/tracker_api/endpoints/search.rb
tracker_api-1.15.0 lib/tracker_api/endpoints/search.rb
tracker_api-1.14.0 lib/tracker_api/endpoints/search.rb
tracker_api-1.13.0 lib/tracker_api/endpoints/search.rb
tracker_api-1.12.0 lib/tracker_api/endpoints/search.rb
tracker_api-1.11.0 lib/tracker_api/endpoints/search.rb
tracker_api-1.10.0 lib/tracker_api/endpoints/search.rb
tracker_api-1.9.1 lib/tracker_api/endpoints/search.rb