Class: Pry::SendTweet::TwitterAction

Inherits:
BaseCommand
  • Object
show all
Includes:
DeleteTweetActions, FollowActions, LikeActions, MuteActions, ProfileActions, SuggestedActions
Defined in:
lib/pry/send_tweet/commands/twitter_action.rb

Defined Under Namespace

Modules: DeleteTweetActions, FollowActions, LikeActions, MuteActions, ProfileActions, SuggestedActions

Constant Summary

Constants included from TimeAgoInWords

TimeAgoInWords::VERSION

Instance Method Summary collapse

Methods included from DeleteTweetActions

#delete_retweet, #delete_tweet

Methods included from MuteActions

#mute_user, #unmute_user

Methods included from FollowActions

#follow_user, #show_followers, #show_following, #unfollow_user

Methods included from LikeActions

#like_tweet, #unlike_tweet

Methods included from SuggestedActions

#suggested_lang, #suggested_topics, #suggested_users

Methods included from ProfileActions

#set_profile_banner_image, #set_profile_bio, #set_profile_image, #set_profile_link_color, #set_profile_location, #set_profile_name, #set_profile_url

Methods inherited from BaseCommand

inherited

Methods included from PagingSupport

#page, #page_error, #page_ok

Methods included from UserRenderer

#render_user

Methods included from TweetRenderer

#render_tweets

Methods included from TimeAgoInWords

time_ago_in_words

Instance Method Details

#options(o) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/pry/send_tweet/commands/twitter_action.rb', line 24

def options(o)
  #
  # Like / unlike tweets
  #
  o.on 'like-tweet=', 'Like one or more tweets', as: Array
  o.on 'unlike-tweet=', 'Unlike one or more tweets', as: Array
  #
  # Following / unfollowing
  #
  o.on 'follow=', 'Follow one or more users', as: Array
  o.on 'unfollow=', 'Unfollow one or more users', as: Array
  o.on 'show-followers=', 'Show the newest users to have followed you or ' \
                          'another user', argument: :optional
  o.on 'show-following', 'Show the newest users you currently follow'
  #
  # Delete tweets and reweets
  #
  o.on 'delete-retweet=', 'Delete one or more retweets', as: Array
  o.on 'delete-tweet=', 'Delete one or more tweets', as: Array
  #
  # Retweet a tweet
  #
  o.on 'retweet=', 'Retweet one or more tweets', as: Array
  #
  # Profile management
  #
  o.on 'set-profile-name=',         'Set the name visible on your profile'
  o.on 'set-profile-bio',           'Set the description visible on your profile'
  o.on 'set-profile-location',      'Set the location visible on your profile'
  o.on 'set-profile-url=',          'Set the URL visible on your profile'
  o.on 'set-profile-banner-image=', 'Set the banner image visible on your profile'
  o.on 'set-profile-image=',        'Set profile photo'
  o.on 'set-profile-link-color=',   'Set the color (as a hex value) of links that ' \
                                    'are visible on your profiles timeline '
  #
  # Suggestions
  #
  o.on 'suggested-topics', 'View topics suggested by Twitter'
  o.on 'suggested-users=', 'A topic from which to view users Twitter ' \
                           'suggests following'
  o.on 'suggested-lang=', 'Restrict suggestion results to a specific language, ' \
                          'given in ISO 639-1 format. Default is "en"'
  #
  # Muting
  #
  o.on 'mute-user=', 'One or more usernames to mute', as: Array
  o.on 'unmute-user=', 'One or more usernames to unmute', as: Array
end

#processObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/pry/send_tweet/commands/twitter_action.rb', line 73

def process
  super
  case
  when opts.present?('like-tweet') then like_tweet(opts['like-tweet'])
  when opts.present?('unlike-tweet') then unlike_tweet(opts['unlike-tweet'])
  when opts.present?('follow') then follow_user(opts['follow'])
  when opts.present?('unfollow') then unfollow_user(opts['unfollow'])
  when opts.present?('delete-tweet') then delete_tweet(opts['delete-tweet'])
  when opts.present?('delete-retweet') then delete_retweet(opts['delete-retweet'])
  when opts.present?('retweet') then retweet_tweet(opts['retweet'])
  when opts.present?('set-profile-banner-image') then set_profile_banner_image(opts['set-profile-banner-image'])
  when opts.present?('set-profile-name') then set_profile_name(opts['set-profile-name'])
  when opts.present?('set-profile-image') then set_profile_image(opts['set-profile-image'])
  when opts.present?('set-profile-url') then set_profile_url(opts['set-profile-url'])
  when opts.present?('set-profile-location') then set_profile_location
  when opts.present?('set-profile-link-color') then set_profile_link_color(opts['set-profile-link-color'])
  when opts.present?('set-profile-bio') then set_profile_bio
  when opts.present?('suggested-topics') then suggested_topics
  when opts.present?('suggested-users') then suggested_users(opts['suggested-users'])
  when opts.present?('mute-user') then mute_user(opts['mute-user'])
  when opts.present?('unmute-user') then unmute_user(opts['unmute-user'])
  when opts.present?('show-followers') then show_followers(opts['show-followers'])
  when opts.present?('show-following') then show_following(opts['show-following'])
  end
end