Forum: Ruby seach tweets with geocode Twitter gem

Posted by Soichi Ishida (soichi)
on 2013-02-01 06:08
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin10.8.0]
gem twitter (4.4.1, 3.7.0)

the gem is this.
https://github.com/sferik/twitter


What I am trying to do is simply to search tweets from geocode.

@client = Twitter::Client.new(
                              :consumer_key => CONSUMER_KEY,
                              :consumer_secret => CONSUMER_SECRET,
                              :oauth_token => OAUTH_TOKEN,
                              :oauth_token_secret => OAUTH_TOKEN_SECRET
                              )

longitude = 140.3863
latitude = 35.76472
str = latitude.to_s + ',' + longitude.to_s + ', 10km'

p @client.search(:geocode => str ).results

gives an error

/Users/soichi/.rvm/gems/ruby-1.9.3-p286/gems/twitter-4.4.1/lib/twitter/response/raise_error.rb:21:in
`on_complete': Could not authenticate you (Twitter::Error::Unauthorized)
  from
/Users/soichi/.rvm/gems/ruby-1.9.3-p286/gems/faraday-0.8.4/lib/faraday/response.rb:9:in
`block in call'


But the authentication should be fine because I have tried user_timeline
and got the results as expected.

Do you see the problem in my code?


soichi
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.