Permalink
Browse files

Added News topic

  • Loading branch information...
1 parent c4545a2 commit f92fa76f0717f25b03d14407c29491f925bb9193 @tj tj committed Jul 24, 2009
Showing with 27 additions and 0 deletions.
  1. +7 −0 lib/google-search/search.rb
  2. +20 −0 lib/google-search/search/news.rb
@@ -1,3 +1,10 @@
require 'google-search/search/base'
require 'google-search/search/web'
+require 'google-search/search/blog'
+require 'google-search/search/image'
+require 'google-search/search/local'
+require 'google-search/search/news'
+require 'google-search/search/video'
+require 'google-search/search/book'
+require 'google-search/search/patent'
@@ -8,6 +8,8 @@ class News < self
#++
ORDER_BY = :relevance, :date
+ TOPICS = :headlines, :world, :business, :nation, :science,
+ :elections, :politics, :entertainment, :sports, :health
##
# Order by. Defaults to :relevance
@@ -24,6 +26,23 @@ class News < self
attr_reader :relative_to
+ ##
+ # Topic:
+ #
+ # - :headlines
+ # - :world
+ # - :business
+ # - :nation
+ # - :science
+ # - :elections
+ # - :politics
+ # - :entertainment
+ # - :sports
+ # - :health
+ #
+
+ attr_reader :topic
+
#:nodoc:
def initialize options = {}, &block
@@ -36,6 +55,7 @@ def initialize options = {}, &block
def get_uri_params
raise Error, "invalid order `#{order_by}'" unless order_by.nil? || ORDER_BY.include?(order_by)
+ raise Error, "invalid topic `#{topic}'" unless topic.nil? || TOPICS.include?(topic)
super + [
[:scoring, order_by ? 'd' : nil],
[:geo, relative_to]

0 comments on commit f92fa76

Please sign in to comment.