Module: Readmill::Client::Search

Included in:
Readmill::Client
Defined in:
lib/readmill/client/search.rb

Overview

Public: This module will bring all of the methods from the search section of the API.

Instance Method Summary collapse

Instance Method Details

#search(query, opts = {}) ⇒ Object

Public: Search the readmill API for books, highlights, etc.

query - A String to search the API for. opts - A Hash of options used to modify the results. All of the values

of this Hash will be forwarded to the API as parameters
(default: {}).

Returns a Hashie::Mash.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/readmill/client/search.rb', line 16

def search(query, opts={})
  ensure_valid_search_options(opts)

  opts[:query] = query
  if opts.delete(:books)
    url = 'books/search'
  elsif opts.delete(:highlights)
    url = 'highlights/search'
  elsif opts.delete(:users)
    url = 'users/search'
  else
    url = 'search'
  end

  get(url, opts).items
end