开发者

itunes search ruby gem: uninitialized constant Itunes

开发者 https://www.devze.com 2023-01-15 10:02 出处:网络
Using this itunes search gem, and the documentation seems really straightforward. It fails with NameError: uninitialized constant Itunes

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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消