Guest User

Untitled

a guest
Apr 20th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #!/usr/bin/ruby -w
  2. # amazon-book-search.rb
  3. require 'amazon/search'
  4. if ARGV.size != 2
  5. puts "Usage: #{$0} [Amazon Web Services AccessKey ID] [text to search for]"
  6. exit
  7. end
  8. access_key, search_request = ARGV
  9. req = Amazon::Search::Request.new(access_key)
  10. # For every book in the search results...
  11. req.keyword_search(search_request, 'books', Amazon::Search::LIGHT) do |book|
  12. # Print the book's name and the list of authors.
  13. puts %{"#{book.product_name}" by #{book.authors.join(', ')}}
  14. end
Add Comment
Please, Sign In to add comment