Class: Google::Search::News
- Inherits:
-
Google::Search
- Object
- Google::Search
- Google::Search::News
- Includes:
- OrderBy
- Defined in:
- lib/google-search/search/news.rb
Constant Summary collapse
- TOPICS =
– Constants ++
:headlines, :world, :business, :nation, :science, :elections, :politics, :entertainment, :sports, :health
Constants included from OrderBy
Constants inherited from Google::Search
Instance Attribute Summary collapse
-
#edition ⇒ Object
Edition, such as :us, :uk, :fr_ca, etc.
-
#relative_to ⇒ Object
Relative to city, state, province, zipcode, etc.
-
#topic ⇒ Object
Topic:.
Attributes included from OrderBy
Attributes inherited from Google::Search
#api_key, #language, #offset, #options, #query, #sent, #size, #type, #version
Instance Method Summary collapse
-
#get_uri_params ⇒ Object
:nodoc:.
-
#initialize(options = {}, &block) ⇒ News
constructor
:nodoc:.
Methods inherited from Google::Search
#all_items, #each_item, #each_response, #get_hash, #get_raw, #get_response, #get_uri, json_decode, #next, size_for, url_encode, #validate
Constructor Details
#initialize(options = {}, &block) ⇒ News
:nodoc:
48 49 50 51 52 |
# File 'lib/google-search/search/news.rb', line 48 def initialize = {}, &block @relative_to = .delete :relative_to @edition = .delete :edition super end |
Instance Attribute Details
#edition ⇒ Object
Edition, such as :us, :uk, :fr_ca, etc.
44 45 46 |
# File 'lib/google-search/search/news.rb', line 44 def edition @edition end |
#relative_to ⇒ Object
Relative to city, state, province, zipcode, etc.
22 23 24 |
# File 'lib/google-search/search/news.rb', line 22 def relative_to @relative_to end |
#topic ⇒ Object
Topic:
- :headlines
- :world
- :business
- :nation
- :science
- :elections
- :politics
- :entertainment
- :sports
- :health
39 40 41 |
# File 'lib/google-search/search/news.rb', line 39 def topic @topic end |
Instance Method Details
#get_uri_params ⇒ Object
:nodoc:
56 57 58 59 60 61 62 63 |
# File 'lib/google-search/search/news.rb', line 56 def get_uri_params validate(:topic) { |topic| topic.nil? || TOPICS.include?(topic) } super + [ [:geo, relative_to], [:topic, topic], [:ned, edition] ] end |