使用这个itunes search gem,文档似乎非常简单。它失败 与
NameError:未初始化的常量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
这是我的代码
$ 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
答案 0 :(得分:4)
开发人员可能会更改模块名称或编写不正确的文档:
base = ItunesSearch::Base.new
而不是:
base = Itunes::Base.new
因为模块名为ItunesSearch,而不是Itunes。这应该有效:)