summaryrefslogtreecommitdiffstats
path: root/app/views/members/show.api.rsb
blob: 55def9eaba5100b3fdacbf2800195b82b71daa8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
api.membership do
  api.id @member.id
  api.project :id => @member.project.id, :name => @member.project.name
  api.__send__ @member.principal.class.name.underscore, :id => @member.principal.id, :name => @member.principal.name
  api.array :roles do
    @member.member_roles.each do |member_role|
      if member_role.role
        attrs = {:id => member_role.role.id, :name => member_role.role.name}
        attrs.merge!(:inherited => true) if member_role.inherited_from.present?
        api.role attrs
      end 
    end
  end
end