Sha256: 1cf0b3b8a9a6d2f6a44fcc4f94912e0ed89fda21bdfe46bf3be7252fa3b31cb6

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

# Represents an address. The following attribute MUST
# be set when using this model:
#
# * lawyer_id
#
# This model has the following attributes:
#
# * id
# * address_line1
# * address_line2
# * city
# * state
# * postal_code
# * latitude
# * longitude
#
class AvvoApi::Address < AvvoApi::Base
  belongs_to :lawyer
  has_many :phones

  # Returns the 'main' address associated with the passed in
  # professional. This is usually the address you want to
  # use. +params+ is a hash of <tt>{:lawyer_id => lawyer.id}</tt> or
  # <tt>{:doctor_id => doctor.id}</tt>
  def self.main(params)
    response = self.get(:main, params)
    if response && response["id"]
      new(params.merge(response))
    elsif response && response["address"]
      new(params.merge(response["address"]))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
avvo_api-0.2.1 lib/avvo_api/address.rb
avvo_api-0.2.0 lib/avvo_api/address.rb