Class: ODDB::Hospital

Inherits:
Object show all
Includes:
AddressObserver, Persistence, UserObserver
Defined in:
src/model/hospital.rb,
src/custom/lookandfeelbase.rb

Constant Summary

ODBA_SERIALIZABLE =
['@addresses']

Constants included from Persistence

ODBA_PREDEFINE_SERIALIZABLE

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from UserObserver

#add_user, #has_user?, #remove_user, #users

Methods included from AddressObserver

#address, #address_item, #create_address, #ydim_address_lines, #ydim_location

Methods included from PersistenceMethods

#checkout, #data_origin, #data_origins, #diff, #init, #nil_if_empty, #parent, #structural_ancestors, #undiffable?, #update_values

Constructor Details

- (Hospital) initialize(ean13)

A new instance of Hospital



19
20
21
22
# File 'src/model/hospital.rb', line 19

def initialize(ean13)
  @addresses = [Address2.new]
  @ean13 = ean13
end

Instance Attribute Details

- (Object) addresses

Returns the value of attribute addresses



14
15
16
# File 'src/model/hospital.rb', line 14

def addresses
  @addresses
end

- (Object) business_unit

Returns the value of attribute business_unit



14
15
16
# File 'src/model/hospital.rb', line 14

def business_unit
  @business_unit
end

- (Object) ean13 (readonly)

Returns the value of attribute ean13



16
17
18
# File 'src/model/hospital.rb', line 16

def ean13
  @ean13
end

- (Object) email Also known as: contact_email

Returns the value of attribute email



14
15
16
# File 'src/model/hospital.rb', line 14

def 
  @email
end

- (Object) name Also known as: fullname

Returns the value of attribute name



14
15
16
# File 'src/model/hospital.rb', line 14

def name
  @name
end

- (Object) narcotics

Returns the value of attribute narcotics



14
15
16
# File 'src/model/hospital.rb', line 14

def narcotics
  @narcotics
end

- (Object) ydim_id

Returns the value of attribute ydim_id



14
15
16
# File 'src/model/hospital.rb', line 14

def ydim_id
  @ydim_id
end

Instance Method Details

- (Object) contact



23
24
25
# File 'src/model/hospital.rb', line 23

def contact
  (addr = @addresses.first) && addr.name
end

- (Object) pointer_descr



38
39
40
# File 'src/model/hospital.rb', line 38

def pointer_descr
  [@name, @business_unit].compact.join(' ')
end

- (Object) search_terms



26
27
28
29
30
31
32
33
34
# File 'src/model/hospital.rb', line 26

def search_terms
  terms = [
    @name, @ean13, @business_unit, @email
  ]
  @addresses.each { |addr| 
    terms += addr.search_terms
  }
  ODDB.search_terms(terms)
end

- (Object) search_text



35
36
37
# File 'src/model/hospital.rb', line 35

def search_text
  search_terms.join(' ')
end