Class: Ahoy::VisitProperties
- Inherits:
-
Object
- Object
- Ahoy::VisitProperties
- Defined in:
- lib/ahoy/visit_properties.rb
Instance Attribute Summary collapse
-
#landing_page ⇒ Object
readonly
Returns the value of attribute landing_page.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#referrer ⇒ Object
readonly
Returns the value of attribute referrer.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(request, api:) ⇒ VisitProperties
constructor
A new instance of VisitProperties.
Constructor Details
#initialize(request, api:) ⇒ VisitProperties
Returns a new instance of VisitProperties.
9 10 11 12 13 14 |
# File 'lib/ahoy/visit_properties.rb', line 9 def initialize(request, api:) @request = request @params = request.params @referrer = api ? params["referrer"] : request.referer @landing_page = api ? params["landing_page"] : request.original_url end |
Instance Attribute Details
#landing_page ⇒ Object (readonly)
Returns the value of attribute landing_page.
7 8 9 |
# File 'lib/ahoy/visit_properties.rb', line 7 def landing_page @landing_page end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
7 8 9 |
# File 'lib/ahoy/visit_properties.rb', line 7 def params @params end |
#referrer ⇒ Object (readonly)
Returns the value of attribute referrer.
7 8 9 |
# File 'lib/ahoy/visit_properties.rb', line 7 def referrer @referrer end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
7 8 9 |
# File 'lib/ahoy/visit_properties.rb', line 7 def request @request end |
Instance Method Details
#generate ⇒ Object
16 17 18 |
# File 'lib/ahoy/visit_properties.rb', line 16 def generate @generate ||= request_properties.merge(tech_properties).merge(traffic_properties).merge(utm_properties) end |