Sha256: fb2579fc20d1cde3067b06fe12918a5e768e8a658e98313e1d3eaf1081472115

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

require 'oauth'
module Sorcery
  module Controller
    module Submodules
      module External
        module Protocols
          module Oauth1
            def oauth_version
              "1.0"
            end
          
            def get_request_token(token=nil,secret=nil)
              return ::OAuth::RequestToken.new(get_consumer(), token, secret) if token && secret
              
              get_consumer.get_request_token(:oauth_callback => @callback_url)
            end
          
            def authorize_url(args)
              get_request_token(
                args[:request_token],
                args[:request_token_secret]
              ).authorize_url({
                :oauth_callback => @callback_url
              })
            end
          
            def get_access_token(args)
              get_request_token(
                args[:request_token],
                args[:request_token_secret]
              ).get_access_token({
                :oauth_verifier => args[:oauth_verifier]
              })
            end
          
            protected
          
            def get_consumer
              ::OAuth::Consumer.new(@key, @secret, :site => @site)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sorcery-0.8.5 lib/sorcery/controller/submodules/external/protocols/oauth1.rb
sorcery-0.8.4 lib/sorcery/controller/submodules/external/protocols/oauth1.rb
sorcery-0.8.2 lib/sorcery/controller/submodules/external/protocols/oauth1.rb