Parsing responses for the Reading a Tweet section

Hi all,

I posted the following issue ( in the twitter api section, and a helpful moderator who looked at it and received the same error suggested I post it here as well to get your guys’ input. My post is copied below- I’d love to get anyone’s advice. Thanks a lot!

Original post:

I’ve been having some problems retrieving the appropriate info in the Reading a Tweet section. I get the following error: Oops, try again You did not generate the correct output. Did you print the username, followed by ’ - ', followed by the Tweet text?

However, In my console, I can see that I am properly spitting out the username and the tweet by using the precise parameters spelled out in the hint section, but I notice that the “[name]” parameter within the JSON is the user’s name, but listed upside down. Likewise, it spits this out upside down too, so I’m wondering if that may be part of the problem. Is there some method we’re supposed to run on it to turn it rightside up, perhaps?

I’m attaching my code below in case there’s something wrong therein. Thanks a lot!

require 'rubygems'
require 'oauth'
require 'json'

# Now you will fetch /1.1/statuses/show.json, which
# takes an 'id' parameter and returns the
# representation of a single Tweet.
baseurl = ""
path    = "/1.1/statuses/show.json"
query   = URI.encode_www_form("id" => "266270116780576768")
address = URI("#{baseurl}#{path}?#{query}")
request = address.request_uri

# Print data about a Tweet
def print_tweet(tweet)
  # ADD CODE TO PRINT THE TWEET IN "<screen name> - <text>" FORMAT
  puts JSON.pretty_generate(tweet)
  screen_name = tweet["user"]["name"]
  tweet_text = tweet["text"]
  print "#{screen_name} - #{tweet_text}"

# Set up HTTP.
http             =, address.port
http.use_ssl     = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER

# If you entered your credentials in the first
# exercise, no need to enter them again here. The
# ||= operator will only assign these values if
# they are not already set.
consumer_key ||= "ENTER IN EXERCISE 1", ""
access_token ||= "ENTER IN EXERCISE 1", ""

# Issue the request.
request.oauth! http, consumer_key, access_token
response = http.request request

# Parse and print the Tweet if the response code was 200
tweet = nil
if response.code == '200' then
  tweet = JSON.parse(response.body)

Confirmed issue dating back many months (or years).

The fix didn’t work for me. Kinda lame.