Class: SearchApi::GoogleLightOptions

Inherits:
Object
  • Object
show all
Includes:
DynamicSchema::Definable, Helpers
Defined in:
lib/searchapi/google_light_options.rb

Constant Summary collapse

SAFE_SEARCH =
%w[ active off ]
NORMALIZE_DOWNCASE =
->(v) { v.to_s.downcase }

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#string_camelize

Constructor Details

#initialize(options = {}, api_options: nil) ⇒ GoogleLightOptions

Returns a new instance of GoogleLightOptions.



31
32
33
34
# File 'lib/searchapi/google_light_options.rb', line 31

def initialize( options = {}, api_options: nil )
  @options = self.class.builder.build( options || {} )
  @options = api_options.merge( @options ) if api_options
end

Class Method Details

.build(options = nil, &block) ⇒ Object



23
24
25
# File 'lib/searchapi/google_light_options.rb', line 23

def self.build( options = nil, &block )
  new( api_options: builder.build( options, &block ) )
end

.build!(options = nil, &block) ⇒ Object



27
28
29
# File 'lib/searchapi/google_light_options.rb', line 27

def self.build!( options = nil, &block )
  new( api_options: builder.build!( options, &block ) )
end

Instance Method Details

#to_hObject



36
37
38
39
40
# File 'lib/searchapi/google_light_options.rb', line 36

def to_h
  result = @options.to_h
  result[ :engine ] = 'google_light'
  result
end