Class: Devise::W3Adapter::IBMEmployee
- Inherits:
-
Struct
- Object
- Struct
- Devise::W3Adapter::IBMEmployee
- Defined in:
- lib/devise_w3_authenticatable/w3_adapter.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
Returns the value of attribute country.
-
#department ⇒ Object
Returns the value of attribute department.
-
#logon ⇒ Object
Returns the value of attribute logon.
-
#name ⇒ Object
Returns the value of attribute name.
-
#serial ⇒ Object
Returns the value of attribute serial.
-
#uid ⇒ Object
Returns the value of attribute uid.
-
#workplace ⇒ Object
Returns the value of attribute workplace.
Class Method Summary collapse
Instance Attribute Details
#country ⇒ Object
Returns the value of attribute country
16 17 18 |
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 16 def country @country end |
#department ⇒ Object
Returns the value of attribute department
16 17 18 |
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 16 def department @department end |
#logon ⇒ Object
Returns the value of attribute logon
16 17 18 |
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 16 def logon @logon end |
#name ⇒ Object
Returns the value of attribute name
16 17 18 |
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 16 def name @name end |
#serial ⇒ Object
Returns the value of attribute serial
16 17 18 |
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 16 def serial @serial end |
#uid ⇒ Object
Returns the value of attribute uid
16 17 18 |
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 16 def uid @uid end |
#workplace ⇒ Object
Returns the value of attribute workplace
16 17 18 |
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 16 def workplace @workplace end |
Class Method Details
.find_by_mail(mail) ⇒ Object
36 37 38 |
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 36 def find_by_mail(mail) parse_from_bluepages("http://bluepages.ibm.com/BpHttpApisv3/slaphapi?ibmperson/mail=#{mail}.list/byxml") end |
.parse_from_bluepages(bluepages_url) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 18 def parse_from_bluepages(bluepages_url) begin entry = Nokogiri::XML(open(bluepages_url)).css("entry").first uid = entry.attributes["dn"].to_s logon = entry.css("attr[name='mail'] value").children.first.to_s name = entry.css("attr[name='cn'] value").children.first.to_s serial = entry.css("attr[name='serialnumber'] value").children.first.to_s department = entry.css("attr[name='dept'] value").children.first.to_s country = entry.css("attr[name='co'] value").children.first.to_s workplace = entry.css("attr[name='physicaldeliveryofficename'] value").children.first.to_s new(uid, logon, name, serial, department, country, workplace) rescue nil end end |