Module: StealthFavs::Main
Constant Summary collapse
- CredentialFile =
put your authentication keys in ~/.credential.yml
File.('~') + '/.credential.yml'
Instance Method Summary collapse
- #cmd_id(id, verbose: true, count: 20, interval: 0.1) ⇒ Object
- #cmd_user(name, verbose: true, count: 20, interval: 0.1) ⇒ Object
Instance Method Details
#cmd_id(id, verbose: true, count: 20, interval: 0.1) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/stealth_favs/main.rb', line 26 def cmd_id(id, verbose: true, count: 20, interval: 0.1) cl = config_twitter (1..count).each do |i| cl.favorite id puts "[#{i}] Favorited status #{id}" if verbose sleep interval cl.unfavorite id puts "[#{i}] Unfavorited status #{id}" if verbose sleep interval end rescue Twitter::Error::NotFound => e STDERR.puts "status is not found" raise e rescue => e cl.unfavorite id raise e end |
#cmd_user(name, verbose: true, count: 20, interval: 0.1) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/stealth_favs/main.rb', line 44 def cmd_user(name, verbose: true, count: 20, interval: 0.1) cl = config_twitter begin id = cl.user_timeline(name).first.id puts "A target status is #{id}." if verbose rescue Twitter::Error::NotFound => e STDERR.puts "user is not found" raise e end cmd_id id, verbose: verbose, count: count, interval: interval end |