Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > newbie question - RESTful web service book

Reply
Thread Tools

newbie question - RESTful web service book

 
 
Brian Wolf
Guest
Posts: n/a
 
      02-02-2010
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



 
Reply With Quote
 
 
 
 
Pierre Lecocq
Guest
Posts: n/a
 
      02-02-2010
Brian Wolf 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 <the gem name>

And you are done.

Regards,
Pierre

> Thanks
> Brian


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Pierre Lecocq
Guest
Posts: n/a
 
      02-02-2010
Pierre Lecocq wrote:
> Brian Wolf 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 <the gem name>
>
> And you are done.
>
> Regards,
> Pierre
>
>> Thanks
>> Brian


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does it matter how you implement RESTful web services? ses Java 6 04-30-2010 10:34 AM
Web Services Restful Services imlakhani Java 1 12-16-2009 03:06 PM
java RESTful web service Wouter Java 25 04-09-2009 11:54 PM
WCF and RESTful web service that outputs complex XML type (.NET 3.5) Matty J ASP .Net Web Services 0 04-20-2008 01:17 AM
"RESTful Web Services" Rich Morin Ruby 5 06-10-2007 03:33 AM



Advertisments