lib/activite/http/oauth.rb in activite-0.1.0 vs lib/activite/http/oauth.rb in activite-0.2.0

- old
+ new

@@ -2,20 +2,21 @@ module Activite module HTTP module OAuthClient attr_accessor :consumer_key, :consumer_secret, :token, :secret + attr_writer :consumer DEFAULT_OPTIONS = { site: 'https://oauth.withings.com', proxy: nil, request_token_path: '/account/request_token', authorize_path: '/account/authorize', access_token_path: '/account/access_token', scheme: :query_string } - + def request_token(options = {}) consumer.get_request_token(options) end def authorize_url(token, secret, options = {}) @@ -32,16 +33,16 @@ end def existing_access_token(token, secret) OAuth::AccessToken.new(consumer, token, secret) end - + def connected? !@access_token.nil? end private - + def consumer @consumer ||= OAuth::Consumer.new(@consumer_key, @consumer_secret, DEFAULT_OPTIONS) end end end