Class: ApiConsumer::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/api_consumer/processor.rb

Class Method Summary collapse

Class Method Details

.process(data, namespace) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/api_consumer/processor.rb', line 4

def process(data, namespace)
  response = Elements::Response.new
  data.each do |key, item|
    parser = ParserRegistry.parser_for key, namespace
    unless parser.nil?
      response.add_attribute key
      response.send "#{key}=", parser.parse(item)
    end
  end
  response
end