Sha256: 428ae8969c9bb2283c0996c2fa0317b1d27b9361345e9f756aa9958d8ab32388

Contents?: true

Size: 784 Bytes

Versions: 15

Compression:

Stored size: 784 Bytes

Contents

$: << 'lib' << '../lib'

require 'em-http'
require 'em-http/middleware/oauth'
require 'em-http/middleware/json_response'

require 'pp'

OAuthConfig = {
  :consumer_key     => '',
  :consumer_secret  => '',
  :access_token     => '',
  :access_token_secret => ''
}

EM.run do
  # automatically parse the JSON response into a Ruby object
  EventMachine::HttpRequest.use EventMachine::Middleware::JSONResponse

  # sign the request with OAuth credentials
  conn = EventMachine::HttpRequest.new('http://api.twitter.com/1/statuses/home_timeline.json')
  conn.use EventMachine::Middleware::OAuth, OAuthConfig

  http = conn.get
  http.callback do
    pp http.response
    EM.stop
  end

  http.errback do
    puts "Failed retrieving user stream."
    pp http.response
    EM.stop
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
em-http-request-samesite-0.1.1 examples/oauth-tweet.rb
em-http-request-samesite-1.1.7 examples/oauth-tweet.rb
em-http-request-1.1.7 examples/oauth-tweet.rb
em-http-request-1.1.6 examples/oauth-tweet.rb
em-http-request-1.1.5 examples/oauth-tweet.rb
em-http-request-1.1.4 examples/oauth-tweet.rb
em-http-request-1.1.3 examples/oauth-tweet.rb
em-http-request-1.1.2 examples/oauth-tweet.rb
em-http-request-1.1.1 examples/oauth-tweet.rb
em-http-request-1.1.0 examples/oauth-tweet.rb
em-http-request-1.0.3 examples/oauth-tweet.rb
em-http-request-1.0.2 examples/oauth-tweet.rb
em-http-request-1.0.1 examples/oauth-tweet.rb
em-http-request-1.0.0 examples/oauth-tweet.rb
em-http-request-1.0.0.beta.4 examples/oauth-tweet.rb