Class: Ahoy::VisitProperties
- Inherits:
-
Object
- Object
- Ahoy::VisitProperties
- Defined in:
- lib/ahoy/visit_properties.rb
Constant Summary collapse
- REQUEST_KEYS =
[:ip, :user_agent, :referrer, :landing_page, :platform, :app_version, :os_version, :screen_height, :screen_width]
- TRAFFIC_SOURCE_KEYS =
[:referring_domain, :search_keyword]
- UTM_PARAMETER_KEYS =
[:utm_source, :utm_medium, :utm_term, :utm_content, :utm_campaign]
- TECHNOLOGY_KEYS =
[:browser, :os, :device_type]
- LOCATION_KEYS =
[:country, :region, :city, :postal_code, :latitude, :longitude]
- KEYS =
REQUEST_KEYS + TRAFFIC_SOURCE_KEYS + UTM_PARAMETER_KEYS + TECHNOLOGY_KEYS + LOCATION_KEYS
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(request, options = {}) ⇒ VisitProperties
constructor
A new instance of VisitProperties.
- #keys ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(request, options = {}) ⇒ VisitProperties
Returns a new instance of VisitProperties.
17 18 19 20 |
# File 'lib/ahoy/visit_properties.rb', line 17 def initialize(request, = {}) @request = request @options = end |
Instance Method Details
#[](key) ⇒ Object
22 23 24 |
# File 'lib/ahoy/visit_properties.rb', line 22 def [](key) send(key) end |
#keys ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/ahoy/visit_properties.rb', line 26 def keys if Ahoy.geocode == true # no location keys for :async KEYS else KEYS - LOCATION_KEYS end end |
#to_hash ⇒ Object
34 35 36 |
# File 'lib/ahoy/visit_properties.rb', line 34 def to_hash keys.inject({}) { |memo, key| memo[key] = send(key); memo } end |