Class: SearchApi::GoogleNewsOptions
- Inherits:
-
Object
- Object
- SearchApi::GoogleNewsOptions
- Includes:
- DynamicSchema::Definable, Helpers
- Defined in:
- lib/searchapi/google_news_options.rb
Constant Summary collapse
- DEVICES =
%w[ desktop mobile tablet ]- SAFE_SEARCH =
%w[ active off ]- TIME_PERIODS =
%w[ last_hour last_day last_week last_month last_year ]- SORT_BY =
%w[ most_recent ]- NORMALIZE_DOWNCASE =
->(v) { v.to_s.downcase }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}, api_options: nil) ⇒ GoogleNewsOptions
constructor
A new instance of GoogleNewsOptions.
- #to_h ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(options = {}, api_options: nil) ⇒ GoogleNewsOptions
Returns a new instance of GoogleNewsOptions.
41 42 43 44 |
# File 'lib/searchapi/google_news_options.rb', line 41 def initialize( = {}, api_options: nil ) = self.class.builder.build( || {} ) = .merge( ) if end |
Class Method Details
.build(options = nil, &block) ⇒ Object
33 34 35 |
# File 'lib/searchapi/google_news_options.rb', line 33 def self.build( = nil, &block ) new( api_options: builder.build( , &block ) ) end |
.build!(options = nil, &block) ⇒ Object
37 38 39 |
# File 'lib/searchapi/google_news_options.rb', line 37 def self.build!( = nil, &block ) new( api_options: builder.build!( , &block ) ) end |
Instance Method Details
#to_h ⇒ Object
46 47 48 49 50 |
# File 'lib/searchapi/google_news_options.rb', line 46 def to_h result = .to_h result[ :engine ] = 'google_news' result end |