Class: BirdGrinder::Tweeter::Streaming
- Inherits:
-
Object
- Object
- BirdGrinder::Tweeter::Streaming
- Defined in:
- lib/bird_grinder/tweeter/streaming.rb
Overview
Basic support for the twitter streaming api. Provides access to sample, filter, follow and track. Note that it will dispatch messages as :incoming_stream, with options.streaming_source set to the stream origin.
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
-
#filter(opts = {}) ⇒ Object
Start processing the filter stream.
-
#follow(*args) ⇒ Object
Start processing the filter stream with a given follow argument.
-
#initialize(parent) ⇒ Streaming
constructor
Initializes a streaming subclient for a given tweeter.
-
#sample(opts = {}) ⇒ Object
Start processing the sample stream.
-
#track(*args) ⇒ Object
Starts tracking a specific query.
Constructor Details
#initialize(parent) ⇒ Streaming
Initializes a streaming subclient for a given tweeter
21 22 23 24 |
# File 'lib/bird_grinder/tweeter/streaming.rb', line 21 def initialize(parent) @parent = parent logger.debug "Initializing Streaming Support" end |
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
16 17 18 |
# File 'lib/bird_grinder/tweeter/streaming.rb', line 16 def parent @parent end |
Instance Method Details
#filter(opts = {}) ⇒ Object
Start processing the filter stream
36 37 38 |
# File 'lib/bird_grinder/tweeter/streaming.rb', line 36 def filter(opts = {}) stream(:filter, opts) end |
#follow(*args) ⇒ Object
Start processing the filter stream with a given follow argument.
44 45 46 47 48 49 |
# File 'lib/bird_grinder/tweeter/streaming.rb', line 44 def follow(*args) opts = args. opts[:follow] = args.flatten.join(",") opts[:path] = :filter stream(:follow, opts) end |
#sample(opts = {}) ⇒ Object
Start processing the sample stream
29 30 31 |
# File 'lib/bird_grinder/tweeter/streaming.rb', line 29 def sample(opts = {}) stream(:sample, opts) end |
#track(*args) ⇒ Object
Starts tracking a specific query.
54 55 56 57 58 59 |
# File 'lib/bird_grinder/tweeter/streaming.rb', line 54 def track(*args) opts = args. opts[:track] = args.flatten.join(",") opts[:path] = :filter stream(:track, opts) end |