class JsonConverter

Attributes

data[RW]
schema[RW]

Public Class Methods

new(data, schema) click to toggle source
# File lib/smart_management/json_converter.rb, line 4
def initialize(data, schema)
  @data = data
  @schema = schema
end

Public Instance Methods

call() click to toggle source
# File lib/smart_management/json_converter.rb, line 9
def call
  hash = {}
  hash[:items] = data.items.as_json(schema)
  hash[:meta] = { total: data.total }
  hash.to_json
end