Class: Gricer::ActiveRecord::Request
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Gricer::ActiveRecord::Request
- Defined in:
- app/models/gricer/active_record/request.rb
Overview
ActiveRecord Model for Request Statistics
Instance Attribute Summary collapse
-
#action ⇒ String
The current value of the action requested.
-
#agent ⇒ Gricer::Agent
The current value of the associated agent.
-
#body_size ⇒ String
The current size of the body returned.
-
#content_type ⇒ String
The current value of the content type returned.
-
#controller ⇒ String
The current value of the controller requested.
-
#format ⇒ String
The current value of the format requested.
-
#host ⇒ String
The current value of the host requested.
-
#is_first_in_session ⇒ Boolean
The current value of the first in session flag.
-
#javascript ⇒ Boolean
The current value of the javascript capability of the requesting agent.
-
#locale ⇒ String
The current value of the locale responded.
-
#locale_major ⇒ String
The current value of the locale responded (major locale only).
-
#locale_minor ⇒ String
The current value of the locale responded (major locale only).
-
#method ⇒ String
The current value of the method requested.
-
#param_id ⇒ String
The current value of the http GET/POST id parameter requested.
-
#path ⇒ String
The current value of the path requested.
-
#protocol ⇒ String
The current value of the protocol requested.
-
#real_time ⇒ String
The current value of the real time elapsed processing this request.
-
#referer_host ⇒ String
The current value of the host of the referering page.
-
#referer_params ⇒ String
The current value of the params of the referering page.
-
#referer_path ⇒ String
The current value of the path of the referering page.
-
#referer_protocol ⇒ String
The current value of the protocol of the referering page.
-
#search_engine ⇒ String
The current value of the search engine name refering to get to this request.
-
#search_query ⇒ String
The current value of the search query refering to get to this request.
-
#session ⇒ Gricer::Session
The current value of the associated session.
-
#status_code ⇒ Integer
The current value of the HTTP status returned.
-
#system_time ⇒ String
The current value of the system time elapsed processing this request.
-
#total_time ⇒ String
The current value of the total time elapsed processing this request.
-
#user_id ⇒ Integer
The current id of the user logged in.
-
#user_time ⇒ String
The current value of the user time elapsed processing this request.
-
#window_height ⇒ Integer
The current value of the height in pixels of the requesting agent’s window.
-
#window_width ⇒ Integer
The current value of the width in pixels of the requesting agent’s window.
Class Method Summary collapse
-
.browsers ⇒ ActiveRecord::Relation
Filter out anything that is not a Browser or MobileBrowser.
- .first_by_id(id) ⇒ Object
Instance Method Summary collapse
-
#init_session ⇒ Gricer::Session
Init the corrosponding Gricer::Session (called before create).
Methods included from LimitStrings
Methods included from Gricer::ActiveModel::Statistics
Methods included from Gricer::ActiveModel::Request
#agent_header=, included, #ip_address=, #params=, #referer=, #request=
Instance Attribute Details
#action ⇒ String
The current value of the action requested.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def action @action end |
#agent ⇒ Gricer::Agent
The current value of the associated agent.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def agent @agent end |
#body_size ⇒ String
The current size of the body returned.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def body_size @body_size end |
#content_type ⇒ String
The current value of the content type returned.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def content_type @content_type end |
#controller ⇒ String
The current value of the controller requested.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def controller @controller end |
#format ⇒ String
The current value of the format requested.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def format @format end |
#host ⇒ String
The current value of the host requested.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def host @host end |
#is_first_in_session ⇒ Boolean
The current value of the first in session flag. This is true if it is the first request within a Gricer::Session.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def is_first_in_session @is_first_in_session end |
#javascript ⇒ Boolean
The current value of the javascript capability of the requesting agent.
This feature needs the usage of TrackHelper#gricer_track_tag.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def javascript @javascript end |
#locale ⇒ String
The current value of the locale responded
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def locale @locale end |
#locale_major ⇒ String
The current value of the locale responded (major locale only)
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def locale_major @locale_major end |
#locale_minor ⇒ String
The current value of the locale responded (major locale only)
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def locale_minor @locale_minor end |
#method ⇒ String
The current value of the method requested.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def method @method end |
#param_id ⇒ String
The current value of the http GET/POST id parameter requested.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def param_id @param_id end |
#path ⇒ String
The current value of the path requested.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def path @path end |
#protocol ⇒ String
The current value of the protocol requested.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def protocol @protocol end |
#real_time ⇒ String
The current value of the real time elapsed processing this request.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def real_time @real_time end |
#referer_host ⇒ String
The current value of the host of the referering page.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def referer_host @referer_host end |
#referer_params ⇒ String
The current value of the params of the referering page.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def referer_params @referer_params end |
#referer_path ⇒ String
The current value of the path of the referering page.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def referer_path @referer_path end |
#referer_protocol ⇒ String
The current value of the protocol of the referering page.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def referer_protocol @referer_protocol end |
#search_engine ⇒ String
The current value of the search engine name refering to get to this request.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def search_engine @search_engine end |
#search_query ⇒ String
The current value of the search query refering to get to this request.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def search_query @search_query end |
#session ⇒ Gricer::Session
The current value of the associated session.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def session @session end |
#status_code ⇒ Integer
The current value of the HTTP status returned.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def status_code @status_code end |
#system_time ⇒ String
The current value of the system time elapsed processing this request.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def system_time @system_time end |
#total_time ⇒ String
The current value of the total time elapsed processing this request.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def total_time @total_time end |
#user_id ⇒ Integer
The current id of the user logged in.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def user_id @user_id end |
#user_time ⇒ String
The current value of the user time elapsed processing this request.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def user_time @user_time end |
#window_height ⇒ Integer
The current value of the height in pixels of the requesting agent’s window.
This feature needs the usage of TrackHelper#gricer_track_tag.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def window_height @window_height end |
#window_width ⇒ Integer
The current value of the width in pixels of the requesting agent’s window.
This feature needs the usage of TrackHelper#gricer_track_tag.
107 108 109 |
# File 'app/models/gricer/active_record/request.rb', line 107 def window_width @window_width end |
Class Method Details
.browsers ⇒ ActiveRecord::Relation
Filter out anything that is not a Browser or MobileBrowser
120 121 122 123 |
# File 'app/models/gricer/active_record/request.rb', line 120 def self.browsers includes("agent") .where("\"#{Agent.table_name}\".\"agent_class_id\" IN (?)", [0x1000, 0x2000]) end |
.first_by_id(id) ⇒ Object
125 126 127 |
# File 'app/models/gricer/active_record/request.rb', line 125 def self.first_by_id(id) where(id: id).first end |
Instance Method Details
#init_session ⇒ Gricer::Session
Init the corrosponding Gricer::Session (called before create)
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'app/models/gricer/active_record/request.rb', line 132 def init_session if session if session.updated_at < Time.now - ::Gricer.config.max_session_duration self.session = Session.create previous_session: session, ip_address: @ip_address, agent: agent, requested_locale: @request_locale else self.session.touch end else self.is_first_in_session = true self.session = Session.create ip_address: @ip_address, agent: agent, requested_locale: @request_locale self.session.touch end session end |