Sha256: 9536d6c692d91401ae94ee7e7937ae5439eac1c6fcc18f6381a83aa9e27ed9ca

Contents?: true

Size: 715 Bytes

Versions: 13

Compression:

Stored size: 715 Bytes

Contents

$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../..')
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../../lib')

require 'yajl/gzip'
require 'yajl/deflate'
require 'yajl/http_stream'
require 'uri'

unless (username = ARGV[0]) && (password = ARGV[1])
  puts "\nUsage: ruby examples/http/twitter_stream_api.rb username password\n\n"
  exit(0)
end
captured = 0
uri = URI.parse("http://#{username}:#{password}@stream.twitter.com/1/statuses/sample.json")

trap('INT') {
  puts "\n\nCaptured #{captured} objects from the stream"
  puts "CTRL+C caught, later!"
  exit(0)
}

Yajl::HttpStream.get(uri, :symbolize_keys => true) do |hash|
  STDOUT.putc '.'
  STDOUT.flush
  captured += 1
end

Version data entries

13 entries across 13 versions & 6 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/examples/http/twitter_stream_api.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/examples/http/twitter_stream_api.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/examples/http/twitter_stream_api.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/examples/http/twitter_stream_api.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/yajl-ruby-1.4.3/examples/http/twitter_stream_api.rb
yajl-ruby-1.4.3 examples/http/twitter_stream_api.rb
yajl-ruby-1.4.2 examples/http/twitter_stream_api.rb
yajl-ruby-1.4.1 examples/http/twitter_stream_api.rb
yajl-ruby-1.4.0 examples/http/twitter_stream_api.rb
yajl-ruby-1.3.1 examples/http/twitter_stream_api.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/examples/http/twitter_stream_api.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/examples/http/twitter_stream_api.rb
yajl-ruby-1.3.0 examples/http/twitter_stream_api.rb