Class: Identity::AuthenticationResult

Inherits:
Object
  • Object
show all
Defined in:
lib/identity.rb

Overview

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <authentication_pretext>

<name>guest3f4c5a36a65d46e2</name>
<result xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"authenticationResult\" confidence=\"0.0\" level=\"0\" code=\"0\" message=\"OK\">SUCCESS</result>
<display_item name=\"passphrase\"><display_name>Password</display_name><form_element>&lt;input id=&quot;AuthParam0&quot; type=&quot;password&quot; name=&quot;passphrase&quot; class=&quot;field required&quot; /&gt;</form_element><nickname>Guest Password</nickname></display_item>

</authentication_pretext>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ AuthenticationResult

Returns a new instance of AuthenticationResult.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/identity.rb', line 17

def initialize(xml) 
  r = XmlSimple.xml_in(xml, { 'ForceArray' => ['display_item'] })
  self.result = r['result']
  self.name = r['name']

  if result['content'] == 'SUCCESS' || result['content'] == 'CONTINUE'
    if r['display_item'] && r['display_item'].length > 0
      self.display_items = Array.new        
      r['display_item'].each_with_index { |di, index| self.display_items[index] = di }
    end
  end
end

Instance Attribute Details

#display_itemsObject

Returns the value of attribute display_items.



15
16
17
# File 'lib/identity.rb', line 15

def display_items
  @display_items
end

#nameObject

Returns the value of attribute name.



15
16
17
# File 'lib/identity.rb', line 15

def name
  @name
end

#resultObject

Returns the value of attribute result.



15
16
17
# File 'lib/identity.rb', line 15

def result
  @result
end