Class: Howkast::Processor::Base

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

Direct Known Subclasses

Categories, Playlists, Search, Users, Videos

Class Method Summary collapse

Class Method Details

.default_for(field) ⇒ Object

Override to provide a value for field when field is nil.



13
# File 'lib/howkast/processors/base.rb', line 13

def default_for field; end

.filter(args, options) ⇒ Object

Override to massage args and options as needed.



16
# File 'lib/howkast/processors/base.rb', line 16

def filter args, options; end

.parse_element(data) ⇒ Object

Override to process data and restructure the returned value (eg: parse data and return a Howkast::Model::Video instance). By default it simply returns data in its ‘raw’ form (the Hash from HTTParty’s parsed response)



22
23
24
# File 'lib/howkast/processors/base.rb', line 22

def parse_element data
  data
end

.pathObject

The name of the processor dictates the path used to communicate to the API server. override to provide an alternate path.



8
9
10
# File 'lib/howkast/processors/base.rb', line 8

def path
  "#{self}".split('::').last.downcase unless "#{self}" =~ /::Base$/u
end