Module: AuthlogicConnect

Defined in:
lib/authlogic_connect/engine.rb,
lib/authlogic_connect/authlogic_connect.rb

Defined Under Namespace

Modules: Common, Oauth, Openid Classes: CallbackFilter, Engine

Constant Summary collapse

KEY =
"connect"
OAUTH =
"oauth"
OPEN_ID =
"open_id"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



8
9
10
# File 'lib/authlogic_connect/authlogic_connect.rb', line 8

def config
  @config
end

Class Method Details

.consumer(key) ⇒ Object



42
43
44
# File 'lib/authlogic_connect/authlogic_connect.rb', line 42

def consumer(key)
  token(key).consumer
end

.credentials(service) ⇒ Object



21
22
23
# File 'lib/authlogic_connect/authlogic_connect.rb', line 21

def credentials(service)
  key("#{KEY}.#{service.to_s}")
end

.include?(service) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/authlogic_connect/authlogic_connect.rb', line 33

def include?(service)
  !credentials(service).nil?
end

.key(path) ⇒ Object



15
16
17
18
19
# File 'lib/authlogic_connect/authlogic_connect.rb', line 15

def key(path)
  result = self.config
  path.to_s.split(".").each { |node| result = result[node.to_sym] if result }
  result
end

.service_namesObject



29
30
31
# File 'lib/authlogic_connect/authlogic_connect.rb', line 29

def service_names
  services.keys.collect(&:to_s)
end

.servicesObject



25
26
27
# File 'lib/authlogic_connect/authlogic_connect.rb', line 25

def services
  key(KEY)
end

.token(key) ⇒ Object



37
38
39
40
# File 'lib/authlogic_connect/authlogic_connect.rb', line 37

def token(key)
  raise "can't find key '#{key.to_s}' in AuthlogicConnect.config" unless AuthlogicConnect.include?(key) and !key.to_s.empty?
  "#{key.to_s.camelcase}Token".constantize
end