Class: SearchApi::GoogleSearchOptions
- Inherits:
-
Object
- Object
- SearchApi::GoogleSearchOptions
- Includes:
- DynamicSchema::Definable, Helpers
- Defined in:
- lib/searchapi/google_search_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 ]
- OPTIMIZATION_STRATEGIES =
%w[ performance ads ]
- NORMALIZE_DOWNCASE =
->(v) { v.to_s.downcase }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}, api_options: nil) ⇒ GoogleSearchOptions
constructor
A new instance of GoogleSearchOptions.
- #to_h ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(options = {}, api_options: nil) ⇒ GoogleSearchOptions
Returns a new instance of GoogleSearchOptions.
55 56 57 58 |
# File 'lib/searchapi/google_search_options.rb', line 55 def initialize( = {}, api_options: nil ) @options = self.class.builder.build( || {} ) @options = .merge( @options ) if end |
Class Method Details
.build(options = nil, &block) ⇒ Object
47 48 49 |
# File 'lib/searchapi/google_search_options.rb', line 47 def self.build( = nil, &block ) new( api_options: builder.build( , &block ) ) end |
.build!(options = nil, &block) ⇒ Object
51 52 53 |
# File 'lib/searchapi/google_search_options.rb', line 51 def self.build!( = nil, &block ) new( api_options: builder.build!( , &block ) ) end |
Instance Method Details
#to_h ⇒ Object
60 61 62 63 64 |
# File 'lib/searchapi/google_search_options.rb', line 60 def to_h result = @options.to_h result[ :engine ] = 'google' result end |