Permalink
Browse files

updated initializer, added more help

  • Loading branch information...
1 parent 9cd749f commit 3be1f837ecb38ff3d5b39feb96089a88e8e84cb7 @gacha gacha committed May 17, 2011
Showing with 17 additions and 8 deletions.
  1. +15 −5 oa-more/lib/omniauth/strategies/draugiem.rb
  2. +2 −3 oa-more/spec/omniauth/strategies/draugiem_spec.rb
@@ -8,17 +8,27 @@ module Strategies
#
# Authenticate to draugiem.lv and frype.com and others.
#
- # @example Basic Usage
+ # @example Basic Rails Usage
+ #
+ # Add this to config/initializers/omniauth.rb
+ #
+ # Rails.application.config.middleware.use OmniAuth::Builder do
+ # provider :draugiem, 'App id', 'API Key'
+ # end
+ #
+ # @example Basic Rack example
+ #
+ # use Rack::Session::Cookie
+ # use OmniAuth::Strategies::Draugiem, 'App id', 'API Key'
#
- # use OmniAuth::Strategies::Draugiem, 'API Key', 'App id'
class Draugiem
include OmniAuth::Strategy
- attr_accessor :api_key, :app_id, :options
+ attr_accessor :app_id, :api_key
- def initialize(app, api_key, app_id)
+ def initialize(app, app_id, api_key)
super(app, :draugiem)
- @api_key = api_key
@app_id = app_id
+ @api_key = api_key
end
protected
@@ -5,11 +5,11 @@
include OmniAuth::Test::StrategyTestCase
def strategy
- [OmniAuth::Strategies::Draugiem, "abc",123]
+ [OmniAuth::Strategies::Draugiem, '123', "abc"]
end
it 'should initialize with api key and app id' do
- lambda{OmniAuth::Strategies::Draugiem.new({},'abc','123')}.should_not raise_error
+ lambda{OmniAuth::Strategies::Draugiem.new({},'123','abc')}.should_not raise_error
end
describe '/auth/draugiem' do
@@ -41,7 +41,6 @@ def strategy
}
}))
get '/auth/draugiem/callback?dr_auth_status=ok&dr_auth_code=123456'
- debugger
last_request.env['omniauth.auth']['credentials']['apikey'].should == "123456789"
last_request.env['omniauth.auth']['user_info']['location'].should == "Durbe"

0 comments on commit 3be1f83

Please sign in to comment.