Module: Catch::Search

Included in:
Client
Defined in:
lib/catch/search.rb

Instance Method Summary collapse

Instance Method Details

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

Search the user’s notes

Specifies a note sort order. Valid sort orders are: created_asc sort by note creation date in ascending order (most recent first) create_dec sort by note creation date in descending order (most recent last) modified_asc sort by note modification date in ascending order (most recent first) modified_dec sort by note modification date in descending order (most recent last) text_asc sort by the note text content from in ascending order (A to Z) text_dec sort by the note text content from in descending order (Z to A)

Parameters:

  • :q (String)

    The search query

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :lat (Float)

    Latitude in degrees

  • :lng (Float)

    Longitude in degrees

  • :sort (String)

    default is created_dec

  • :full (Boolean)

    Whether or not to return full results.

  • :limit (Integer)

    The number of results to return per page. The default is to return all results.

  • :offset (Integer)

    The offset from which to collect results, with default of zero. The number of results is specified by limit.



20
21
22
23
24
25
26
27
28
# File 'lib/catch/search.rb', line 20

def search(query, params={})
  params[:q] = query

  connection.get do |req|
    req.url("search")
#         req.params = params
    req.params.merge!(params)
  end.body.notes
end