as_json missing
klepsydra opened this issue · 0 comments
klepsydra commented
JSON-related errors are probably due to different versions of Ruby and environment.
ruby -v
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
require 'json'
require 'rubygems'
require 'robinhood-ruby'
irb(main):007:0> @robinhood = Robinhood::REST::Client.new(username, password)
NoMethodError: undefined method `as_json' for {"password"=>"MYpassword", "username"=>"MYusername"}:Hash
from /var/lib/gems/2.3.0/gems/robinhood-ruby-0.4.4/lib/robinhood-ruby/rest/client.rb:85:in `login'
from /var/lib/gems/2.3.0/gems/robinhood-ruby-0.4.4/lib/robinhood-ruby/rest/client.rb:19:in `initialize'
from (irb):7:in `new'
from (irb):7
from /usr/bin/irb:11:in `<main>'
However, by manually adding this code, I no longer get that error:
class Hash
def as_json(opts = {})
self
end
end