Commit 700f0b39 authored by gubala's avatar gubala

added simple api call counting, Fixes #75

parent 306af9bc
......@@ -42,7 +42,7 @@ group :development do
# For quality/security testing
gem 'brakeman', require: false
gem 'rails_best_practices'
#gem 'rails_best_practices'
# Has to use Thin as Webrick doesn't handle long PLGrid OpenId responses
gem 'thin'
......
......@@ -43,7 +43,6 @@ GEM
tzinfo (~> 0.3.37)
arel (4.0.1)
atomic (1.1.14)
awesome_print (1.2.0)
bcrypt-ruby (3.1.2)
better_errors (1.1.0)
coderay (>= 1.0.0)
......@@ -62,8 +61,6 @@ GEM
slim (>= 1.3.6, < 3.0)
terminal-table (~> 1.4)
builder (3.1.4)
code_analyzer (0.4.4)
sexp_processor
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
......@@ -72,7 +69,6 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.7.0)
colored (1.2)
daemons (1.1.9)
debug_inspector (0.0.2)
devise (3.2.2)
......@@ -102,7 +98,6 @@ GEM
highline (1.6.20)
hike (1.2.3)
i18n (0.6.9)
inflecto (0.0.2)
jbuilder (1.5.3)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
......@@ -149,15 +144,6 @@ GEM
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.2)
sprockets-rails (~> 2.0.0)
rails_best_practices (1.15.0)
awesome_print
code_analyzer (>= 0.4.3)
colored
erubis
i18n
inflecto
require_all
ruby-progressbar
railties (4.0.2)
actionpack (= 4.0.2)
activesupport (= 4.0.2)
......@@ -167,9 +153,7 @@ GEM
rdoc (4.1.1)
json (~> 1.4)
ref (1.0.5)
require_all (1.3.2)
ruby-openid (2.5.0)
ruby-progressbar (1.4.1)
ruby2ruby (2.0.7)
ruby_parser (~> 3.1)
sexp_processor (~> 4.0)
......@@ -202,10 +186,10 @@ GEM
therubyracer (0.12.0)
libv8 (~> 3.16.14.0)
ref
thin (1.6.1)
daemons (>= 1.0.9)
eventmachine (>= 1.0.0)
rack (>= 1.0.0)
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
rack (~> 1.0)
thor (0.18.1)
thread_safe (0.1.3)
atomic
......@@ -241,7 +225,6 @@ DEPENDENCIES
pry-rails
puma
rails (= 4.0.2)
rails_best_practices
ruby-gridftp!
sass-rails (~> 4.0.1)
sdoc
......
......@@ -69,6 +69,7 @@ class ApplicationController < ActionController::Base
# A flag to easily distinguish API use "down the road"
@api_user = true
logger.info "Request to #{params[:action]} #{@path} with direct proxy param."
ApiData.increment_call_counter
end
def check_proxy_existence
......
class ApiData < ActiveRecord::Base
def self.increment_call_counter
ApiData.increment_counter :call_counter, 1
end
end
class CreateApiData < ActiveRecord::Migration
def change
create_table :api_data do |t|
t.integer :call_counter, null: false, default: 0
end
ApiData.first_or_create id: 1
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140304182813) do
ActiveRecord::Schema.define(version: 20141128090807) do
create_table "api_clients", force: true do |t|
t.string "ip", default: "", null: false
......@@ -21,6 +21,10 @@ ActiveRecord::Schema.define(version: 20140304182813) do
t.datetime "updated_at"
end
create_table "api_data", force: true do |t|
t.integer "call_counter", default: 0, null: false
end
create_table "folders", force: true do |t|
t.datetime "created_at"
t.datetime "updated_at"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment