Method: Joey::RestAPI#map_data

Defined in:
lib/joey/rest_api.rb

#map_data(data, klass = nil) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/joey/rest_api.rb', line 36

def map_data(data, klass = nil)
  raise_error_if_necessary(data)
  hash_or_array = extract_hash_or_array(data, klass)
  hash_or_array = map_to_class(hash_or_array, klass) if klass
  # TODO: Validate an object here.
  #hash_or_array.validate and puts hash_or_array.class.inspect if hash_or_array.is_a?(Model)
  hash_or_array
end