Class: Howkast::Processor::Videos

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

Class Method Summary collapse

Methods inherited from Base

path

Class Method Details

.default_for(field) ⇒ Object



68
69
70
# File 'lib/howkast/processors/videos.rb', line 68

def default_for field
  [] if %w{ category_hierarchy ingredients markers related_videos }.include? field
end

.filter(args, options) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/howkast/processors/videos.rb', line 48

def filter args, options
  args << options.delete(:id)
  args << options.delete(:sort)
  args << options.delete(:filter)
  args << options.delete(:category)
  args << options.delete(:page)
  args.compact!
end

.parse_element(data) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File 'lib/howkast/processors/videos.rb', line 57

def parse_element data
  expander = ->(key, value){ expand key, value }
  if data.has_key? 'video'
    data  = data['video']
    klass = Howkast::Model.synthesize('Video', data)
    klass.new self, data, &expander
  else
    parse_list 'video', data['videos'], &expander
  end
end