Module: Pry::SendTweet::TwitterAction::FollowActions
- Included in:
- Pry::SendTweet::TwitterAction
- Defined in:
- lib/pry/send_tweet/commands/twitter_action/follow_actions.rb
Instance Method Summary collapse
- #follow_user(users) ⇒ Object
- #show_followers(pattern) ⇒ Object
- #show_following(pattern) ⇒ Object
- #unfollow_user(users) ⇒ Object
Instance Method Details
#follow_user(users) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/pry/send_tweet/commands/twitter_action/follow_actions.rb', line 2 def follow_user(users) users = search_str_for_users(*users) follows = twitter.follow(users) if follows.size > 0 page_ok "followed #{join_usernames(follows.map(&:screen_name))}." else page_error "are you already following #{join_usernames(users)} ..?" end rescue Twitter::Error => e page_error(e) end |
#show_followers(pattern) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/pry/send_tweet/commands/twitter_action/follow_actions.rb', line 26 def show_followers(pattern) followers = Array twitter.followers() __follow_filter!(followers, pattern) if pattern page numbered_list("Followers", followers) {|follower, index| render_user(follower) } rescue Twitter::Error => e page_error(e) end |
#show_following(pattern) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/pry/send_tweet/commands/twitter_action/follow_actions.rb', line 36 def show_following(pattern) followings = Array twitter.following() __follow_filter!(followings, pattern) if pattern page numbered_list("Following", followings) {|following, index| render_user(following) } rescue Twitter::Error => e page_error(e) end |
#unfollow_user(users) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pry/send_tweet/commands/twitter_action/follow_actions.rb', line 14 def unfollow_user(users) users = search_str_for_users(*users) unfollows = twitter.unfollow(users) if unfollows.size > 0 page_ok "unfollowed #{join_usernames(unfollows.map(&:screen_name))}." else page_error "did you already unfollow #{join_usernames(users)} ..?" end rescue Twitter::Error => e page_error(e) end |