newbie question - RESTful web service book

B

Brian Wolf

Hi,

I'm new to ruby, reading a book, "RESTful Web Services" by Richardson
and Ruby
On page 2,they have this:



#!/usr/bin/ruby -w
# amazon-book-search.rb
require 'amazon/search'
if ARGV.size != 2
puts "Usage: #{$0} [Amazon Web Services AccessKey ID] [text to search for]"
exit
end
access_key, search_request = ARGV
req = Amazon::Search::Request.new(access_key)


my question is what is "require 'amazon/search' " ?, It isnt defined in
the book as far as I can see. The out program won't run without it.

Thanks
Brian
 
P

Pierre Lecocq

Brian said:
Hi,

I'm new to ruby, reading a book, "RESTful Web Services" by Richardson
and Ruby
On page 2,they have this:



#!/usr/bin/ruby -w
# amazon-book-search.rb
require 'amazon/search'
if ARGV.size != 2
puts "Usage: #{$0} [Amazon Web Services AccessKey ID] [text to search
for]"
exit
end
access_key, search_request = ARGV
req = Amazon::Search::Request.new(access_key)


my question is what is "require 'amazon/search' " ?, It isnt defined in
the book as far as I can see. The out program won't run without it.

Hello,

If you type this command, you will see all the gem packages available
for amazon:

sudo gem list --remote | grep amazon

YOu choose he right one and then type:

sudo gem install <the gem name>

And you are done.

Regards,
Pierre
 
P

Pierre Lecocq

Pierre said:
Brian said:
Hi,

I'm new to ruby, reading a book, "RESTful Web Services" by Richardson
and Ruby
On page 2,they have this:



#!/usr/bin/ruby -w
# amazon-book-search.rb
require 'amazon/search'
if ARGV.size != 2
puts "Usage: #{$0} [Amazon Web Services AccessKey ID] [text to search
for]"
exit
end
access_key, search_request = ARGV
req = Amazon::Search::Request.new(access_key)


my question is what is "require 'amazon/search' " ?, It isnt defined in
the book as far as I can see. The out program won't run without it.

Erf ...

in fact, it is written in the book, 2 lines above the example you copied
...
(http://caliban.org/ruby/ruby-amazon.shtml)

Juste 2 lines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top