Class: Twitterland::Mrtweet
- Inherits:
-
Object
- Object
- Twitterland::Mrtweet
- Includes:
- HTTParty
- Defined in:
- lib/twitterland/mrtweet.rb
Instance Attribute Summary collapse
-
#is_user ⇒ Object
readonly
Check whether the given user is a MrTweet user (always call API).
-
#most_attention_towards ⇒ Object
readonly
Most attention towards.
-
#profile ⇒ Object
readonly
Returns MrTweet statistics of the given user.
-
#recommendations ⇒ Object
readonly
Returns the latest recommendations the given user received on MrTweet.
Instance Method Summary collapse
-
#initialize(api_key, username) ⇒ Mrtweet
constructor
get your api key at api.mrtweet.com/newapi.
-
#is_user? ⇒ Boolean
Check whether the given user is a MrTweet user (caches first request).
-
#recommend(reason, friend_name) ⇒ Object
Recommend a user.
Constructor Details
#initialize(api_key, username) ⇒ Mrtweet
get your api key at api.mrtweet.com/newapi
10 11 12 13 14 |
# File 'lib/twitterland/mrtweet.rb', line 10 def initialize(api_key, username) @username = username @api_key = api_key @is_user = self.is_user end |
Instance Attribute Details
#is_user ⇒ Object (readonly)
Check whether the given user is a MrTweet user (always call API)
Twitterland::Mrtweet.new(api_key,'bradleyjoyce').is_user
19 20 21 |
# File 'lib/twitterland/mrtweet.rb', line 19 def is_user @is_user end |
#most_attention_towards ⇒ Object (readonly)
Most attention towards
Twitterland::Mrtweet.new(api_key,'bradleyjoyce').most_attention_towards
52 53 54 |
# File 'lib/twitterland/mrtweet.rb', line 52 def most_attention_towards @most_attention_towards end |
#profile ⇒ Object (readonly)
Returns MrTweet statistics of the given user
Twitterland::Mrtweet.new(api_key,'bradleyjoyce').profile
33 34 35 |
# File 'lib/twitterland/mrtweet.rb', line 33 def profile @profile end |
#recommendations ⇒ Object (readonly)
Returns the latest recommendations the given user received on MrTweet
Twitterland::Mrtweet.new(api_key,'bradleyjoyce').recommendations
42 43 44 |
# File 'lib/twitterland/mrtweet.rb', line 42 def recommendations @recommendations end |
Instance Method Details
#is_user? ⇒ Boolean
Check whether the given user is a MrTweet user (caches first request)
Twitterland::Mrtweet.new(api_key,'bradleyjoyce').is_user?
26 27 28 |
# File 'lib/twitterland/mrtweet.rb', line 26 def is_user? @is_user ||= self.is_user end |
#recommend(reason, friend_name) ⇒ Object
Recommend a user
reason = "Wynn is an awesome entrepreneur, rubyist, designer and friend! Follow him for his useful and entertaining tweets!"
friend_name = "pengwynn"
Twitterland::Mrtweet.new(api_key,'bradleyjoyce').recommend(reason,friend_name)
63 64 65 66 67 |
# File 'lib/twitterland/mrtweet.rb', line 63 def recommend(reason, friend_name) if is_user? Mash.new(self.class.post("/recommend/#{@username}/#{@api_key}.json", :body => { :reason => reason, :friend_name => friend_name})).status == "success" end end |