Class: UserStreamReceiver

Inherits:
Object
  • Object
show all
Includes:
OAuth::CLI::Twitter
Defined in:
lib/user-stream-receiver.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pit_file = 'user-stream-receiver') ⇒ UserStreamReceiver

Returns a new instance of UserStreamReceiver.



10
11
12
# File 'lib/user-stream-receiver.rb', line 10

def initialize(pit_file = 'user-stream-receiver')
  @pit_file = pit_file
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



8
9
10
# File 'lib/user-stream-receiver.rb', line 8

def access_token
  @access_token
end

#pit_fileObject

Returns the value of attribute pit_file.



7
8
9
# File 'lib/user-stream-receiver.rb', line 7

def pit_file
  @pit_file
end

Class Method Details

.new_from_access_token(access_token) ⇒ Object



14
15
16
17
18
# File 'lib/user-stream-receiver.rb', line 14

def self.new_from_access_token(access_token)
  me = self.new
  me.access_token = access_token
  me
end

Instance Method Details

#run(&block) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/user-stream-receiver.rb', line 24

def run(&block)
  loop {
    begin
      self.process &block
    rescue => error
      self.logger.warn error
      sleep 1
    end
  }
end