Class: OpenID::Consumer::DiscoveryManager

Inherits:
Object
  • Object
show all
Defined in:
lib/openid/consumer/discovery_manager.rb

Overview

Manages calling discovery and tracking which endpoints have already been attempted.

Instance Method Summary collapse

Constructor Details

#initialize(session, url, session_key_suffix = nil) ⇒ DiscoveryManager

Returns a new instance of DiscoveryManager.



36
37
38
39
40
41
# File 'lib/openid/consumer/discovery_manager.rb', line 36

def initialize(session, url, session_key_suffix=nil)
  @url = url

  @session = session
  @session_key_suffix = session_key_suffix || 'auth'
end

Instance Method Details

#cleanup(force = false) ⇒ Object



65
66
67
68
69
70
71
72
73
74
# File 'lib/openid/consumer/discovery_manager.rb', line 65

def cleanup(force=false)
  manager = get_manager(force)
  if !manager.nil?
    service = manager.current
    destroy_manager(force)
  else
    service = nil
  end
  return service
end

#get_next_serviceObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/openid/consumer/discovery_manager.rb', line 43

def get_next_service
  manager = get_manager
  if !manager.nil? && manager.empty?
    destroy_manager
    manager = nil
  end

  if manager.nil?
    yadis_url, services = yield @url
    manager = create_manager(yadis_url, services)
  end

  if !manager.nil?
    service = manager.next
    store(manager)
  else
    service = nil
  end

  return service
end