Using this itunes search gem, and the documentation seems really straightforward. It fails with
NameError: uninitialized constant Itunes
gem install itunes-search
Usage
base = Itunes::Base.new
search_object = base.search("term"=>"The Killers")
# get an array of the search_objects
results = search_object.results
results.each do |result|
puts result.trackViewUrl
end
puts result.attributes
Here is my code
$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'itunes-search'
=> true
irb(main):003:0> base = Itunes::Base.new
NameError: 开发者_如何学运维uninitialized constant Itunes
from (irb):3
The developer might have change the Module name or written incorrect documentation as you should do:
base = ItunesSearch::Base.new
instead of:
base = Itunes::Base.new
because the module is name ItunesSearch and not Itunes. That should work :)
精彩评论