Class: Howkast::Processor::Search

Inherits:
Base
  • Object
show all
Defined in:
lib/howkast/processors/search.rb

Class Method Summary collapse

Methods inherited from Base

path

Class Method Details

.default_for(field) ⇒ Object



26
27
28
# File 'lib/howkast/processors/search.rb', line 26

def default_for field
  [] if %w{ videos }.include? field
end

.filter(args, options) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/howkast/processors/search.rb', line 11

def filter args, options
  options[:q] = options.delete(:query)
  # HACK: The Howcast API service responds with HTTP500 error if the 
  # :q parameter on search is an empty string - so we plug it with
  # something that *might not* exist and hopefully it will return an 
  # empty list :-)
  options[:q] = '6c6d1613339399efd0bc74fe12b14dd3' if options[:q].empty?
end

.parse_element(data) ⇒ Object



20
21
22
23
24
# File 'lib/howkast/processors/search.rb', line 20

def parse_element data
  expander = ->(key, value){ expand key, value }
  klass    = Howkast::Model.synthesize('Search', data)
  klass.new self, data, &expander
end