Class: SAML2::Contact
Defined Under Namespace
Modules: Type
Instance Attribute Summary collapse
- #company ⇒ String?
- #email_addresses ⇒ Array<String>
- #given_name ⇒ String?
- #surname ⇒ String?
- #telephone_numbers ⇒ Array<String>
- #type ⇒ String
Attributes inherited from Base
Instance Method Summary collapse
-
#build(builder) ⇒ void
Serialize this object to XML, as part of a larger document.
-
#from_xml(node) ⇒ void
Parse an XML element into this object.
-
#initialize(type = Type::OTHER) ⇒ Contact
constructor
A new instance of Contact.
Methods inherited from Base
#decrypt, from_xml, #inspect, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml
Constructor Details
Instance Attribute Details
#company ⇒ String?
19 20 21 |
# File 'lib/saml2/contact.rb', line 19 def company @company end |
#email_addresses ⇒ Array<String>
21 22 23 |
# File 'lib/saml2/contact.rb', line 21 def email_addresses @email_addresses end |
#given_name ⇒ String?
19 20 21 |
# File 'lib/saml2/contact.rb', line 19 def given_name @given_name end |
#surname ⇒ String?
19 20 21 |
# File 'lib/saml2/contact.rb', line 19 def surname @surname end |
#telephone_numbers ⇒ Array<String>
21 22 23 |
# File 'lib/saml2/contact.rb', line 21 def telephone_numbers @telephone_numbers end |
#type ⇒ String
17 18 19 |
# File 'lib/saml2/contact.rb', line 17 def type @type end |
Instance Method Details
#build(builder) ⇒ void
This method returns an undefined value.
Serialize this object to XML, as part of a larger document
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/saml2/contact.rb', line 46 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) ⇒ void
This method returns an undefined value.
Parse an XML element into this object.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/saml2/contact.rb', line 32 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 |