Module: OAuthRails
- Defined in:
- lib/oauth_rails.rb,
lib/oauth_rails/engine.rb,
lib/oauth_rails/version.rb
Defined Under Namespace
Classes: Engine
Constant Summary collapse
- DEFAULT_SETTINGS =
{ oauth_host: nil, oauth_request_token_path: '/v1/request_token', oauth_authorize_path: '/v1/authorize', oauth_access_token_path: '/v1/access_token', oauth_consumer_key: nil, oauth_consumer_secret: nil, oauth_callback_url: 'http://localhost:3000/oauth/authorize', oauth_verifier_key: :oauth_verifier, proc_initialize_handshake: Proc.new { |controller_context| }, proc_initialize_authorization_failed: Proc.new { |controller_context| OAuthRails.call(:authorization_failed, controller_context) }, proc_authorization_successful: Proc.new { |controller_context, token, secret| raise "Run 'OAuthRails.setup()' to set a ':proc_authorization_successful'" }, proc_authorization_failed: Proc.new { |controller_context| raise "Run 'OAuthRails.setup()' to set a ':proc_authorization_failed'" } }
- VERSION =
"0.0.1"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(name, controller_context, *args) ⇒ Object
39 40 41 42 |
# File 'lib/oauth_rails.rb', line 39 def self.call(name, controller_context, *args) name = ['proc_',name].join config.send(name).call(controller_context, *args) end |
.config ⇒ Object
29 30 31 |
# File 'lib/oauth_rails.rb', line 29 def self.config @config end |
.setup(user_settings) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/oauth_rails.rb', line 21 def self.setup(user_settings) settings = DEFAULT_SETTINGS.merge(user_settings) validate_settings!(settings) @config = ::OpenStruct.new(settings) end |
Instance Method Details
#config ⇒ Object
33 34 35 36 37 |
# File 'lib/oauth_rails.rb', line 33 def config return self.config if self.config raise "You have run OAuthRails.setup() to set the configuration!" end |