Class: ESP::User

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Dirty

#changed_attributes, #original_attributes, #original_attributes=

Methods included from LoadWithOriginalAttributes

#load

Class Method Details

.allActiveResource::PaginatedCollection<ESP::User>

Return a paginated User list



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

.createvoid

This method returns an undefined value.

Not Implemented. You cannot create a User.



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

.find(id, options = {}) ⇒ ESP::User

Find a User by id

call-seq -> super.find(id, options = {})

Parameters:

  • id (Integer, Numeric, #to_i)

    Required ID of the user to retrieve.

  • options (Hash) (defaults to: {})

    Optional hash of options.

    Valid Options

    include | The list of associated objects to return on the initial request.

    Valid Includable Associations

    See API documentation for valid arguments

Returns:



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

.where(clauses = {}) ⇒ ActiveResource::PaginatedCollection<ESP::User>

Return a paginated User list filtered by search parameters

call-seq -> super.where(clauses = {})

Parameters:

  • clauses (Hash) (defaults to: {})

    A hash of attributes with appended predicates to search, sort and include.

    Valid Clauses

    See API documentation for valid arguments

Returns:



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

Instance Method Details

#destroyvoid

This method returns an undefined value.

Not Implemented. You cannot destroy a User.



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

def destroy
  fail ESP::NotImplementedError
end

#organizationESP::Organization

The organization this user belongs to.

Returns:



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

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

#savevoid

This method returns an undefined value.

Not Implemented. You cannot create or update a User.



11
12
13
# File 'lib/esp/resources/user.rb', line 11

def save
  fail ESP::NotImplementedError
end

#sub_organizationsActiveResource::PaginatedCollection<ESP::SubOrganization>

The collection of sub organizations that belong to the user.



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

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

#teamsActiveResource::PaginatedCollection<ESP::Team>

The collection of teams that belong to the user.



33
34
35
36
# File 'lib/esp/resources/user.rb', line 33

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