Newbie question - RESTful web service book

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

Brian W. wrote:

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

And you are done.

Regards,
Pierre

Thanks
Brian

Pierre Lecocq wrote:

Brian W. wrote:

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.

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

And you are done.

Regards,
Pierre

Thanks
Brian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs