Twitter.user("peter_v").location fails with multi_json error on ruby 1.8.7

  • Download Gist
twitter_gem_112_fails_on_ruby_187_in_rvm
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
RESOLVED:
 
The problem was that a JSON parser needs to be provided.
 
RTFM ...
https://github.com/jnunemaker/twitter#readme
 
says:
 
Help! I'm getting: "Did not recognize your engine specification.
Please specify either a symbol or a class. (RuntimeError)"
 
If you're using the JSON request format (i.e., the default),
you'll need to explicitly require a JSON library. We recommend yajl-ruby.
 
So the resolution then becomes:
 
$ rvm use 1.8.7@t
$ gem install twitter yajl-ruby
$ ruby -e'require "twitter";require"yajl";puts Twitter.user("peter_v").location'
 
RESOLVED
 
On 1.8.7 p330 FAIL
==================
 
peterv@ASUS:~/ru$ rvm gemset create twitter
'twitter' gemset created (/home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter).
 
peterv@ASUS:~/ru$ rvm use 1.8.7@twitter
Using /home/peterv/.rvm/gems/ruby-1.8.7-p330 with gemset twitter
 
peterv@ASUS:~/ru$ gem list
 
*** LOCAL GEMS ***
 
rake (0.8.7)
 
peterv@ASUS:~/ru$ gem install twitter # (no ri no rdoc)
********************************************************************************
 
Follow @gem on Twitter for announcements, updates, and news.
https://twitter.com/gem
 
Join the mailing list!
https://groups.google.com/group/ruby-twitter-gem
 
Add your project or organization to the apps wiki!
https://github.com/jnunemaker/twitter/wiki/apps
 
********************************************************************************
Successfully installed hashie-1.0.0
Successfully installed addressable-2.2.4
Successfully installed multipart-post-1.1.0
Successfully installed rack-1.2.1
Successfully installed faraday-0.5.5
Successfully installed faraday_middleware-0.3.2
Successfully installed multi_json-0.0.5
Successfully installed multi_xml-0.2.1
Successfully installed simple_oauth-0.1.4
Successfully installed twitter-1.1.2
10 gems installed
 
peterv@ASUS:~/ru$ irb
001:0> require 'twitter'
=> true
002:0> Twitter.user("peter_v").location
MultiJson::DecodeError: #<RuntimeError: Did not recognize your engine specification. Please specify either a symbol or a class.>
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/multi_json-0.0.5/lib/multi_json.rb:66:in `decode'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday_middleware-0.3.2/lib/faraday/parse_json.rb:22:in `register_on_complete'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/response.rb:45:in `call'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/response.rb:45:in `finish'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/response.rb:45:in `each'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/response.rb:45:in `finish'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/builder.rb:18:in `inner_app'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/response.rb:17:in `call'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/response.rb:17:in `call'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/adapter/net_http.rb:57:in `call'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/twitter-1.1.2/lib/faraday/multipart.rb:16:in `call'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/request.rb:84:in `run'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/request.rb:26:in `run'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/connection.rb:171:in `run_request'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/faraday-0.5.5/lib/faraday/connection.rb:64:in `get'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/twitter-1.1.2/lib/twitter/request.rb:28:in `send'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/twitter-1.1.2/lib/twitter/request.rb:28:in `request'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/twitter-1.1.2/lib/twitter/request.rb:6:in `get'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/twitter-1.1.2/lib/twitter/client/user.rb:23:in `user'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/twitter-1.1.2/lib/twitter.rb:21:in `send'
from /home/peterv/.rvm/gems/ruby-1.8.7-p330@twitter/gems/twitter-1.1.2/lib/twitter.rb:21:in `method_missing'
from (irb):2003:0> MultiJson
=> MultiJson
004:0> puts RUBY_VERSION
1.8.7
=> nil
005:0> puts RUBY_PATCHLEVEL
330
=> nil
 
 
On 1.9.2 PASS
=============
 
peterv@ASUS:~/ru$ rvm gemset create twitter
'twitter' gemset created (/home/peterv/.rvm/gems/ruby-1.9.2-p136@twitter).
peterv@ASUS:~/ru$ rvm use 1.9.2@twitter
Using /home/peterv/.rvm/gems/ruby-1.9.2-p136 with gemset twitter
 
peterv@ASUS:~/ru$ gem list
 
*** LOCAL GEMS ***
 
rake (0.8.7)
peterv@ASUS:~/ru$ gem install twitter
********************************************************************************
 
Follow @gem on Twitter for announcements, updates, and news.
https://twitter.com/gem
 
Join the mailing list!
https://groups.google.com/group/ruby-twitter-gem
 
Add your project or organization to the apps wiki!
https://github.com/jnunemaker/twitter/wiki/apps
 
********************************************************************************
Successfully installed hashie-1.0.0
Successfully installed addressable-2.2.4
Successfully installed multipart-post-1.1.0
Successfully installed rack-1.2.1
Successfully installed faraday-0.5.5
Successfully installed faraday_middleware-0.3.2
Successfully installed multi_json-0.0.5
Successfully installed multi_xml-0.2.1
Successfully installed simple_oauth-0.1.4
Successfully installed twitter-1.1.2
10 gems installed
 
peterv@ASUS:~/ru$ irb
001:0> require 'twitter'
=> true
002:0> Twitter.user("peter_v").location
=> "Flanders"

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.