Class: SoTweet::User
- Inherits:
-
Object
- Object
- SoTweet::User
- Defined in:
- lib/so_tweet.rb
Instance Method Summary collapse
-
#initialize(consumer_key, consumer_secret, access_token, access_token_secret) ⇒ User
constructor
A new instance of User.
- #tweet(text) ⇒ Object
Constructor Details
#initialize(consumer_key, consumer_secret, access_token, access_token_secret) ⇒ User
Returns a new instance of User.
11 12 13 14 15 |
# File 'lib/so_tweet.rb', line 11 def initialize(consumer_key,consumer_secret,access_token,access_token_secret) consumer = OAuth::Consumer.new(consumer_key,consumer_secret,:site=>'https://api.twitter.com') oauth_token = OAuth::AccessToken.new(consumer,access_token,access_token_secret) @user = OAuthRubytter.new(oauth_token) end |
Instance Method Details
#tweet(text) ⇒ Object
17 18 19 |
# File 'lib/so_tweet.rb', line 17 def tweet(text) text.length > 140 ? @user.update(text[0,140]) : @user.update(text) end |