Class: SimpleStream::Client
- Inherits:
-
Object
- Object
- SimpleStream::Client
- Defined in:
- lib/simple_stream/client.rb
Constant Summary collapse
- USER_AGENT =
"SimpleStream Ruby Gem #{SimpleStream::VERSION}"
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #filter(opts = {}, &block) ⇒ Object
- #firehose(opts = {}, &block) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #sample(opts = {}, &block) ⇒ Object
- #site(user_ids, opts = {}, &block) ⇒ Object
- #user(opts = {}, &block) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
14 15 16 |
# File 'lib/simple_stream/client.rb', line 14 def initialize @connection = SimpleStream::Connection.new end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
10 11 12 |
# File 'lib/simple_stream/client.rb', line 10 def connection @connection end |
Instance Method Details
#filter(opts = {}, &block) ⇒ Object
26 27 28 |
# File 'lib/simple_stream/client.rb', line 26 def filter(opts = {}, &block) request(:post, 'https://stream.twitter.com:443/1.1/statuses/filter.json', opts, &block) end |
#firehose(opts = {}, &block) ⇒ Object
34 35 36 |
# File 'lib/simple_stream/client.rb', line 34 def firehose(opts = {}, &block) request(:get, 'https://stream.twitter.com:443/1.1/statuses/firehose.json', opts, &block) end |
#sample(opts = {}, &block) ⇒ Object
30 31 32 |
# File 'lib/simple_stream/client.rb', line 30 def sample(opts = {}, &block) request(:get, 'https://stream.twitter.com:443/1.1/statuses/sample.json', opts, &block) end |
#site(user_ids, opts = {}, &block) ⇒ Object
18 19 20 |
# File 'lib/simple_stream/client.rb', line 18 def site(user_ids, opts = {}, &block) request(:get, 'https://sitestream.twitter.com:443/1.1/site.json', opts.merge(follow: user_ids.join(',')), &block) end |
#user(opts = {}, &block) ⇒ Object
22 23 24 |
# File 'lib/simple_stream/client.rb', line 22 def user(opts = {}, &block) request(:get, 'https://userstream.twitter.com:443/1.1/user.json', opts, &block) end |