class Feedlr::Mapper

The generalized pseudo-object that is returned for all query requests. martinfowler.com/eaaCatalog/dataMapper.html

Public Class Methods

build(data) click to toggle source

Build the proper object depending on the response @return [Feedlr::Base, Feedlr::Success, Feedlr::Collection]

# File lib/feedlr/mapper.rb, line 14
def self.build(data)
  case data
  when Hash
    (data.size > 0) ? Feedlr::Base.new(data) : Feedlr::Success.new
  when Array
    Feedlr::Collection.new(data)
  else
    Feedlr::Success.new
  end
end