Skip to content

Commit

Permalink
Merge branch 'master' of github.com:becarella/let_me_in
Browse files Browse the repository at this point in the history
  • Loading branch information
becarella committed May 23, 2012
2 parents 74f5cf7 + 2102621 commit 27af779
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ gem 'omniauth-identity'
gem 'omniauth-instagram'
gem 'omniauth-twitter', '0.0.8'
gem 'omniauth-banters', :git => "git://github.com/becarella/omniauth-banters.git"
gem 'omniauth-foursquare'
gem 'omniauth-tumblr'
gem 'omniauth-lastfm'

gem 'hbs'
gem 'handlebars_assets', :git => 'git://github.com/becarella/handlebars_assets.git'
Expand Down
15 changes: 14 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,25 @@ GEM
omniauth (1.1.0)
hashie (~> 1.2)
rack
omniauth-foursquare (0.0.7)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.0)
omniauth-identity (1.0.0)
omniauth (~> 1.0)
omniauth-instagram (1.0.0)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.0)
omniauth-lastfm (0.0.2)
omniauth-oauth (~> 1.0)
rest-client (~> 1.6.6)
omniauth-oauth (1.0.1)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.0.2)
oauth2 (~> 0.6.0)
omniauth (~> 1.0)
omniauth-tumblr (1.0)
omniauth-oauth (~> 1.0)
omniauth-twitter (0.0.8)
omniauth-oauth (~> 1.0)
pg (0.13.2)
Expand Down Expand Up @@ -163,6 +171,8 @@ GEM
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.10.0)
rspec-core (~> 2.10.0)
rspec-expectations (~> 2.10.0)
Expand Down Expand Up @@ -196,7 +206,7 @@ GEM
sprockets (2.0.4)
hike (~> 1.2)
rack (~> 1.0)
tilt (!= 1.3.0, ~> 1.1)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
therubyracer (0.9.10)
libv8 (~> 3.3.10)
Expand Down Expand Up @@ -224,8 +234,11 @@ DEPENDENCIES
jquery-rails
let_me_in!
omniauth-banters!
omniauth-foursquare
omniauth-identity
omniauth-instagram
omniauth-lastfm
omniauth-tumblr
omniauth-twitter (= 0.0.8)
pg
render_or_redirect!
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/let_me_in/auth_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ def callback
end

end
end
end
36 changes: 36 additions & 0 deletions lib/let_me_in/linked_accounts/lastfm_account.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module LetMeIn
module LinkedAccounts
module LastfmAccount
extend ActiveSupport::Concern


module InstanceMethods

def link(auth_hash, user)
update_attributes({
:user_id => user.id,
:token => auth_hash[:credentials][:token],
:secret => nil, #auth_hash[:credentials][:secret],
:app_user_id => auth_hash[:uid],
:app_username => auth_hash[:info][:name],
:url => "http://www.last.fm/user/#{auth_hash[:uid]}",
:image_url => nil #auth_hash[:info][:image]
})
self
end

end

module ClassMethods

def link(auth_hash, user)
account = self.find_or_create_by_user_id(:user_id => user.id)
account.link(auth_hash, user)
end

end


end
end
end
6 changes: 6 additions & 0 deletions spec/dummy/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
class ApplicationController < ActionController::Base
protect_from_forgery

before_filter :register_partials if Rails.env.development?

def register_partials
HandlebarsConfig.register_partials
end
end
3 changes: 3 additions & 0 deletions spec/dummy/app/models/lastfm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Lastfm < LinkedAccount
include LetMeIn::LinkedAccounts::LastfmAccount
end
19 changes: 17 additions & 2 deletions spec/dummy/config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,26 @@
provider :banters, Banters.key, Banters.secret, :name => "banters"
LetMeIn::Engine.config.account_types << Banters
end


if Foursquare.available?
provider :foursquare, Foursquare.key, Foursquare.secret, :name => "foursquare"
LetMeIn::Engine.config.account_types << Foursquare
end

if Instagram.available?
provider :instagram, Instagram.key, Instagram.secret, :display => 'touch', :name => "instagram"
LetMeIn::Engine.config.account_types << Instagram
end

if Lastfm.available?
provider :lastfm, Lastfm.key, Lastfm.secret, :name => "lastfm"
LetMeIn::Engine.config.account_types << Lastfm
end

if Tumblr.available?
provider :tumblr, Tumblr.key, Tumblr.secret, :name => "tumblr"
LetMeIn::Engine.config.account_types << Tumblr
end

if Twitter.available?
provider :twitter, Twitter.key, Twitter.secret, :name => "twitter"
Expand All @@ -34,4 +49,4 @@
}
end

OmniAuth.config.logger = Rails.logger
OmniAuth.config.logger = Rails.logger
Binary file removed spec/dummy/db/development.sqlite3
Binary file not shown.

0 comments on commit 27af779

Please sign in to comment.