colab_integration_plugin_controller.rb
636 Bytes
class ColabIntegrationPluginController < ApplicationController
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"] << profile.attr_to_hash
end
render json: data.to_json
data.to_json
end
private
def get_timestamp timestamp
begin
Time.parse timestamp
rescue
nil
end
end
end