lib/oauth/models/consumers/services/google_token.rb in oauth-plugin-0.3.12 vs lib/oauth/models/consumers/services/google_token.rb in oauth-plugin-0.3.13

- old
+ new

@@ -1,5 +1,7 @@ +require 'portablecontacts' + class GoogleToken < ConsumerToken GOOGLE_SETTINGS={ :site=>"https://www.google.com", :request_token_path => "/accounts/OAuthGetRequestToken", :authorize_path => "/accounts/OAuthAuthorizeToken", @@ -11,31 +13,15 @@ end def self.create_consumer(options={}) OAuth::Consumer.new credentials[:key],credentials[:secret],GOOGLE_SETTINGS.merge(options) end - - def self.portable_contacts_consumer - @portable_contacts_consumer||= create_consumer :site=>"http://www-opensocial.googleusercontent.com" - end - - + def self.get_request_token(callback_url, scope=nil) consumer.get_request_token({:oauth_callback=>callback_url}, :scope=>scope||credentials[:scope]||"http://www-opensocial.googleusercontent.com/api/people") end def portable_contacts - @portable_contacts||= GooglePortableContacts.new(OAuth::AccessToken.new( self.class.portable_contacts_consumer, token, secret)) + @portable_contacts||= PortableContacts::Client.new "http://www-opensocial.googleusercontent.com/api/people", client end - - class GooglePortableContacts < Oauth::Models::Consumers::SimpleClient - def me - get("/api/people/@me/@self") - end - - def all - get("/api/people/@me/@all") - end - - end end \ No newline at end of file