Class: Robin::Actions::Followers

Inherits:
Object
  • Object
show all
Defined in:
lib/robin/actions/followers.rb

Instance Method Summary collapse

Constructor Details

#initialize(user = nil) ⇒ Followers

Returns a new instance of Followers.



3
4
5
# File 'lib/robin/actions/followers.rb', line 3

def initialize(user = nil)
  @user = user
end

Instance Method Details

#execute(client, output, input) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/robin/actions/followers.rb', line 7

def execute(client, output, input)
  begin
    if @user
      followers = client.followers(@user)
    else
      followers = client.followers
    end
    followers.each do |follower|
      output.puts "#{follower.name} (#{follower.screen_name})"
    end
  rescue Twitter::Error::NotFound => e
    output.puts "This user does not exist"
  end
end