Class: Profiler::Api::ProfilesController
- Inherits:
-
Profiler::ApplicationController
- Object
- ActionController::Base
- Profiler::ApplicationController
- Profiler::Api::ProfilesController
- Defined in:
- app/controllers/profiler/api/profiles_controller.rb
Instance Method Summary collapse
Instance Method Details
#clear ⇒ Object
34 35 36 37 |
# File 'app/controllers/profiler/api/profiles_controller.rb', line 34 def clear Profiler.storage.clear(type: "http") head :no_content end |
#destroy ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/controllers/profiler/api/profiles_controller.rb', line 26 def destroy profile = Profiler.storage.load(params[:id]) return render json: { error: "Profile not found" }, status: :not_found unless profile Profiler.storage.delete(params[:id]) head :no_content end |
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/profiler/api/profiles_controller.rb', line 8 def index profiles = Profiler.storage.list(limit: params[:limit] || 50, offset: params[:offset] || 0) render json: profiles.map(&:to_h) end |
#show ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/profiler/api/profiles_controller.rb', line 13 def show profile = Profiler.storage.load(params[:id]) unless profile return render json: { error: "Profile not found" }, status: :not_found end # Recalculate AJAX collector data (since AJAX requests happen after page load) recalculate_ajax_data(profile) render json: profile.to_h end |