Sha256: e3ec0c59c914b790f60bf703556738a3aaff318383eb883d770108849060a880

Contents?: true

Size: 844 Bytes

Versions: 2

Compression:

Stored size: 844 Bytes

Contents

# Represents an address. One of the following attributes MUST
# be set when using this model:
# 
# * doctor_id
# * 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
  belongs_to :doctor
  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.1.1 lib/avvo_api/address.rb
avvo_api-0.1.0 lib/avvo_api/address.rb