ahoy_matey 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3662bc02fad0423af6a7a745137718af5976244a
4
- data.tar.gz: 69331b2acf1a7c75266bd6e88adba510afb8a02c
3
+ metadata.gz: 14b16720c567a2d253632b9a2a238273c1efb192
4
+ data.tar.gz: fa9aa63ecb5aaa91c44c9a617c4bccfa3f37f6c1
5
5
  SHA512:
6
- metadata.gz: 6496bb48e9e1ea773ce5ad3bd229f51458177a141d48c311fa23f1211a4f73b0de21d10ea38640d8d30686020d8ce777f83d7fe5a8b3e96ec973abc1848e8168
7
- data.tar.gz: 66d169b4168bb2ad2f032259331c863dcaccc6295ae0e9002a6c1df4fa2e6dcaea49e784055f517160caa7c801d84390495d10b2b90f422617c9337537290ef3
6
+ metadata.gz: a77b0b9f3ba3bfd134f848a531406778a46ae213b532945b80e0e2d11e81019ee22d1c55b8967e1913dd5b01aa6814d2e0b512dc500fe7a856e5f33adad35455
7
+ data.tar.gz: 6f616904606aaf1af958a8defed7a2fd6ddf9297af5872a3746062ec74ce76cf8eb5c63c606ab45c10884d5119c6f3de45c1e618f892fa1495342a182b3adf28
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.5.3
2
+
3
+ - Fixed error with Rails 5 and Mongoid 6
4
+ - Fixed regression with server not generating visit and visitor tokens
5
+ - Accept UTM parameters as request parameters (for native apps)
6
+
1
7
  ## 1.5.2
2
8
 
3
9
  - Better support for Rails 5
data/README.md CHANGED
@@ -139,7 +139,7 @@ class Ahoy::Store < Ahoy::Stores::BaseStore
139
139
  end
140
140
  ```
141
141
 
142
- See the [ActiveRecordStore](https://github.com/ankane/ahoy/blob/master/lib/ahoy/stores/active_record_store.rb) for an example.
142
+ See the [ActiveRecordTokenStore](https://github.com/ankane/ahoy/blob/master/lib/ahoy/stores/active_record_token_store.rb) for an example.
143
143
 
144
144
  ## How It Works
145
145
 
@@ -238,6 +238,8 @@ class Ahoy::Store < Ahoy::Stores::ActiveRecordTokenStore
238
238
  end
239
239
  ```
240
240
 
241
+ Some methods you can use are `request`, `controller`, `visit_properties`, and `ahoy`.
242
+
241
243
  ### Customize User
242
244
 
243
245
  If you use a method other than `current_user`, set it here:
@@ -497,7 +499,16 @@ With ActiveRecord, use:
497
499
  Ahoy::Event.where(name: "Viewed product").where_properties(product_id: 123).count
498
500
  ```
499
501
 
500
- **Note:** If you get a `NoMethodError`, upgrade Ahoy and add `include Ahoy::Properties` to your model.
502
+ **Note:** If you get a `NoMethodError`, upgrade Ahoy and add `include Ahoy::Properties` to the Ahoy::Event class:
503
+
504
+ ```ruby
505
+ module Ahoy
506
+ class Event < ActiveRecord::Base
507
+ include Ahoy::Properties
508
+ ...
509
+ end
510
+ end
511
+ ```
501
512
 
502
513
  ## Native Apps
503
514
 
@@ -542,7 +553,7 @@ Ahoy.mount = false
542
553
 
543
554
  ### 1.4.0
544
555
 
545
- There’s nothing to do, but it’s worth noting the default store was changed from `ActiveRecordStore` to `ActiveRecordTokenStore` for new installations.
556
+ There’s nothing to do, but it’s worth noting the default store was changed from `ActiveRecordStore` to `ActiveRecordTokenStore` for new installations. `ActiveRecordStore` will continue to be supported.
546
557
 
547
558
  ### json -> jsonb
548
559
 
@@ -15,7 +15,9 @@ module Ahoy
15
15
  before_filter :verify_request_size
16
16
  end
17
17
 
18
- protect_from_forgery with: :null_session, if: -> { Ahoy.protect_from_forgery }
18
+ if respond_to?(:protect_from_forgery)
19
+ protect_from_forgery with: :null_session, if: -> { Ahoy.protect_from_forgery }
20
+ end
19
21
 
20
22
  protected
21
23
 
@@ -4,9 +4,9 @@ module Ahoy
4
4
  events =
5
5
  if params[:name]
6
6
  # legacy API
7
- [params]
7
+ [request.params]
8
8
  elsif params[:events]
9
- params[:events]
9
+ request.params[:events]
10
10
  else
11
11
  begin
12
12
  ActiveSupport::JSON.decode(request.body.read)
@@ -44,8 +44,6 @@ module Ahoy
44
44
  params["screen_width"]
45
45
  end
46
46
 
47
- private
48
-
49
47
  def params
50
48
  @params ||= request.params
51
49
  end
@@ -1,8 +1,9 @@
1
1
  module Ahoy
2
2
  module Deckhands
3
3
  class UtmParameterDeckhand
4
- def initialize(landing_page)
4
+ def initialize(landing_page, params = nil)
5
5
  @landing_page = landing_page
6
+ @params = params || {}
6
7
  end
7
8
 
8
9
  def landing_params
@@ -14,7 +15,7 @@ module Ahoy
14
15
 
15
16
  %w(utm_source utm_medium utm_term utm_content utm_campaign).each do |name|
16
17
  define_method name do
17
- landing_params[name]
18
+ @params[name] || landing_params[name]
18
19
  end
19
20
  end
20
21
  end
@@ -56,7 +56,7 @@ module Ahoy
56
56
  end
57
57
 
58
58
  def visit
59
- @visit ||= visit_model.where(visit_token: ahoy.visit_token).first if ahoy.visit_token
59
+ @visit ||= (visit_model.where(visit_token: ahoy.visit_token).first if ahoy.visit_token)
60
60
  end
61
61
 
62
62
  def exclude?
data/lib/ahoy/tracker.rb CHANGED
@@ -160,7 +160,7 @@ module Ahoy
160
160
  def visit_token_helper
161
161
  @visit_token_helper ||= begin
162
162
  token = existing_visit_token
163
- token ||= generate_id unless api?
163
+ token ||= generate_id unless Ahoy.api_only
164
164
  token
165
165
  end
166
166
  end
@@ -168,7 +168,7 @@ module Ahoy
168
168
  def visitor_token_helper
169
169
  @visitor_token_helper ||= begin
170
170
  token = existing_visitor_token
171
- token ||= generate_id unless api?
171
+ token ||= generate_id unless Ahoy.api_only
172
172
  token
173
173
  end
174
174
  end
data/lib/ahoy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ahoy
2
- VERSION = "1.5.2"
2
+ VERSION = "1.5.3"
3
3
  end
@@ -46,7 +46,7 @@ module Ahoy
46
46
  end
47
47
 
48
48
  def utm_parameter_deckhand
49
- @utm_parameter_deckhand ||= Deckhands::UtmParameterDeckhand.new(request_deckhand.landing_page)
49
+ @utm_parameter_deckhand ||= Deckhands::UtmParameterDeckhand.new(request_deckhand.landing_page, request_deckhand.params)
50
50
  end
51
51
 
52
52
  def technology_deckhand
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahoy_matey
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-27 00:00:00.000000000 Z
11
+ date: 2016-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -335,7 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
335
  version: '0'
336
336
  requirements: []
337
337
  rubyforge_project:
338
- rubygems_version: 2.6.1
338
+ rubygems_version: 2.5.1
339
339
  signing_key:
340
340
  specification_version: 4
341
341
  summary: Simple, powerful visit tracking for Rails
@@ -348,4 +348,3 @@ test_files:
348
348
  - test/properties/postgresql_text_test.rb
349
349
  - test/test_helper.rb
350
350
  - test/visit_properties_test.rb
351
- has_rdoc: