Class: SAML2::Contact
- Inherits:
-
Object
- Object
- SAML2::Contact
- Defined in:
- lib/saml2/contact.rb
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.
Class Method Summary collapse
Instance Method Summary collapse
- #build(builder) ⇒ Object
-
#initialize(type = Type::OTHER) ⇒ Contact
constructor
A new instance of Contact.
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 |
Class Method Details
.from_xml(node) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/saml2/contact.rb', line 15 def self.from_xml(node) return nil unless node result = new(node['contactType']) company = node.at_xpath('md:Company', Namespaces::ALL) result.company = company && company.content && company.content.strip given_name = node.at_xpath('md:GivenName', Namespaces::ALL) result.given_name = given_name && given_name.content && given_name.content.strip surname = node.at_xpath('md:SurName', Namespaces::ALL) result.surname = surname && surname.content && surname.content.strip result.email_addresses = Base.load_string_array(node, 'md:EmailAddress') result.telephone_numbers = Base.load_string_array(node, 'md:TelephoneNumber') result end |
Instance Method Details
#build(builder) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/saml2/contact.rb', line 36 def build(builder) builder['md'].ContactPerson('contactType' => type) do |builder| builder['md'].Company(company) if company builder['md'].GivenName(given_name) if given_name builder['md'].SurName(surname) if surname email_addresses.each do |email| builder['md'].EmailAddress(email) end telephone_numbers.each do |tel| builder['md'].TelephoneNumber(tel) end end end |