class TrackerApi::Endpoints::Search

Attributes

client[RW]

Public Class Methods

new(client) click to toggle source
# File lib/tracker_api/endpoints/search.rb, line 6
def initialize(client)
  @client = client
end

Public Instance Methods

get(project_id, query, options={}) click to toggle source
# File lib/tracker_api/endpoints/search.rb, line 10
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