Module: TweetWatch::Client

Included in:
CLI, Monitor
Defined in:
lib/tweet_watch/client.rb

Instance Method Summary collapse

Instance Method Details

#client(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/tweet_watch/client.rb', line 4

def client(options = {})
  return @client if options.nil? && @client  
   
   = TweetWatch.config.(options[:screen_name])
        
  @client = Twitter::REST::Client.new do |config|
    config.consumer_key        = .consumer_key
    config.consumer_secret     = .consumer_secret
    config.access_token        = .access_token
    config.access_token_secret = .access_token_secret
  end
end

#streaming_client(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tweet_watch/client.rb', line 17

def streaming_client(options = {})
  return @client if options.nil? && @client
  
   = TweetWatch.config.(options[:screen_name])
     
  @client = Twitter::Streaming::Client.new do |config|
    config.consumer_key        = .consumer_key
    config.consumer_secret     = .consumer_secret
    config.access_token        = .access_token
    config.access_token_secret = .access_token_secret
  end
end