Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added api with users count & occurence count

  • Loading branch information...
commit 05202f671ed02fea9d352628d37909269823e52a 1 parent 4fdac4a
@yvesvanbroekhoven yvesvanbroekhoven authored
View
12 app/controllers/api_controller.rb
@@ -0,0 +1,12 @@
+class ApiController < ApplicationController
+
+ def status
+ users_count = User.count
+ occurences_count = Occurence.count
+ render :json => {
+ :user_count => users_count,
+ :occurence_count => occurences_count
+ }
+ end
+
+end
View
2  app/helpers/api_helper.rb
@@ -0,0 +1,2 @@
+module ApiHelper
+end
View
5 config/routes.rb
@@ -66,5 +66,10 @@
:action => 'index'
map.resources :service_settings
+
+ map.with_options :controller => 'api' do |submap|
+ submap.status '/api/status', :action => 'status'
+ end
+
end
View
8 test/functional/api_controller_test.rb
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class ApiControllerTest < ActionController::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
View
4 test/unit/helpers/api_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class ApiHelperTest < ActionView::TestCase
+end
Please sign in to comment.
Something went wrong with that request. Please try again.