app/models/soundcloud_auth/generic_user.rb in soundcloud-auth-0.1.0 vs app/models/soundcloud_auth/generic_user.rb in soundcloud-auth-0.1.1

- old
+ new

@@ -1,9 +1,9 @@ module SoundcloudAuth class GenericUser < ActiveRecord::Base - attr_protected :soundcloud_id, :remember_token, :remember_token_expires_at + attr_protected :soundcloud_id, :remember_token, :remember_token_expires_at, :access_token, :access_secret SOUNDCLOUD_ATTRIBUTES = [ :plan, :avatar_url, :website_title, @@ -65,11 +65,12 @@ raise ArgumentError, 'Must authenticate with an OAuth::AccessToken or the string access token and secret.' unless (token && secret) || token.is_a?(OAuth::AccessToken) token = OAuth::AccessToken.new(SoundcloudAuth.consumer, token, secret) unless token.is_a?(OAuth::AccessToken) - user_info = JSON.parse(token.get(SoundcloudAuth.path_prefix + '/me.json')) + response = token.get(SoundcloudAuth.path_prefix + '/me.json') + user_info = JSON.parse(response.body) if user = User.find_by_soundcloud_id(user_info['id'].to_s) user.assign_soundcloud_attributes(user_info) user.access_token = token.token user.access_secret = token.secret @@ -92,10 +93,10 @@ def utilize_default_validations true end def soundcloud - # OAuth::AccessToken.new(TwitterAuth.consumer, access_token, access_secret) + SoundcloudAuth::Dispatcher::Oauth.new(self) end def remember_me return false unless respond_to?(:remember_token)