samsymons / RedditKit.rb

[Deprecated] A Ruby wrapper for the reddit API
https://redditkit.com/
MIT License
152 stars 26 forks source link

no implicit conversion of Symbol into Integer (TypeError) #48

Open bfbachmann opened 7 years ago

bfbachmann commented 7 years ago

Hi!

Following the example in your documentation I got the following error

/Users/me/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redditkit-1.0.2/lib/redditkit/client/utilities.rb:71:in '[]': no implicit conversion of Symbol into Integer (TypeError) from /Users/me/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redditkit-1.0.2/lib/redditkit/client/utilities.rb:71:in 'object_kind_from_response' from /Users/me/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redditkit-1.0.2/lib/redditkit/client/utilities.rb:41:in 'object_class_from_response' from /Users/me/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redditkit-1.0.2/lib/redditkit/client/utilities.rb:78:in 'object_from_response' from /Users/me/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redditkit-1.0.2/lib/redditkit/client/users.rb:17:in 'user' from /Users/me/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redditkit-1.0.2/lib/redditkit/client/account.rb:22:in 'sign_in' from /Users/me/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/redditkit-1.0.2/lib/redditkit.rb:23:in 'method_missing' from scripts/api_calls.rb:109:in '<main>'

My source code is as follows:

require 'redditkit' RedditKit.sign_in 'myusername', 'mypassword' subreddits = RedditKit.subscribed_subreddits

I have verified that my credentials are correct so I am not quite sure why this is happening.

jarodreyes commented 7 years ago

@bfbachmann this was fixed here: https://github.com/samsymons/RedditKit.rb/pull/47/files Just make this change locally or point to the github repo directly like:

# In Gemfile
gem 'redditkit', :git => 'https://github.com/samsymons/RedditKit.rb'
rememberlenny commented 7 years ago

@samsymons Is there a chance to update the rubygem with this?

Schwad commented 7 years ago

@jarodreyes :fire: You're a legend, thanks for that comment.

siegy22 commented 7 years ago

@samsymons Are you going to make a release including that fix? :smile: