Class: Gricer::ActiveRecord::Agent
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Gricer::ActiveRecord::Agent
- Includes:
- Gricer::ActiveModel::Statistics, LimitStrings
- Defined in:
- app/models/gricer/active_record/agent.rb
Overview
ActiveRecord Model for User Agent Statistics
Constant Summary collapse
- AGENT_CLASSES =
The agent class constant defines numeric values for the different agent types to be stored in a database.
{ 0x1000 => :browser, 0x2000 => :mobile_browser, 0x0001 => :bot }
Instance Attribute Summary collapse
-
#agent_class ⇒ String
The current value of the classification of the user agent.
-
#engine_name ⇒ String
The current value of the name of the engine used by the user agent.
-
#engine_version ⇒ String
The current value of the version of the engine used by the user agent.
-
#full_version ⇒ String
The current value of user agent’s full version.
-
#major_version ⇒ String
The current value of user agent’s major version.
-
#name ⇒ String
The current value of user agent’s name.
-
#os ⇒ String
The current value of the OS the user agent is hosted on.
-
#request_header ⇒ String
The current value of user agent string as within the HTTP request.
Class Method Summary collapse
-
.browsers ⇒ ActiveRecord::Relation
Filter out anything that is not a Browser or MobileBrowser.
Instance Method Summary collapse
Methods included from LimitStrings
Methods included from Gricer::ActiveModel::Statistics
Instance Attribute Details
#agent_class ⇒ String
The current value of the classification of the user agent.
See AGENT_CLASSES for possible values.
33 34 35 |
# File 'app/models/gricer/active_record/agent.rb', line 33 def agent_class @agent_class end |
#engine_name ⇒ String
The current value of the name of the engine used by the user agent
33 34 35 |
# File 'app/models/gricer/active_record/agent.rb', line 33 def engine_name @engine_name end |
#engine_version ⇒ String
The current value of the version of the engine used by the user agent
33 34 35 |
# File 'app/models/gricer/active_record/agent.rb', line 33 def engine_version @engine_version end |
#full_version ⇒ String
The current value of user agent’s full version. This means it does include all sub version numbers.
33 34 35 |
# File 'app/models/gricer/active_record/agent.rb', line 33 def full_version @full_version end |
#major_version ⇒ String
The current value of user agent’s major version. This means it does include only the first number after a dot.
33 34 35 |
# File 'app/models/gricer/active_record/agent.rb', line 33 def major_version @major_version end |
#name ⇒ String
The current value of user agent’s name. (e.g. ‘Firefox’, ‘Chrome’, ‘Internet Explorer’)
33 34 35 |
# File 'app/models/gricer/active_record/agent.rb', line 33 def name @name end |
#os ⇒ String
The current value of the OS the user agent is hosted on.
33 34 35 |
# File 'app/models/gricer/active_record/agent.rb', line 33 def os @os end |
#request_header ⇒ String
The current value of user agent string as within the HTTP request.
33 34 35 |
# File 'app/models/gricer/active_record/agent.rb', line 33 def request_header @request_header end |
Class Method Details
.browsers ⇒ ActiveRecord::Relation
Filter out anything that is not a Browser or MobileBrowser
52 53 54 |
# File 'app/models/gricer/active_record/agent.rb', line 52 def self.browsers self.where("\"#{self.table_name}\".\"agent_class_id\" IN (?)", [0x1000, 0x2000]) end |