Class: SAML2::Organization
- Inherits:
-
Object
- Object
- SAML2::Organization
- Defined in:
- lib/saml2/organization.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build(builder) ⇒ Object
- #display_name(lang = nil) ⇒ Object
-
#initialize(name, display_name, url) ⇒ Organization
constructor
A new instance of Organization.
- #name(lang = nil) ⇒ Object
- #url(lang = nil) ⇒ Object
Constructor Details
#initialize(name, display_name, url) ⇒ Organization
Returns a new instance of Organization.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/saml2/organization.rb', line 13 def initialize(name, display_name, url) if !name.is_a?(Hash) name = { nil => name} end if !display_name.is_a?(Hash) display_name = { nil => display_name } end if !url.is_a?(Hash) url = { nil => url } end @name, @display_name, @url = name, display_name, url end |
Class Method Details
.from_xml(node) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/saml2/organization.rb', line 5 def self.from_xml(node) return nil unless node new(nodes_to_hash(node.xpath('md:OrganizationName', Namespaces::ALL)), nodes_to_hash(node.xpath('md:OrganizationDisplayName', Namespaces::ALL)), nodes_to_hash(node.xpath('md:OrganizationURL', Namespaces::ALL))) end |
Instance Method Details
#build(builder) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/saml2/organization.rb', line 39 def build(builder) builder['md'].Organization do |builder| self.class.build(builder, @name, 'OrganizationName') self.class.build(builder, @display_name, 'OrganizationDisplayName') self.class.build(builder, @url, 'OrganizationURL') end end |
#display_name(lang = nil) ⇒ Object
31 32 33 |
# File 'lib/saml2/organization.rb', line 31 def display_name(lang = nil) self.class.localized_name(@display_name, lang) end |
#name(lang = nil) ⇒ Object
27 28 29 |
# File 'lib/saml2/organization.rb', line 27 def name(lang = nil) self.class.localized_name(@name, lang) end |
#url(lang = nil) ⇒ Object
35 36 37 |
# File 'lib/saml2/organization.rb', line 35 def url(lang = nil) self.class.localized_name(@url, lang) end |