Class: TwiStream::Client
- Inherits:
-
Object
- Object
- TwiStream::Client
- Extended by:
- EventHandler
- Defined in:
- lib/twistream/client.rb
Instance Attribute Summary collapse
-
#realm ⇒ Object
Returns the value of attribute realm.
Instance Method Summary collapse
- #filter_by_keywords(params = {}, &block) ⇒ Object
- #filter_by_locations(params = {}, &block) ⇒ Object
- #filter_by_users(params = {}, &block) ⇒ Object
- #firehose(params = {}, &block) ⇒ Object
-
#initialize(auth) ⇒ Client
constructor
A new instance of Client.
- #retweet(params = {}, &block) ⇒ Object
- #sample(params = {}, &block) ⇒ Object
- #stop ⇒ Object
Methods included from EventHandler
Constructor Details
#initialize(auth) ⇒ Client
Returns a new instance of Client.
7 8 9 |
# File 'lib/twistream/client.rb', line 7 def initialize(auth) self.realm = "#{auth[:user]}:#{auth[:pass]}".chomp end |
Instance Attribute Details
#realm ⇒ Object
Returns the value of attribute realm.
4 5 6 |
# File 'lib/twistream/client.rb', line 4 def realm @realm end |
Instance Method Details
#filter_by_keywords(params = {}, &block) ⇒ Object
23 24 25 |
# File 'lib/twistream/client.rb', line 23 def filter_by_keywords(params = {}, & block) start(:filter, :track => params.join(','), & block) end |
#filter_by_locations(params = {}, &block) ⇒ Object
31 32 33 |
# File 'lib/twistream/client.rb', line 31 def filter_by_locations(params = {}, & block) start(:filter, :locations => params.join(','), & block) end |
#filter_by_users(params = {}, &block) ⇒ Object
27 28 29 |
# File 'lib/twistream/client.rb', line 27 def filter_by_users(params = {}, & block) start(:filter, :follow => params.join(','), & block) end |
#firehose(params = {}, &block) ⇒ Object
19 20 21 |
# File 'lib/twistream/client.rb', line 19 def firehose(params = {}, & block) start(:firehose, params, & block) end |
#retweet(params = {}, &block) ⇒ Object
15 16 17 |
# File 'lib/twistream/client.rb', line 15 def retweet(params = {}, & block) start(:retweet, params, & block) end |
#sample(params = {}, &block) ⇒ Object
11 12 13 |
# File 'lib/twistream/client.rb', line 11 def sample(params = {}, & block) start(:sample, params, & block) end |
#stop ⇒ Object
35 36 37 38 39 |
# File 'lib/twistream/client.rb', line 35 def stop if @thread.alive? @thread.kill end end |