Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pelle/oauth-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
pelle committed Jun 28, 2011
2 parents 419aa95 + ca661fc commit 4c7cf3f
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion generators/oauth_consumer/templates/controller.rb
Expand Up @@ -3,7 +3,7 @@ class OauthConsumersController < ApplicationController
include Oauth::Controllers::ConsumerController

def index
@consumer_tokens=ConsumerToken.all :conditions=>{:user_id=>current_user.id}
@consumer_tokens=ConsumerToken.all :conditions => {:user_id => current_user.id}
@services=OAUTH_CREDENTIALS.keys-@consumer_tokens.collect{|c| c.class.service_name}
end

Expand Down
66 changes: 33 additions & 33 deletions generators/oauth_consumer/templates/oauth_config.rb
Expand Up @@ -3,66 +3,66 @@
#
# eg. :twitter => TwitterToken, :hour_feed => HourFeedToken etc.
#
# OAUTH_CREDENTIALS={
# :twitter=>{
# :key=>"",
# :secret=>"",
# :client=>:twitter_gem, # :twitter_gem or :oauth_gem (defaults to :twitter_gem)
# OAUTH_CREDENTIALS => {
# :twitter => {
# :key => "",
# :secret => "",
# :client => :twitter_gem, # :twitter_gem or :oauth_gem (defaults to :twitter_gem)
# :expose => false, # expose client at /oauth_consumers/twitter/client see docs
# :allow_login => true # Use :allow_login => true to allow user to login to account
# },
# :google=>{
# :key=>"",
# :secret=>"",
# :google => {
# :key => "",
# :secret => "",
# :expose => false, # expose client at /oauth_consumers/google/client see docs
# :scope=>"" # see http://code.google.com/apis/gdata/faq.html#AuthScopes
# :scope => "" # see http://code.google.com/apis/gdata/faq.html#AuthScopes
# },
# :github=>{
# :github => {
# :key => "",
# :secret => "",
# :expose => false, # expose client at /oauth_consumers/twitter/client see docs
#
# },
# :facebook=>{
# :facebook => {
# :key => "",
# :secret => ""
# },
# :agree2=>{
# :key=>"",
# :secret=>""
# :agree2 => {
# :key => "",
# :secret => ""
# },
# :fireeagle=>{
# :key=>"",
# :secret=>""
# :fireeagle => {
# :key => "",
# :secret => ""
# },
# :oauth2_server => {
# :key=>"",
# :secret=>"",
# :key => "",
# :secret => "",
# :oauth_version => 2
# :options=>{ # OAuth::Consumer options
# :site=>"http://hourfeed.com" # Remember to add a site for a generic OAuth site
# :options => { # OAuth::Consumer options
# :site => "http://hourfeed.com" # Remember to add a site for a generic OAuth site
# }
# },
# :hour_feed=>{
# :key=>"",
# :secret=>"",
# :options=>{ # OAuth::Consumer options
# :site=>"http://hourfeed.com" # Remember to add a site for a generic OAuth site
# :hour_feed => {
# :key => "",
# :secret => "",
# :options => { # OAuth::Consumer options
# :site => "http://hourfeed.com" # Remember to add a site for a generic OAuth site
# }
# },
# :nu_bux=>{
# :key=>"",
# :secret=>"",
# :super_class=>"OpenTransactToken", # if a OAuth service follows a particular standard
# :nu_bux => {
# :key => "",
# :secret => "",
# :super_class => "OpenTransactToken", # if a OAuth service follows a particular standard
# # with a token implementation you can set the superclass
# # to use
# :options=>{ # OAuth::Consumer options
# :site=>"http://nubux.heroku.com"
# :options => { # OAuth::Consumer options
# :site => "http://nubux.heroku.com"
# }
# }
# }
#
OAUTH_CREDENTIALS={
OAUTH_CREDENTIALS = {
} unless defined? OAUTH_CREDENTIALS

load 'oauth/models/consumers/service_loader.rb'
Expand Up @@ -15,7 +15,7 @@ class ClientApplicationTest < ActiveSupport::TestCase
fixtures :users,:client_applications,:oauth_tokens

def setup
@application = ClientApplication.create :name=>"Agree2",:url=>"http://agree2.com",:user=>users(:quentin)
@application = ClientApplication.create :name => "Agree2", :url => "http://agree2.com", :user => users(:quentin)
create_consumer
end

Expand Down
12 changes: 6 additions & 6 deletions generators/oauth_provider/templates/clients_controller_spec.rb
Expand Up @@ -50,7 +50,7 @@ def do_get

it "should assign client_applications" do
do_get
assigns[:client_application].should==current_client_application
assigns[:client_application].should == current_client_application
end

it "should render show template" do
Expand All @@ -73,7 +73,7 @@ def do_get

it "should assign client_applications" do
do_get
assigns[:client_application].class.should==ClientApplication
assigns[:client_application].class.should == ClientApplication
end

it "should render show template" do
Expand All @@ -95,7 +95,7 @@ def do_get

it "should assign client_applications" do
do_get
assigns[:client_application].should==current_client_application
assigns[:client_application].should == current_client_application
end

it "should render edit template" do
Expand All @@ -108,7 +108,7 @@ def do_get
describe "create" do

def do_valid_post
post :create, 'client_application'=>{'name' => 'my site', :url=>"http://test.com"}
post :create, 'client_application' => {'name' => 'my site', :url => "http://test.com"}
@client_application = ClientApplication.last
end

Expand Down Expand Up @@ -150,11 +150,11 @@ def do_delete
describe "update" do

def do_valid_update
put :update, :id => '1', 'client_application'=>{'name' => 'updated site'}
put :update, :id => '1', 'client_application' => {'name' => 'updated site'}
end

def do_invalid_update
put :update, :id => '1', 'client_application'=>{'name' => nil}
put :update, :id => '1', 'client_application' => {'name' => nil}
end

it "should redirect to show client_application" do
Expand Down
10 changes: 5 additions & 5 deletions generators/oauth_provider/templates/clients_controller_test.rb
Expand Up @@ -54,7 +54,7 @@ def setup
end

def do_get
get :show, :id=>'3'
get :show, :id => '3'
end

def test_should_be_successful
Expand Down Expand Up @@ -169,12 +169,12 @@ def setup

def do_valid_post
@client_application.expects(:save).returns(true)
post :create,'client_application'=>{'name'=>'my site'}
post :create,'client_application' => {'name' => 'my site'}
end

def do_invalid_post
@client_application.expects(:save).returns(false)
post :create,:client_application=>{:name=>'my site'}
post :create,:client_application=>{:name => 'my site'}
end

def test_should_query_current_users_client_applications
Expand Down Expand Up @@ -248,12 +248,12 @@ def setup

def do_valid_update
@client_application.expects(:update_attributes).returns(true)
put :update, :id => '1', 'client_application' => {'name'=>'my site'}
put :update, :id => '1', 'client_application' => {'name' => 'my site'}
end

def do_invalid_update
@client_application.expects(:update_attributes).returns(false)
put :update, :id=>'1', 'client_application' => {'name'=>'my site'}
put :update, :id=>'1', 'client_application' => {'name' => 'my site'}
end

def test_should_query_current_users_client_applications
Expand Down
2 changes: 1 addition & 1 deletion generators/oauth_provider/templates/oauth2_token.rb
@@ -1,6 +1,6 @@
class Oauth2Token < AccessToken

def as_json(options={})
{:access_token=>token}
{:access_token => token}
end
end

0 comments on commit 4c7cf3f

Please sign in to comment.