Class: SAML2::Contact
Defined Under Namespace
Modules: Type
Instance Attribute Summary collapse
-
#company ⇒ Object
Returns the value of attribute company.
-
#email_addresses ⇒ Object
Returns the value of attribute email_addresses.
-
#given_name ⇒ Object
Returns the value of attribute given_name.
-
#surname ⇒ Object
Returns the value of attribute surname.
-
#telephone_numbers ⇒ Object
Returns the value of attribute telephone_numbers.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Base
Instance Method Summary collapse
- #build(builder) ⇒ Object
- #from_xml(node) ⇒ Object
-
#initialize(type = Type::OTHER) ⇒ Contact
constructor
A new instance of Contact.
Methods inherited from Base
from_xml, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml
Constructor Details
Instance Attribute Details
#company ⇒ Object
Returns the value of attribute company.
13 14 15 |
# File 'lib/saml2/contact.rb', line 13 def company @company end |
#email_addresses ⇒ Object
Returns the value of attribute email_addresses.
13 14 15 |
# File 'lib/saml2/contact.rb', line 13 def email_addresses @email_addresses end |
#given_name ⇒ Object
Returns the value of attribute given_name.
13 14 15 |
# File 'lib/saml2/contact.rb', line 13 def given_name @given_name end |
#surname ⇒ Object
Returns the value of attribute surname.
13 14 15 |
# File 'lib/saml2/contact.rb', line 13 def surname @surname end |
#telephone_numbers ⇒ Object
Returns the value of attribute telephone_numbers.
13 14 15 |
# File 'lib/saml2/contact.rb', line 13 def telephone_numbers @telephone_numbers end |
#type ⇒ Object
Returns the value of attribute type.
13 14 15 |
# File 'lib/saml2/contact.rb', line 13 def type @type end |
Instance Method Details
#build(builder) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/saml2/contact.rb', line 34 def build(builder) builder['md'].ContactPerson('contactType' => type) do |contact_person| contact_person['md'].Company(company) if company contact_person['md'].GivenName(given_name) if given_name contact_person['md'].SurName(surname) if surname email_addresses.each do |email| contact_person['md'].EmailAddress(email) end telephone_numbers.each do |tel| contact_person['md'].TelephoneNumber(tel) end end end |
#from_xml(node) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/saml2/contact.rb', line 21 def from_xml(node) self.type = node['contactType'] company = node.at_xpath('md:Company', Namespaces::ALL) self.company = company && company.content && company.content.strip given_name = node.at_xpath('md:GivenName', Namespaces::ALL) self.given_name = given_name && given_name.content && given_name.content.strip surname = node.at_xpath('md:SurName', Namespaces::ALL) self.surname = surname && surname.content && surname.content.strip self.email_addresses = load_string_array(node, 'md:EmailAddress') self.telephone_numbers = load_string_array(node, 'md:TelephoneNumber') self end |