Sha256: 6a2ae9f6a99e3ec7dd931aed5ec1fade432082d24add8893b466a1a90d99cdcc
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
require 'oauth' 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 = {}) 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.2.0 | lib/activite/http/oauth.rb |