newbie question - RESTful web service book

Discussion in 'Ruby' started by Brian Wolf, Feb 2, 2010.

  1. Brian Wolf

    Brian Wolf Guest

    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 Wolf, Feb 2, 2010
    #1
    1. Advertising

  2. 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/.
     
    Pierre Lecocq, Feb 2, 2010
    #2
    1. Advertising

  3. 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/.
     
    Pierre Lecocq, Feb 2, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wouter

    java RESTful web service

    Wouter, Mar 31, 2009, in forum: Java
    Replies:
    25
    Views:
    5,063
    Arne Vajhøj
    Apr 10, 2009
  2. imlakhani

    Web Services Restful Services

    imlakhani, Dec 16, 2009, in forum: Java
    Replies:
    1
    Views:
    427
    Jeffrey H. Coffield
    Dec 16, 2009
  3. ses
    Replies:
    6
    Views:
    865
  4. Matty J
    Replies:
    0
    Views:
    330
    Matty J
    Apr 20, 2008
  5. Rich Morin

    "RESTful Web Services"

    Rich Morin, Jun 8, 2007, in forum: Ruby
    Replies:
    5
    Views:
    163
    Giles Bowkett
    Jun 10, 2007
Loading...

Share This Page