Method: FastAPI::Wrapper#spoof

Defined in:
lib/fastapi.rb

#spoof(data = [], meta = {}) ⇒ String

Spoofs data from Model

Returns:

  • (String)

    JSON data and metadata



123
124
125
126
127
128
129
# File 'lib/fastapi.rb', line 123

def spoof(data = [], meta = {})
  meta[:total]  ||= data.count
  meta[:count]  ||= data.count
  meta[:offset] ||= 0

  Oj.dump({ meta: meta, data: data })
end