-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create_json (err): undefined method `each' #9
Comments
Change line 163 of base.rb: if type to if type and (v.is_a? Array or v.is_a? Hash) to make sure that the JSON used to create an ApiObj is an array or Jeff On Sun, Feb 26, 2012 at 6:14 PM, Johan Oskarsson
Jeffrey Palm --> http://jeffpalm.com |
If you have this installed from the gem you couldn't make this Rdio::symbols_to_types[:owner] = nil This will ensure that we don't try to create a User object from JSON Jeff On Sun, Feb 26, 2012 at 6:14 PM, Johan Oskarsson
Jeffrey Palm --> http://jeffpalm.com |
I tried out the last fix you mentioned (symbols_to_types..) and that fixed the issue! Thanks for the extremely speedy reply and thanks for the gem, very useful. |
Hi.
I'm using this gem to create playlists on Rdio. It works fine, the playlist is created correctly, but it does throw an error.
This is the error and stacktrace. I've removed some keys in the json just in case.
create_json (err): undefined method
each' for "Johan Oskarsson":String create_json (str): {"status": "ok", "result": {"key": "...", "ownerKey": "...", "name": "Playlistify", "url": "/people/skr/playlists/611945/Playlistify/", "ownerIcon": "user/no-user-image-square.jpg", "owner": "Johan Oskarsson", "lastUpdated": 1330325975.0, "shortUrl": "http://rd.io/x/QFrCL0oJOw", "length": 50, "baseIcon": "album/b/9/5/000000000014f59b/square-200.jpg", "ownerUrl": "/people/skr/", "embedUrl": "http://rd.io/e/QFrCL0oJOw", "type": "p", "icon": "http://m.rdio.com/_is/?aid=237792,147201,216482,153219,23076,80461,221456,220187,4443&w=200&h=200"}} /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/base.rb:152:in
fill'/usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/base.rb:171:in
block in fill' /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/base.rb:152:in
each'/usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/base.rb:152:in
fill' /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/base.rb:321:in
fill_obj'/usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/base.rb:373:in
_create_object' /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/base.rb:327:in
create_object'/usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/base.rb:309:in
return_object' /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/api.rb:57:in
createPlaylist'/usr/local/rvm/gems/ruby-1.9.2-p290/gems/rdio-0.0.96/lib/rdio/types.rb:356:in
create' /Users/johan/Dev/playlistify/lib/targets/rdio_target.rb:19:in
add_tracks'The code used is something like this
r_tracks = tracks.map { |track| Rdio::Track.search(track[:artist] + " " + track[:track],nil,['name']).first }
if (!r_tracks.empty?)
pl = Rdio::Playlist.create("Playlistify","Description...", r_tracks)
end
The text was updated successfully, but these errors were encountered: