Sha256: 75206d988858d32a4fb5d6855731e7d18ca74e198f029519c25e3da626b2c869
Contents?: true
Size: 1.27 KB
Versions: 4
Compression:
Stored size: 1.27 KB
Contents
module Tweetable class TwitterClient attr_accessor :consumer_token, :consumer_secret, :authorization #:oauth_access_token, :oauth_access_secret def method_missing(sym, *args, &block) raise TweetableAuthError.new('Not authorized. You must login or authorize the client.') if @client.nil? @client.send sym, *args, &block end def authorize(token, secret, authorization) raise TweetableAuthError if authorization.nil? self.authorization = authorization self.consumer_token = token self.consumer_secret = secret self.oauth.authorize_from_access(self.authorization.oauth_access_token, self.authorization.oauth_access_secret) @client = Twitter::Base.new(self.oauth) self end def login(username, password) @client = Twitter::Base.new(Twitter::HTTPAuth.new(username, password)) self end def oauth @oauth ||= Twitter::OAuth.new(self.consumer_token, self.consumer_secret) end def status status = self.rate_limit_status {:hourly_limit => status[:hourly_limit], :remaining_hits => status[:remaining_hits], :reset_time => status[:reset_time], :reset_time_in_seconds => status[:reset_time_in_seconds]} end end end
Version data entries
4 entries across 4 versions & 1 rubygems