Module: Highrise::Searchable::ClassMethods

Defined in:
lib/highrise/searchable.rb

Instance Method Summary collapse

Instance Method Details

#search(options = {}) ⇒ Object

List By Search Criteria Ex: Highrise::Person.search(:email => “[email protected]”, :country => “CA”) Available criteria are: city, state, country, zip, phone, email

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/highrise/searchable.rb', line 11

def search(options = {})
  raise ArgumentError, "cannot convert #{options}:#{options.class} to hash" if options.kind_of?(String)
  # This might have to be changed in the future if other non-pagable resources become searchable
  options[:kind] ||= collection_name
  find_options = {:from => "/parties/search.xml", :params => options}
  if respond_to?(:find_all_across_pages)
    find_all_across_pages(find_options)
  else
    find(:all, find_options)
  end
end