Module: AvvoApi::ProfessionalMethods::ClassMethods

Defined in:
lib/avvo_api/professional_methods.rb

Overview

Methods that are shared between professionals.

Instance Method Summary collapse

Instance Method Details

#resolve(params) ⇒ Object

Attempts to find a professional on Avvo that matches the passed-in params. Currently accepts the following params:

name

The full name of the lawyer you are trying to find

phone

The phone number of the lawyer, in the format XXX-XXX-XXXX

fax

The fax number of the lawyer, in the format XXX-XXX-XXXX

address

The full address of the lawyer

zip_code

The zip code of the lawyer

email_address

The e-mail address of the lawyer



37
38
39
40
41
42
43
44
45
46
# File 'lib/avvo_api/professional_methods.rb', line 37

def resolve(params)
  response = self.get(:resolve, :params => params)
  if response && response[collection_name]
    response[collection_name].map do |params|
      new(params.merge({"annotation" => response['annotation']}))
    end
  else
    raise ActiveResource::ResourceNotFound.new(response)
  end
end

#search(params) ⇒ Object

Search avvo for a list of the top 10 professionals matching the passed-in parameters. Accepts the following parameters:

q

The search query

loc

The location to search in

These parameters match the search boxes on the Avvo website.

This method pre-dates the REST API, and thus returns a hash of data rather than API objects. Hopefully, we’ll eventually come up with something better. To see an actual response, look at api.avvo.com/docs/get/lawyers/search.html



18
19
20
21
22
23
24
25
26
# File 'lib/avvo_api/professional_methods.rb', line 18

def search(params)
  response = self.get(:search, params)
  
  if response && response['num_results']
    response
  else
    raise ActiveResource::ResourceNotFound.new(response)
  end
end