Class: Shibkit::MetaMeta::Contact

Inherits:
MetadataItem show all
Defined in:
lib/shibkit/meta_meta/contact.rb

Overview

Class to represent technical or suppor contact details for an entity

Constant Summary collapse

ROOT_ELEMENT =

Element and attribute used to select XML for new objects

'ContactPerson'
TARGET_ATTR =
'contactType'
REQUIRED_QUACKS =
[:email_url, :category]

Constants inherited from MetadataItem

MetadataItem::NAMESPACES

Instance Attribute Summary collapse

Attributes inherited from MetadataItem

#read_at

Instance Method Summary collapse

Methods inherited from MetadataItem

#filter, #from_xml, #hashed_id, #initialize, #parsed_xml, #purge_xml, #source_xml, #textify_xml, #to_hash, #to_rdf, #to_xml

Constructor Details

This class inherits a constructor from Shibkit::MetaMeta::MetadataItem

Instance Attribute Details

#categoryObject

The category of the contact (support or technical)



42
43
44
# File 'lib/shibkit/meta_meta/contact.rb', line 42

def category
  @category
end

#email_urlObject

The email address of the contact formatted as a mailto: URL



39
40
41
# File 'lib/shibkit/meta_meta/contact.rb', line 39

def email_url
  @email_url
end

#givennameObject

The given name of the contact (often the entire name is here)



33
34
35
# File 'lib/shibkit/meta_meta/contact.rb', line 33

def givenname
  @givenname
end

#surnameObject

The surname of the contact



36
37
38
# File 'lib/shibkit/meta_meta/contact.rb', line 36

def surname
  @surname
end

Instance Method Details

#display_nameObject

Usually both the surname and givenname of the contact



45
46
47
48
49
# File 'lib/shibkit/meta_meta/contact.rb', line 45

def display_name

  return [givenname, surname].join(' ')

end

#email_addressObject



51
52
53
54
55
# File 'lib/shibkit/meta_meta/contact.rb', line 51

def email_address
  
  return email_url.gsub('mailto:','')
  
end

#to_sObject

Nicer presentation as a string



58
59
60
61
62
# File 'lib/shibkit/meta_meta/contact.rb', line 58

def to_s
  
  return "#{display_name} <#{email_address}>"
 
end