Class: Institution

Inherits:
Struct
  • Object
show all
Defined in:
app/models/institution.rb

Overview

Services are grouped together in Institutions. An Institution represents some particular class of user. It could be a particular location or affiliation, but it really could be any other class of user too.

Institutions are defined in $umlaut/config/umlaut_config/institutions.yml (sample in config/umlaut_distribution/institutions.yml-dist ). An Institution definition is basically a unique identifier and a list of services attached to that institution.

Insitution is NOT an ActiveRecord; it's based off ruby Struct for simplicity, and generally loaded from institutions.yml by the InstitutionList store class. #services is an array of service id's, NOT of actual Service objects.

Hypothetically, there will be many ways for a given incoming request to get associated with an Institution: by IP range, by user preference, by attribute from an enterprise directory associated with a user account, etc. An incoming user can be associated with one or more institutions.

However, at present, pretty much the only way for a user to be associated with an Institution is if it's a default Institution! So the only Institutions are default Institutions at present (there can be more than one default institution). This architecture has room for expansion.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Institution) initialize(h = {})

Better initializer than Struct gives us, take a hash instead of an ordered array. :services=>[] is an array of service ids, not actual Services!



29
30
31
# File 'app/models/institution.rb', line 29

def initialize(h={})
  members.each {|m| self.send( (m+'=').to_sym , (h[m.to_sym] || h[m])) }   
end

Instance Attribute Details

- (Object) default_institution

Returns the value of attribute default_institution



24
25
26
# File 'app/models/institution.rb', line 24

def default_institution
  @default_institution
end

- (Object) display_name

Returns the value of attribute display_name



24
25
26
# File 'app/models/institution.rb', line 24

def display_name
  @display_name
end

- (Object) oclc_symbol

Returns the value of attribute oclc_symbol



24
25
26
# File 'app/models/institution.rb', line 24

def oclc_symbol
  @oclc_symbol
end

- (Object) postal_code

Returns the value of attribute postal_code



24
25
26
# File 'app/models/institution.rb', line 24

def postal_code
  @postal_code
end

- (Object) services

Returns the value of attribute services



24
25
26
# File 'app/models/institution.rb', line 24

def services
  @services
end

- (Object) worldcat_registry_id

Returns the value of attribute worldcat_registry_id



24
25
26
# File 'app/models/institution.rb', line 24

def worldcat_registry_id
  @worldcat_registry_id
end

Instance Method Details

- (Object) instantiate_services!

Instantiates a new copy of all services included in this institution, returns an array.



35
36
37
# File 'app/models/institution.rb', line 35

def instantiate_services!
  services.collect {|s|  }
end