Sha256: 04cb407b0b8a5de56c62f3420c2d867e6719f692064716410c779ab17a6e85ba

Contents?: true

Size: 803 Bytes

Versions: 18

Compression:

Stored size: 803 Bytes

Contents

# Goes through the entries in your OAUTH_CREDENTIALS and either loads the class required
# or subclasses ConsumerToken with the name.
#
# So an entry called "my_service" will create a class MyServiceToken which you can 
# connect with has_one to your user model.
if defined? ConsumerToken && defined? OAUTH_CREDENTIALS
  OAUTH_CREDENTIALS.each do |key, value|
    class_name=value[:class_name]||"#{key.to_s.classify}Token"
    unless Object.const_defined?(class_name.to_sym)
      if File.exists?(File.join(File.dirname(__FILE__), "services","#{key.to_s}_token.rb"))
        require File.join(File.dirname(__FILE__), "services","#{key.to_s}_token")
      else
        super_class = value[:super_class]||"ConsumerToken"
        eval "class #{class_name} < #{super_class} ;end"
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
filiptepper-oauth-plugin-0.3.11 lib/oauth/models/consumers/service_loader.rb
pelle-oauth-plugin-0.3.10 lib/oauth/models/consumers/service_loader.rb
pelle-oauth-plugin-0.3.11 lib/oauth/models/consumers/service_loader.rb
pelle-oauth-plugin-0.3.5 lib/oauth/models/consumers/service_loader.rb
pelle-oauth-plugin-0.3.6 lib/oauth/models/consumers/service_loader.rb
pelle-oauth-plugin-0.3.7 lib/oauth/models/consumers/service_loader.rb
pelle-oauth-plugin-0.3.8 lib/oauth/models/consumers/service_loader.rb
pelle-oauth-plugin-0.3.9 lib/oauth/models/consumers/service_loader.rb
oauth-plugin-0.3.13 lib/oauth/models/consumers/service_loader.rb
oauth-plugin-0.3.12 lib/oauth/models/consumers/service_loader.rb
filiptepper-oauth-plugin-0.3.12 lib/oauth/models/consumers/service_loader.rb
oauth-plugin-0.3.11 lib/oauth/models/consumers/service_loader.rb
oauth-plugin-0.3.7 lib/oauth/models/consumers/service_loader.rb
oauth-plugin-0.3.5 lib/oauth/models/consumers/service_loader.rb
oauth-plugin-0.3.6 lib/oauth/models/consumers/service_loader.rb
oauth-plugin-0.3.9 lib/oauth/models/consumers/service_loader.rb
oauth-plugin-0.3.10 lib/oauth/models/consumers/service_loader.rb
oauth-plugin-0.3.8 lib/oauth/models/consumers/service_loader.rb