Sha256: 9e50618f5f1a9af6da5663eb2ec52481b87297b9ae188ad8ee61470cb0095d2e
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require 'oauth' module Activite module HTTP module OAuthClient attr_accessor :consumer_key, :consumer_secret, :token, :secret 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 = {}) request_token = OAuth::RequestToken.new(consumer, token, secret) request_token.authorize_url(options) end def access_token(token, secret, options = {}) request_token = OAuth::RequestToken.new(consumer, token, secret) @access_token = request_token.get_access_token(options) @token = @access_token.token @secret = @access_token.secret @access_token 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activite-0.1.0 | lib/activite/http/oauth.rb |