Class: TwitterType::TwitterClientWrapper

Inherits:
TwitterClient show all
Defined in:
lib/twitterclientwrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client = TwitterClient.new) ⇒ TwitterClientWrapper

Returns a new instance of TwitterClientWrapper.



10
11
12
# File 'lib/twitterclientwrapper.rb', line 10

def initialize(client = TwitterClient.new)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/twitterclientwrapper.rb', line 8

def client
  @client
end

Instance Method Details

#gather_recent_tweets_for(screen_name) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/twitterclientwrapper.rb', line 14

def gather_recent_tweets_for (screen_name)
  begin
    @client.gather_recent_tweets_for(screen_name)
  rescue Twitter::RESTError => error
    raise ProtectedUserAccessError.new(error.to_s) if ProtectedUserAccessError.fits(error)
    raise InvalidUserAccessError.new(error.to_s) if InvalidUserAccessError.fits(error)
    raise TwitterClientError.new(error.to_s)
  end
end