Class: ESP::User

Inherits:
Resource
  • Object
show all
Defined in:
lib/esp/resources/user.rb

Constant Summary

Constants inherited from Resource

Resource::PREDICATES

Instance Method Summary collapse

Methods inherited from Resource

arrange_options, filters, find, make_pageable, #serializable_hash, where

Instance Method Details

#destroyObject

Not Implemented. You cannot destroy a User.



13
14
15
# File 'lib/esp/resources/user.rb', line 13

def destroy
  fail ESP::NotImplementedError
end

#organizationObject

The organization this user belongs to.



5
# File 'lib/esp/resources/user.rb', line 5

belongs_to :organization, class_name: 'ESP::Organization'

#saveObject

Not Implemented. You cannot create or update a User.



8
9
10
# File 'lib/esp/resources/user.rb', line 8

def save
  fail ESP::NotImplementedError
end

#sub_organizationsObject

The collection of sub organizations that belong to the user.



19
20
21
22
# File 'lib/esp/resources/user.rb', line 19

def sub_organizations
  return attributes['sub_organizations'] if attributes['sub_organizations'].present?
  SubOrganization.where(id_in: sub_organization_ids)
end

#teamsObject

The collection of teams that belong to the user.



26
27
28
29
# File 'lib/esp/resources/user.rb', line 26

def teams
  return attributes['teams'] if attributes['teams'].present?
  Team.where(id_in: team_ids)
end