Class: ContactPresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/contact_presenter.rb

Instance Attribute Summary

Attributes inherited from BasePresenter

#current_user

Instance Method Summary collapse

Methods inherited from BasePresenter

as_collection, #initialize, #method_missing, new

Constructor Details

This class inherits a constructor from BasePresenter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BasePresenter

Instance Method Details

#as_api_json_without_contactObject


21
22
23
# File 'app/presenters/contact_presenter.rb', line 21

def as_api_json_without_contact
  PersonPresenter.new(person, current_user).as_api_json
end

#base_hashObject


4
5
6
7
8
9
# File 'app/presenters/contact_presenter.rb', line 4

def base_hash
  {
    id:        id,
    person_id: person_id
  }
end

#full_hashObject


11
12
13
14
15
# File 'app/presenters/contact_presenter.rb', line 11

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

#full_hash_with_personObject


17
18
19
# File 'app/presenters/contact_presenter.rb', line 17

def full_hash_with_person
  full_hash.merge(person: person_without_contact)
end