contact_presenter.rb 487 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
class ContactPresenter < BasePresenter
  def base_hash
    { id: id,
      person_id: person_id
    }
  end

  def full_hash
    base_hash.merge({
      aspect_memberships: aspect_memberships.map{ |membership| AspectMembershipPresenter.new(membership).base_hash }
    })
  end

  def full_hash_with_person
15 16 17 18 19 20 21
    full_hash.merge(person: person_without_contact)
  end

  private

  def person_without_contact
    PersonPresenter.new(person, current_user).as_json.except!(:contact)
22 23
  end
end