class ColabIntegrationPluginController < ApplicationController include ProfileDataExport def index timestamp = get_timestamp params[:timestamp] profiles = if timestamp environment.profiles.where("updated_at > ?", timestamp) else environment.profiles end data = { "timestamp" => Time.zone.now.to_s, "total" => profiles.count, "profiles" => [] } profiles.each do |profile| data["profiles"] << attr_to_hash(profile) end render json: data.to_json data.to_json end private def get_timestamp timestamp begin Time.parse timestamp rescue nil end end end