impressionist 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +18 -6
- data/app/controllers/impressionist_controller.rb +53 -12
- data/app/models/impressionist/impressionable.rb +1 -1
- data/gemfiles/rails32.gemfile +5 -1
- data/gemfiles/rails40.gemfile +5 -1
- data/impressionist.gemspec +1 -3
- data/lib/generators/active_record/templates/create_impressions_table.rb +2 -0
- data/lib/impressionist/bots.rb +11 -8
- data/lib/impressionist/models/active_record/impression.rb +1 -1
- data/lib/impressionist/models/mongoid/impression.rb +1 -1
- data/lib/impressionist/setup_association.rb +2 -1
- data/lib/impressionist/version.rb +1 -1
- data/tests/spec/setup_association_spec.rb +2 -2
- data/tests/test_app/.gitignore +1 -0
- data/tests/test_app/Gemfile +5 -1
- data/tests/test_app/app/controllers/profiles_controller.rb +14 -0
- data/tests/test_app/app/controllers/widgets_controller.rb +1 -1
- data/tests/test_app/app/models/profile.rb +6 -0
- data/tests/test_app/app/views/profiles/show.html.erb +3 -0
- data/tests/test_app/config/initializers/impression.rb +1 -1
- data/tests/test_app/config/routes.rb +1 -0
- data/tests/test_app/db/migrate/20130719024021_create_impressions_table.rb +2 -0
- data/tests/test_app/db/migrate/20150207135825_create_profiles.rb +10 -0
- data/tests/test_app/db/migrate/20150207140310_create_friendly_id_slugs.rb +18 -0
- data/tests/test_app/db/schema.rb +21 -1
- data/tests/test_app/spec/controllers/articles_controller_spec.rb +17 -1
- data/tests/test_app/spec/controllers/impressionist_uniqueness_spec.rb +146 -60
- data/tests/test_app/spec/controllers/posts_controller_spec.rb +9 -0
- data/tests/test_app/spec/controllers/widgets_controller_spec.rb +32 -1
- data/tests/test_app/spec/fixtures/profiles.yml +4 -0
- data/tests/test_app/spec/models/model_spec.rb +1 -1
- data/tests/test_app/spec/rails_generators/rails_generators_spec.rb +1 -1
- metadata +26 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77fe32e3f3573eee145dbc117db77870636488db
|
4
|
+
data.tar.gz: 5653b56f9e30cc83ab460ce4ebe14581aea1f0a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f30282672dfe4b2d8a848f571b6926640433e6131cdc744cd4b73b9c5ff63fd273467b2c0660bf49cb8401ff3223bac7871fa72ce7ac1af46938a4ae2eb0b824
|
7
|
+
data.tar.gz: be7b5e08610b3def60b450177dd12aec65b65e1cb9357b062599d760a1c3d0693a09e497d5fec4f2007e8904dcdda55ee29510d1ef1e8cb670886d1b07ff34d1
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -55,6 +55,7 @@ The following fields are provided in the migration:
|
|
55
55
|
t.string "request_hash" # unique ID per request, in case you want to log multiple impressions and group them
|
56
56
|
t.string "session_hash" # logs the rails session
|
57
57
|
t.string "ip_address" # request.remote_ip
|
58
|
+
t.text "params" # request.params, except action name, controller name and resource id
|
58
59
|
t.string "referrer" # request.referer
|
59
60
|
t.string "message" # custom message you can add
|
60
61
|
t.datetime "created_at" # I am not sure what this is.... Any clue?
|
@@ -79,7 +80,7 @@ Usage
|
|
79
80
|
an AR model instance. Impressionist will automatically log the Model name
|
80
81
|
(based on action_name) and the id (based on params[:id]), but in order to
|
81
82
|
get the count of impressions (example: @widget.impression_count), you will
|
82
|
-
need to make your model
|
83
|
+
need to make your model impressionable
|
83
84
|
|
84
85
|
class Widget < ActiveRecord::Base
|
85
86
|
is_impressionable
|
@@ -89,11 +90,14 @@ Usage
|
|
89
90
|
not necessary to specify "impressionist" (usage #1) in the top of you
|
90
91
|
controller if you are using this method. If you add "impressionist" to the
|
91
92
|
top of your controller and also use this method in your action, it will
|
92
|
-
result in 2 impressions being logged (but associated with one request_hash)
|
93
|
+
result in 2 impressions being logged (but associated with one request_hash).
|
94
|
+
If you're using [friendly_id](https://github.com/norman/friendly_id) be sure
|
95
|
+
to log impressionist this way, as params[:id] will return a string(url slug)
|
96
|
+
while impressionable_id is a Integer column in database.
|
93
97
|
|
94
98
|
def show
|
95
99
|
@widget = Widget.find
|
96
|
-
impressionist(@widget,message
|
100
|
+
impressionist(@widget, "message...") # 2nd argument is optional
|
97
101
|
end
|
98
102
|
|
99
103
|
5. Get unique impression count from a model. This groups impressions by
|
@@ -111,7 +115,12 @@ Usage
|
|
111
115
|
|
112
116
|
@widget.impressionist_count(:filter=>:ip_address)
|
113
117
|
|
114
|
-
7. Get the unique impression count from a model filtered by
|
118
|
+
7. Get the unique impression count from a model filtered by params. This
|
119
|
+
in turn will give you impressions with unique params.
|
120
|
+
|
121
|
+
@widget.impressionist_count(:filter => :params)
|
122
|
+
|
123
|
+
8. Get the unique impression count from a model filtered by session hash. Same
|
115
124
|
as #6 regarding request hash. This may be more desirable than filtering by
|
116
125
|
IP address depending on your situation, since filtering by IP may ignore
|
117
126
|
visitors that use the same IP. The downside to this filtering is that a
|
@@ -119,12 +128,12 @@ Usage
|
|
119
128
|
|
120
129
|
@widget.impressionist_count(:filter=>:session_hash)
|
121
130
|
|
122
|
-
|
131
|
+
9. Get total impression count. This may return more than 1 impression per http
|
123
132
|
request, depending on how you are logging impressions
|
124
133
|
|
125
134
|
@widget.impressionist_count(:filter=>:all)
|
126
135
|
|
127
|
-
|
136
|
+
10. Get impression count by message. This only counts impressions of the given message.
|
128
137
|
|
129
138
|
@widget.impressionist_count(:message=>"pageview", :filter=>:all)
|
130
139
|
|
@@ -179,6 +188,9 @@ impressions in your controller:
|
|
179
188
|
|
180
189
|
# only record impression if session is unique
|
181
190
|
impressionist :unique => [:session_hash]
|
191
|
+
|
192
|
+
# only record impression if param is unique
|
193
|
+
impressionist :unique => [:params]
|
182
194
|
|
183
195
|
Or you can use the `impressionist` method directly:
|
184
196
|
|
@@ -3,7 +3,7 @@ require 'digest/sha2'
|
|
3
3
|
module ImpressionistController
|
4
4
|
module ClassMethods
|
5
5
|
def impressionist(opts={})
|
6
|
-
before_filter { |c| c.impressionist_subapp_filter(opts
|
6
|
+
before_filter { |c| c.impressionist_subapp_filter(opts) }
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -13,7 +13,7 @@ module ImpressionistController
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def impressionist(obj,message=nil,opts={})
|
16
|
-
|
16
|
+
if should_count_impression?(opts)
|
17
17
|
if obj.respond_to?("impressionable?")
|
18
18
|
if unique_instance?(obj, opts[:unique])
|
19
19
|
obj.impressions.create(associative_create_statement({:message => message}))
|
@@ -29,10 +29,11 @@ module ImpressionistController
|
|
29
29
|
@impressionist_hash = Digest::SHA2.hexdigest(Time.now.to_f.to_s+rand(10000).to_s)
|
30
30
|
end
|
31
31
|
|
32
|
-
def impressionist_subapp_filter(
|
33
|
-
|
32
|
+
def impressionist_subapp_filter(opts = {})
|
33
|
+
if should_count_impression?(opts)
|
34
|
+
actions = opts[:actions]
|
34
35
|
actions.collect!{|a|a.to_s} unless actions.blank?
|
35
|
-
if (actions.blank? || actions.include?(action_name)) && unique?(
|
36
|
+
if (actions.blank? || actions.include?(action_name)) && unique?(opts[:unique])
|
36
37
|
Impression.create(direct_create_statement)
|
37
38
|
end
|
38
39
|
end
|
@@ -49,7 +50,8 @@ module ImpressionistController
|
|
49
50
|
:request_hash => @impressionist_hash,
|
50
51
|
:session_hash => session_hash,
|
51
52
|
:ip_address => request.remote_ip,
|
52
|
-
:referrer => request.referer
|
53
|
+
:referrer => request.referer,
|
54
|
+
:params => params_hash
|
53
55
|
)
|
54
56
|
end
|
55
57
|
|
@@ -59,17 +61,52 @@ module ImpressionistController
|
|
59
61
|
Impressionist::Bots.bot?(request.user_agent)
|
60
62
|
end
|
61
63
|
|
64
|
+
def should_count_impression?(opts)
|
65
|
+
!bypass && condition_true?(opts[:if]) && condition_false?(opts[:unless])
|
66
|
+
end
|
67
|
+
|
68
|
+
def condition_true?(condition)
|
69
|
+
condition.present? ? conditional?(condition) : true
|
70
|
+
end
|
71
|
+
|
72
|
+
def condition_false?(condition)
|
73
|
+
condition.present? ? !conditional?(condition) : true
|
74
|
+
end
|
75
|
+
|
76
|
+
def conditional?(condition)
|
77
|
+
condition.is_a?(Symbol) ? self.send(condition) : condition.call
|
78
|
+
end
|
79
|
+
|
62
80
|
def unique_instance?(impressionable, unique_opts)
|
63
|
-
return unique_opts.blank? || !impressionable.impressions.where(unique_query(unique_opts)).exists?
|
81
|
+
return unique_opts.blank? || !impressionable.impressions.where(unique_query(unique_opts, impressionable)).exists?
|
64
82
|
end
|
65
83
|
|
66
84
|
def unique?(unique_opts)
|
67
|
-
return unique_opts.blank? ||
|
85
|
+
return unique_opts.blank? || check_impression?(unique_opts)
|
68
86
|
end
|
69
87
|
|
88
|
+
def check_impression?(unique_opts)
|
89
|
+
impressions = Impression.where(unique_query(unique_opts - [:params]))
|
90
|
+
check_unique_impression?(impressions, unique_opts)
|
91
|
+
end
|
92
|
+
|
93
|
+
def check_unique_impression?(impressions, unique_opts)
|
94
|
+
impressions_present = impressions.exists?
|
95
|
+
impressions_present && unique_opts_has_params?(unique_opts) ? check_unique_with_params?(impressions) : !impressions_present
|
96
|
+
end
|
97
|
+
|
98
|
+
def unique_opts_has_params?(unique_opts)
|
99
|
+
unique_opts.include?(:params)
|
100
|
+
end
|
101
|
+
|
102
|
+
def check_unique_with_params?(impressions)
|
103
|
+
request_param = params_hash
|
104
|
+
impressions.detect{|impression| impression.params == request_param }.nil?
|
105
|
+
end
|
106
|
+
|
70
107
|
# creates the query to check for uniqueness
|
71
|
-
def unique_query(unique_opts)
|
72
|
-
full_statement = direct_create_statement
|
108
|
+
def unique_query(unique_opts,impressionable=nil)
|
109
|
+
full_statement = direct_create_statement({},impressionable)
|
73
110
|
# reduce the full statement to the params we need for the specified unique options
|
74
111
|
unique_opts.reduce({}) do |query, param|
|
75
112
|
query[param] = full_statement[param]
|
@@ -78,10 +115,10 @@ module ImpressionistController
|
|
78
115
|
end
|
79
116
|
|
80
117
|
# creates a statment hash that contains default values for creating an impression.
|
81
|
-
def direct_create_statement(query_params={})
|
118
|
+
def direct_create_statement(query_params={},impressionable=nil)
|
82
119
|
query_params.reverse_merge!(
|
83
120
|
:impressionable_type => controller_name.singularize.camelize,
|
84
|
-
:impressionable_id=> params[:id]
|
121
|
+
:impressionable_id => impressionable.present? ? impressionable.id : params[:id]
|
85
122
|
)
|
86
123
|
associative_create_statement(query_params)
|
87
124
|
end
|
@@ -95,6 +132,10 @@ module ImpressionistController
|
|
95
132
|
request.session_options[:id]
|
96
133
|
end
|
97
134
|
|
135
|
+
def params_hash
|
136
|
+
request.params.except(:controller, :action, :id)
|
137
|
+
end
|
138
|
+
|
98
139
|
#use both @current_user and current_user helper
|
99
140
|
def user_id
|
100
141
|
user_id = @current_user ? @current_user.id : nil rescue nil
|
@@ -41,7 +41,7 @@ module Impressionist
|
|
41
41
|
|
42
42
|
# Count all distinct impressions unless the :all filter is provided.
|
43
43
|
distinct = options[:filter] != :all
|
44
|
-
if Rails::VERSION::MAJOR
|
44
|
+
if Rails::VERSION::MAJOR >= 4
|
45
45
|
distinct ? imps.select(options[:filter]).distinct.count : imps.count
|
46
46
|
else
|
47
47
|
distinct ? imps.count(options[:filter], :distinct => true) : imps.count
|
data/gemfiles/rails32.gemfile
CHANGED
@@ -18,9 +18,13 @@ group :test do
|
|
18
18
|
gem 'minitest'
|
19
19
|
gem 'minitest-rails'
|
20
20
|
gem 'rails', '~> 3.2.15'
|
21
|
-
gem 'rspec-rails'
|
21
|
+
gem 'rspec-rails', '~> 2.14.0'
|
22
22
|
gem 'simplecov'
|
23
23
|
gem 'systemu'
|
24
|
+
gem 'friendly_id', '~> 4.0.9'
|
25
|
+
|
26
|
+
# test/unit has been removed by default in Ruby 2.2.x+
|
27
|
+
gem 'test-unit'
|
24
28
|
end
|
25
29
|
|
26
30
|
gemspec :path => '../'
|
data/gemfiles/rails40.gemfile
CHANGED
@@ -18,9 +18,13 @@ group :test do
|
|
18
18
|
gem 'minitest'
|
19
19
|
gem 'minitest-rails'
|
20
20
|
gem 'rails', '~> 4.0.1'
|
21
|
-
gem 'rspec-rails'
|
21
|
+
gem 'rspec-rails', '~> 2.14.0'
|
22
22
|
gem 'simplecov'
|
23
23
|
gem 'systemu'
|
24
|
+
gem 'friendly_id', '~> 5.1.0'
|
25
|
+
|
26
|
+
# test/unit has been removed by default in Ruby 2.2.x+
|
27
|
+
gem 'test-unit'
|
24
28
|
end
|
25
29
|
|
26
30
|
gemspec :path => '../'
|
data/impressionist.gemspec
CHANGED
@@ -18,8 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.require_path = 'lib'
|
19
19
|
s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version=
|
20
20
|
|
21
|
-
s.add_dependency '
|
22
|
-
s.add_dependency 'nokogiri', '~> 1.5'
|
23
|
-
|
21
|
+
s.add_dependency 'nokogiri', '~> 1.6'
|
24
22
|
s.add_development_dependency 'bundler', '~> 1.0'
|
25
23
|
end
|
@@ -12,6 +12,7 @@ class CreateImpressionsTable < ActiveRecord::Migration
|
|
12
12
|
t.string :session_hash
|
13
13
|
t.text :message
|
14
14
|
t.text :referrer
|
15
|
+
t.text :params
|
15
16
|
t.timestamps
|
16
17
|
end
|
17
18
|
add_index :impressions, [:impressionable_type, :message, :impressionable_id], :name => "impressionable_type_message_index", :unique => false, :length => {:message => 255 }
|
@@ -21,6 +22,7 @@ class CreateImpressionsTable < ActiveRecord::Migration
|
|
21
22
|
add_index :impressions, [:controller_name,:action_name,:request_hash], :name => "controlleraction_request_index", :unique => false
|
22
23
|
add_index :impressions, [:controller_name,:action_name,:ip_address], :name => "controlleraction_ip_index", :unique => false
|
23
24
|
add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false
|
25
|
+
add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name => "poly_params_request_index", :unique => false
|
24
26
|
add_index :impressions, :user_id
|
25
27
|
end
|
26
28
|
|
data/lib/impressionist/bots.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
|
-
require '
|
1
|
+
require 'timeout'
|
2
|
+
require 'net/http'
|
2
3
|
require 'nokogiri'
|
3
4
|
|
4
5
|
module Impressionist
|
5
6
|
module Bots
|
6
7
|
LIST_URL = "http://www.user-agents.org/allagents.xml"
|
7
8
|
def self.consume
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
Timeout.timeout(4) do
|
10
|
+
response = Net::HTTP.get(URI.parse(LIST_URL))
|
11
|
+
doc = Nokogiri::XML(response)
|
12
|
+
list = []
|
13
|
+
doc.xpath('//user-agent').each do |agent|
|
14
|
+
type = agent.xpath("Type").text
|
15
|
+
list << agent.xpath("String").text.gsub("<","<") if ["R","S"].include?(type) #gsub hack for badly formatted data
|
16
|
+
end
|
17
|
+
list
|
14
18
|
end
|
15
|
-
list
|
16
19
|
end
|
17
20
|
end
|
18
21
|
end
|
data/tests/test_app/.gitignore
CHANGED
data/tests/test_app/Gemfile
CHANGED
@@ -34,8 +34,11 @@ end
|
|
34
34
|
|
35
35
|
group :development, :test do
|
36
36
|
gem 'autotest-notification'
|
37
|
-
gem 'rspec-rails'
|
37
|
+
gem 'rspec-rails', '~> 2.14.0'
|
38
38
|
gem 'spork'
|
39
|
+
|
40
|
+
# test/unit has been removed by default in Ruby 2.2.x+
|
41
|
+
gem 'test-unit'
|
39
42
|
end
|
40
43
|
|
41
44
|
group :test do
|
@@ -45,3 +48,4 @@ group :test do
|
|
45
48
|
end
|
46
49
|
|
47
50
|
gem 'jquery-rails'
|
51
|
+
gem 'friendly_id', '~> 4.0.9'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class WidgetsController < ApplicationController
|
2
|
-
impressionist :actions=>[:show
|
2
|
+
impressionist :actions=>[:show, :index], :unique => [:controller_name, :action_name, :impressionable_id, :params]
|
3
3
|
|
4
4
|
def show
|
5
5
|
end
|
@@ -11,6 +11,7 @@ class CreateImpressionsTable < ActiveRecord::Migration
|
|
11
11
|
t.string :ip_address
|
12
12
|
t.string :session_hash
|
13
13
|
t.text :message
|
14
|
+
t.text :params
|
14
15
|
t.text :referrer
|
15
16
|
t.timestamps
|
16
17
|
end
|
@@ -21,6 +22,7 @@ class CreateImpressionsTable < ActiveRecord::Migration
|
|
21
22
|
add_index :impressions, [:controller_name,:action_name,:request_hash], :name => "controlleraction_request_index", :unique => false
|
22
23
|
add_index :impressions, [:controller_name,:action_name,:ip_address], :name => "controlleraction_ip_index", :unique => false
|
23
24
|
add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false
|
25
|
+
add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name => "poly_params_request_index", :unique => false
|
24
26
|
add_index :impressions, :user_id
|
25
27
|
end
|
26
28
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateFriendlyIdSlugs < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :friendly_id_slugs do |t|
|
5
|
+
t.string :slug, :null => false
|
6
|
+
t.integer :sluggable_id, :null => false
|
7
|
+
t.string :sluggable_type, :limit => 40
|
8
|
+
t.datetime :created_at
|
9
|
+
end
|
10
|
+
add_index :friendly_id_slugs, :sluggable_id
|
11
|
+
add_index :friendly_id_slugs, [:slug, :sluggable_type], :unique => true
|
12
|
+
add_index :friendly_id_slugs, :sluggable_type
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :friendly_id_slugs
|
17
|
+
end
|
18
|
+
end
|
data/tests/test_app/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20150207140310) do
|
15
15
|
|
16
16
|
create_table "articles", :force => true do |t|
|
17
17
|
t.string "name"
|
@@ -19,6 +19,17 @@ ActiveRecord::Schema.define(:version => 20130719024021) do
|
|
19
19
|
t.datetime "updated_at", :null => false
|
20
20
|
end
|
21
21
|
|
22
|
+
create_table "friendly_id_slugs", :force => true do |t|
|
23
|
+
t.string "slug", :null => false
|
24
|
+
t.integer "sluggable_id", :null => false
|
25
|
+
t.string "sluggable_type", :limit => 40
|
26
|
+
t.datetime "created_at"
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index "friendly_id_slugs", ["slug", "sluggable_type"], :name => "index_friendly_id_slugs_on_slug_and_sluggable_type", :unique => true
|
30
|
+
add_index "friendly_id_slugs", ["sluggable_id"], :name => "index_friendly_id_slugs_on_sluggable_id"
|
31
|
+
add_index "friendly_id_slugs", ["sluggable_type"], :name => "index_friendly_id_slugs_on_sluggable_type"
|
32
|
+
|
22
33
|
create_table "impressions", :force => true do |t|
|
23
34
|
t.string "impressionable_type"
|
24
35
|
t.integer "impressionable_id"
|
@@ -30,6 +41,7 @@ ActiveRecord::Schema.define(:version => 20130719024021) do
|
|
30
41
|
t.string "ip_address"
|
31
42
|
t.string "session_hash"
|
32
43
|
t.text "message"
|
44
|
+
t.text "params"
|
33
45
|
t.text "referrer"
|
34
46
|
t.datetime "created_at", :null => false
|
35
47
|
t.datetime "updated_at", :null => false
|
@@ -39,6 +51,7 @@ ActiveRecord::Schema.define(:version => 20130719024021) do
|
|
39
51
|
add_index "impressions", ["controller_name", "action_name", "request_hash"], :name => "controlleraction_request_index"
|
40
52
|
add_index "impressions", ["controller_name", "action_name", "session_hash"], :name => "controlleraction_session_index"
|
41
53
|
add_index "impressions", ["impressionable_type", "impressionable_id", "ip_address"], :name => "poly_ip_index"
|
54
|
+
add_index "impressions", ["impressionable_type", "impressionable_id", "params"], :name => "poly_params_request_index"
|
42
55
|
add_index "impressions", ["impressionable_type", "impressionable_id", "request_hash"], :name => "poly_request_index"
|
43
56
|
add_index "impressions", ["impressionable_type", "impressionable_id", "session_hash"], :name => "poly_session_index"
|
44
57
|
add_index "impressions", ["impressionable_type", "message", "impressionable_id"], :name => "impressionable_type_message_index"
|
@@ -50,6 +63,13 @@ ActiveRecord::Schema.define(:version => 20130719024021) do
|
|
50
63
|
t.datetime "updated_at", :null => false
|
51
64
|
end
|
52
65
|
|
66
|
+
create_table "profiles", :force => true do |t|
|
67
|
+
t.string "username"
|
68
|
+
t.string "slug"
|
69
|
+
t.datetime "created_at", :null => false
|
70
|
+
t.datetime "updated_at", :null => false
|
71
|
+
end
|
72
|
+
|
53
73
|
create_table "widgets", :force => true do |t|
|
54
74
|
t.string "name"
|
55
75
|
t.integer "impressions_count", :default => 0
|
@@ -53,8 +53,24 @@ describe ArticlesController do
|
|
53
53
|
click_link "Same Page"
|
54
54
|
Impression.last.referrer.should eq "http://test.host/articles/1"
|
55
55
|
end
|
56
|
-
end
|
57
56
|
|
57
|
+
it "should log request with params (checked = true)" do
|
58
|
+
get "show", id: 1, checked: true
|
59
|
+
Impression.last.params.should eq({"checked"=>true})
|
60
|
+
Impression.last.request_hash.size.should eq 64
|
61
|
+
Impression.last.ip_address.should eq "0.0.0.0"
|
62
|
+
Impression.last.session_hash.size.should eq 32
|
63
|
+
Impression.last.referrer.should eq nil
|
64
|
+
end
|
58
65
|
|
66
|
+
it "should log request with params {}" do
|
67
|
+
get "index"
|
68
|
+
Impression.last.params.should eq({})
|
69
|
+
Impression.last.request_hash.size.should eq 64
|
70
|
+
Impression.last.ip_address.should eq "0.0.0.0"
|
71
|
+
Impression.last.session_hash.size.should eq 32
|
72
|
+
Impression.last.referrer.should eq nil
|
73
|
+
end
|
74
|
+
end
|
59
75
|
|
60
76
|
|
@@ -10,63 +10,63 @@ describe DummyController do
|
|
10
10
|
describe "impressionist filter uniqueness" do
|
11
11
|
|
12
12
|
it "should ignore uniqueness if not requested" do
|
13
|
-
controller.impressionist_subapp_filter
|
14
|
-
controller.impressionist_subapp_filter
|
13
|
+
controller.impressionist_subapp_filter
|
14
|
+
controller.impressionist_subapp_filter
|
15
15
|
Impression.should have(@impression_count + 2).records
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should recognize unique session" do
|
19
19
|
controller.stub(:session_hash).and_return(request.session_options[:id])
|
20
|
-
controller.impressionist_subapp_filter(
|
21
|
-
controller.impressionist_subapp_filter(
|
20
|
+
controller.impressionist_subapp_filter(unique: [:session_hash])
|
21
|
+
controller.impressionist_subapp_filter(unique: [:session_hash])
|
22
22
|
Impression.should have(@impression_count + 1).records
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should recognize unique ip" do
|
26
26
|
controller.request.stub(:remote_ip).and_return("1.2.3.4")
|
27
|
-
controller.impressionist_subapp_filter(
|
28
|
-
controller.impressionist_subapp_filter(
|
27
|
+
controller.impressionist_subapp_filter(unique: [:ip_address])
|
28
|
+
controller.impressionist_subapp_filter(unique: [:ip_address])
|
29
29
|
Impression.should have(@impression_count + 1).records
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should recognize unique request" do
|
33
|
-
controller.impressionist_subapp_filter(
|
34
|
-
controller.impressionist_subapp_filter(
|
33
|
+
controller.impressionist_subapp_filter(unique: [:request_hash])
|
34
|
+
controller.impressionist_subapp_filter(unique: [:request_hash])
|
35
35
|
Impression.should have(@impression_count + 1).records
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should recognize unique action" do
|
39
39
|
controller.stub(:action_name).and_return("test_action")
|
40
|
-
controller.impressionist_subapp_filter(
|
41
|
-
controller.impressionist_subapp_filter(
|
40
|
+
controller.impressionist_subapp_filter(unique: [:action_name])
|
41
|
+
controller.impressionist_subapp_filter(unique: [:action_name])
|
42
42
|
Impression.should have(@impression_count + 1).records
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should recognize unique controller" do
|
46
46
|
controller.stub(:controller_name).and_return("post")
|
47
|
-
controller.impressionist_subapp_filter(
|
48
|
-
controller.impressionist_subapp_filter(
|
47
|
+
controller.impressionist_subapp_filter(unique: [:controller_name])
|
48
|
+
controller.impressionist_subapp_filter(unique: [:controller_name])
|
49
49
|
Impression.should have(@impression_count + 1).records
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should recognize unique user" do
|
53
53
|
controller.stub(:user_id).and_return(42)
|
54
|
-
controller.impressionist_subapp_filter(
|
55
|
-
controller.impressionist_subapp_filter(
|
54
|
+
controller.impressionist_subapp_filter(unique: [:user_id])
|
55
|
+
controller.impressionist_subapp_filter(unique: [:user_id])
|
56
56
|
Impression.should have(@impression_count + 1).records
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should recognize unique referer" do
|
60
60
|
controller.request.stub(:referer).and_return("http://foo/bar")
|
61
|
-
controller.impressionist_subapp_filter(
|
62
|
-
controller.impressionist_subapp_filter(
|
61
|
+
controller.impressionist_subapp_filter(unique: [:referrer])
|
62
|
+
controller.impressionist_subapp_filter(unique: [:referrer])
|
63
63
|
Impression.should have(@impression_count + 1).records
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should recognize unique id" do
|
67
67
|
controller.stub(:params).and_return({:id => "666"}) # for correct impressionable id in filter
|
68
|
-
controller.impressionist_subapp_filter(
|
69
|
-
controller.impressionist_subapp_filter(
|
68
|
+
controller.impressionist_subapp_filter(unique: [:impressionable_id])
|
69
|
+
controller.impressionist_subapp_filter(unique: [:impressionable_id])
|
70
70
|
Impression.should have(@impression_count + 1).records
|
71
71
|
end
|
72
72
|
|
@@ -74,104 +74,104 @@ describe DummyController do
|
|
74
74
|
it "should recognize different controller and action" do
|
75
75
|
controller.stub(:controller_name).and_return("post")
|
76
76
|
controller.stub(:action_name).and_return("test_action")
|
77
|
-
controller.impressionist_subapp_filter(
|
78
|
-
controller.impressionist_subapp_filter(
|
77
|
+
controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
|
78
|
+
controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
|
79
79
|
Impression.should have(@impression_count + 1).records
|
80
80
|
controller.stub(:action_name).and_return("another_action")
|
81
|
-
controller.impressionist_subapp_filter(
|
82
|
-
controller.impressionist_subapp_filter(
|
81
|
+
controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
|
82
|
+
controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
|
83
83
|
Impression.should have(@impression_count + 2).records
|
84
84
|
controller.stub(:controller_name).and_return("article")
|
85
|
-
controller.impressionist_subapp_filter(
|
86
|
-
controller.impressionist_subapp_filter(
|
85
|
+
controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
|
86
|
+
controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
|
87
87
|
Impression.should have(@impression_count + 3).records
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should recognize different action" do
|
91
91
|
controller.stub(:action_name).and_return("test_action")
|
92
|
-
controller.impressionist_subapp_filter(
|
93
|
-
controller.impressionist_subapp_filter(
|
92
|
+
controller.impressionist_subapp_filter(unique: [:action_name])
|
93
|
+
controller.impressionist_subapp_filter(unique: [:action_name])
|
94
94
|
Impression.should have(@impression_count + 1).records
|
95
95
|
controller.stub(:action_name).and_return("another_action")
|
96
|
-
controller.impressionist_subapp_filter(
|
97
|
-
controller.impressionist_subapp_filter(
|
96
|
+
controller.impressionist_subapp_filter(unique: [:action_name])
|
97
|
+
controller.impressionist_subapp_filter(unique: [:action_name])
|
98
98
|
Impression.should have(@impression_count + 2).records
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should recognize different controller" do
|
102
102
|
controller.stub(:controller_name).and_return("post")
|
103
|
-
controller.impressionist_subapp_filter(
|
104
|
-
controller.impressionist_subapp_filter(
|
103
|
+
controller.impressionist_subapp_filter(unique: [:controller_name])
|
104
|
+
controller.impressionist_subapp_filter(unique: [:controller_name])
|
105
105
|
Impression.should have(@impression_count + 1).records
|
106
106
|
controller.stub(:controller_name).and_return("article")
|
107
|
-
controller.impressionist_subapp_filter(
|
108
|
-
controller.impressionist_subapp_filter(
|
107
|
+
controller.impressionist_subapp_filter(unique: [:controller_name])
|
108
|
+
controller.impressionist_subapp_filter(unique: [:controller_name])
|
109
109
|
Impression.should have(@impression_count + 2).records
|
110
110
|
end
|
111
111
|
|
112
112
|
it "should recognize different session" do
|
113
113
|
controller.stub(:session_hash).and_return("foo")
|
114
|
-
controller.impressionist_subapp_filter(
|
115
|
-
controller.impressionist_subapp_filter(
|
114
|
+
controller.impressionist_subapp_filter(unique: [:session_hash])
|
115
|
+
controller.impressionist_subapp_filter(unique: [:session_hash])
|
116
116
|
Impression.should have(@impression_count + 1).records
|
117
117
|
controller.stub(:session_hash).and_return("bar")
|
118
|
-
controller.impressionist_subapp_filter(
|
119
|
-
controller.impressionist_subapp_filter(
|
118
|
+
controller.impressionist_subapp_filter(unique: [:session_hash])
|
119
|
+
controller.impressionist_subapp_filter(unique: [:session_hash])
|
120
120
|
Impression.should have(@impression_count + 2).records
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should recognize different ip" do
|
124
124
|
controller.request.stub(:remote_ip).and_return("1.2.3.4")
|
125
|
-
controller.impressionist_subapp_filter(
|
126
|
-
controller.impressionist_subapp_filter(
|
125
|
+
controller.impressionist_subapp_filter(unique: [:ip_address])
|
126
|
+
controller.impressionist_subapp_filter(unique: [:ip_address])
|
127
127
|
Impression.should have(@impression_count + 1).records
|
128
128
|
controller.request.stub(:remote_ip).and_return("5.6.7.8")
|
129
|
-
controller.impressionist_subapp_filter(
|
130
|
-
controller.impressionist_subapp_filter(
|
129
|
+
controller.impressionist_subapp_filter(unique: [:ip_address])
|
130
|
+
controller.impressionist_subapp_filter(unique: [:ip_address])
|
131
131
|
Impression.should have(@impression_count + 2).records
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should recognize different referer" do
|
135
135
|
controller.request.stub(:referer).and_return("http://foo/bar")
|
136
|
-
controller.impressionist_subapp_filter(
|
137
|
-
controller.impressionist_subapp_filter(
|
136
|
+
controller.impressionist_subapp_filter(unique: [:referrer])
|
137
|
+
controller.impressionist_subapp_filter(unique: [:referrer])
|
138
138
|
Impression.should have(@impression_count + 1).records
|
139
139
|
controller.request.stub(:referer).and_return("http://bar/fo")
|
140
|
-
controller.impressionist_subapp_filter(
|
141
|
-
controller.impressionist_subapp_filter(
|
140
|
+
controller.impressionist_subapp_filter(unique: [:referrer])
|
141
|
+
controller.impressionist_subapp_filter(unique: [:referrer])
|
142
142
|
Impression.should have(@impression_count + 2).records
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should recognize different id" do
|
146
146
|
controller.stub(:params).and_return({:id => "666"}) # for correct impressionable id in filter
|
147
|
-
controller.impressionist_subapp_filter(
|
148
|
-
controller.impressionist_subapp_filter(
|
147
|
+
controller.impressionist_subapp_filter(unique: [:impressionable_type, :impressionable_id])
|
148
|
+
controller.impressionist_subapp_filter(unique: [:impressionable_type, :impressionable_id])
|
149
149
|
controller.stub(:params).and_return({:id => "42"}) # for correct impressionable id in filter
|
150
|
-
controller.impressionist_subapp_filter(
|
151
|
-
controller.impressionist_subapp_filter(
|
150
|
+
controller.impressionist_subapp_filter(unique: [:impressionable_type, :impressionable_id])
|
151
|
+
controller.impressionist_subapp_filter(unique: [:impressionable_type, :impressionable_id])
|
152
152
|
Impression.should have(@impression_count + 2).records
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should recognize combined uniqueness" do
|
156
156
|
controller.stub(:action_name).and_return("test_action")
|
157
|
-
controller.impressionist_subapp_filter(
|
158
|
-
controller.impressionist_subapp_filter(
|
159
|
-
controller.impressionist_subapp_filter(
|
160
|
-
controller.impressionist_subapp_filter(
|
161
|
-
controller.impressionist_subapp_filter(
|
162
|
-
controller.impressionist_subapp_filter(
|
163
|
-
controller.impressionist_subapp_filter(
|
164
|
-
controller.impressionist_subapp_filter(
|
157
|
+
controller.impressionist_subapp_filter(unique: [:ip_address, :request_hash, :action_name])
|
158
|
+
controller.impressionist_subapp_filter(unique: [:request_hash, :ip_address, :action_name])
|
159
|
+
controller.impressionist_subapp_filter(unique: [:request_hash, :action_name])
|
160
|
+
controller.impressionist_subapp_filter(unique: [:ip_address, :action_name])
|
161
|
+
controller.impressionist_subapp_filter(unique: [:ip_address, :request_hash])
|
162
|
+
controller.impressionist_subapp_filter(unique: [:action_name])
|
163
|
+
controller.impressionist_subapp_filter(unique: [:ip_address])
|
164
|
+
controller.impressionist_subapp_filter(unique: [:request_hash])
|
165
165
|
Impression.should have(@impression_count + 1).records
|
166
166
|
end
|
167
167
|
|
168
168
|
it "should recognize combined non-uniqueness" do
|
169
169
|
controller.stub(:action_name).and_return(nil)
|
170
|
-
controller.impressionist_subapp_filter(
|
170
|
+
controller.impressionist_subapp_filter(unique: [:ip_address, :action_name])
|
171
171
|
controller.stub(:action_name).and_return("test_action")
|
172
|
-
controller.impressionist_subapp_filter(
|
172
|
+
controller.impressionist_subapp_filter(unique: [:ip_address, :action_name])
|
173
173
|
controller.stub(:action_name).and_return("another_action")
|
174
|
-
controller.impressionist_subapp_filter(
|
174
|
+
controller.impressionist_subapp_filter(unique: [:ip_address, :action_name])
|
175
175
|
Impression.should have(@impression_count + 3).records
|
176
176
|
end
|
177
177
|
|
@@ -299,12 +299,98 @@ describe DummyController do
|
|
299
299
|
controller.stub(:session_hash).and_return("foo")
|
300
300
|
controller.request.stub(:remote_ip).and_return("1.2.3.4")
|
301
301
|
# order of the following methods is important for the test!
|
302
|
-
controller.impressionist_subapp_filter(
|
302
|
+
controller.impressionist_subapp_filter(unique: [:ip_address, :request_hash, :session_hash])
|
303
303
|
controller.impressionist(impressionable, nil, :unique => [:ip_address, :request_hash, :session_hash])
|
304
304
|
Impression.should have(@impression_count + 1).records
|
305
305
|
end
|
306
306
|
|
307
307
|
end
|
308
308
|
|
309
|
+
describe 'impressionist with friendly id' do
|
310
|
+
it 'should unique' do
|
311
|
+
impressionable = Profile.create({username: 'test_profile', slug: 'test_profile'})
|
312
|
+
|
313
|
+
controller.stub(:controller_name).and_return('profile')
|
314
|
+
controller.stub(:action_name).and_return('show')
|
315
|
+
controller.stub(:params).and_return({id: impressionable.slug})
|
316
|
+
controller.request.stub(:remote_ip).and_return('1.2.3.4')
|
317
|
+
|
318
|
+
controller.impressionist(impressionable, nil, :unique => [:impressionable_type, :impressionable_id])
|
319
|
+
controller.impressionist(impressionable, nil, :unique => [:impressionable_type, :impressionable_id])
|
320
|
+
Impression.should have(@impression_count + 1).records
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
shared_examples_for 'an impressionable action' do
|
325
|
+
it 'should record an impression' do
|
326
|
+
controller.impressionist_subapp_filter(condition)
|
327
|
+
Impression.should have(@impression_count + 1).records
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
shared_examples_for 'an unimpressionable action' do
|
332
|
+
it 'should record an impression' do
|
333
|
+
controller.impressionist_subapp_filter(condition)
|
334
|
+
Impression.should have(@impression_count).records
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
describe "conditional impressions" do
|
339
|
+
describe ":if condition" do
|
340
|
+
context "true condition" do
|
341
|
+
before do
|
342
|
+
controller.stub(:true_condition).and_return(true)
|
343
|
+
end
|
344
|
+
it_behaves_like 'an impressionable action' do
|
345
|
+
let(:condition) {{ if: :true_condition }}
|
346
|
+
end
|
347
|
+
|
348
|
+
it_behaves_like 'an impressionable action' do
|
349
|
+
let(:condition) {{ if: lambda { true } }}
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
context "false condition" do
|
354
|
+
before do
|
355
|
+
controller.stub(:false_condition).and_return(false)
|
356
|
+
end
|
357
|
+
it_behaves_like 'an unimpressionable action' do
|
358
|
+
let(:condition) {{ if: :false_condition }}
|
359
|
+
end
|
360
|
+
|
361
|
+
it_behaves_like 'an unimpressionable action' do
|
362
|
+
let(:condition) {{ if: lambda { false } }}
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
describe ":unless condition" do
|
368
|
+
context "true condition" do
|
369
|
+
before do
|
370
|
+
controller.stub(:true_condition).and_return(true)
|
371
|
+
end
|
372
|
+
it_behaves_like 'an unimpressionable action' do
|
373
|
+
let(:condition) {{ unless: :true_condition }}
|
374
|
+
end
|
375
|
+
|
376
|
+
it_behaves_like 'an unimpressionable action' do
|
377
|
+
let(:condition) {{ unless: lambda { true } }}
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
context "false condition" do
|
382
|
+
before do
|
383
|
+
controller.stub(:false_condition).and_return(false)
|
384
|
+
end
|
385
|
+
it_behaves_like 'an impressionable action' do
|
386
|
+
let(:condition) {{ unless: :false_condition }}
|
387
|
+
end
|
388
|
+
|
389
|
+
it_behaves_like 'an impressionable action' do
|
390
|
+
let(:condition) {{ unless: lambda { false } }}
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
end
|
309
395
|
end
|
310
396
|
|
@@ -16,4 +16,13 @@ describe PostsController do
|
|
16
16
|
Post.first.impressions.last.user_id.should eq 123
|
17
17
|
end
|
18
18
|
|
19
|
+
it "should log impression at the action level with params" do
|
20
|
+
get "show", id: 1, checked: true
|
21
|
+
Impression.all.size.should eq 12
|
22
|
+
Impression.last.params.should eq({"checked"=>true})
|
23
|
+
Impression.last.controller_name.should eq "posts"
|
24
|
+
Impression.last.action_name.should eq "show"
|
25
|
+
Impression.last.impressionable_type.should eq "Post"
|
26
|
+
Impression.last.impressionable_id.should eq 1
|
27
|
+
end
|
19
28
|
end
|
@@ -44,7 +44,6 @@ describe WidgetsController do
|
|
44
44
|
it "should log unique impressions only once per id" do
|
45
45
|
get "show", :id=> 1
|
46
46
|
Impression.all.size.should eq 12
|
47
|
-
|
48
47
|
get "show", :id=> 2
|
49
48
|
Impression.all.size.should eq 13
|
50
49
|
|
@@ -57,4 +56,36 @@ describe WidgetsController do
|
|
57
56
|
|
58
57
|
end
|
59
58
|
|
59
|
+
context "Impresionist unique params options" do
|
60
|
+
it "should log unique impressions at the per action and params level" do
|
61
|
+
get "show", :id => 1
|
62
|
+
Impression.all.size.should eq 12
|
63
|
+
get "show", :id => 2, checked: true
|
64
|
+
Impression.all.size.should eq 13
|
65
|
+
get "show", :id => 2, checked: false
|
66
|
+
Impression.all.size.should eq 14
|
67
|
+
get "index"
|
68
|
+
Impression.all.size.should eq 15
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should not log impression for same params and same id" do
|
72
|
+
get "show", :id => 1
|
73
|
+
Impression.all.size.should eq 12
|
74
|
+
get "show", :id => 1
|
75
|
+
Impression.all.size.should eq 12
|
76
|
+
get "show", :id => 1, checked: true
|
77
|
+
Impression.all.size.should eq 13
|
78
|
+
get "show", :id => 1, checked: false
|
79
|
+
Impression.all.size.should eq 14
|
80
|
+
get "show", :id => 1, checked: true
|
81
|
+
Impression.all.size.should eq 14
|
82
|
+
get "show", :id => 1, checked: false
|
83
|
+
Impression.all.size.should eq 14
|
84
|
+
get "show", :id => 1
|
85
|
+
Impression.all.size.should eq 14
|
86
|
+
get "show", :id => 2
|
87
|
+
Impression.all.size.should eq 15
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
60
91
|
end
|
@@ -4,7 +4,7 @@ require 'systemu'
|
|
4
4
|
# FIXME this test might break the others if run before them
|
5
5
|
# started fixing @nbit001
|
6
6
|
describe Impressionist, :migration do
|
7
|
-
fixtures :articles,:impressions,:posts
|
7
|
+
fixtures :articles,:impressions,:posts,:profiles
|
8
8
|
it "should delete existing migration and generate the migration file" do
|
9
9
|
pending
|
10
10
|
migrations_dir = "#{Rails.root}/db/migrate"
|
metadata
CHANGED
@@ -1,55 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: impressionist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- johnmcaliley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: httpclient
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.2'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.2'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: nokogiri
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- - ~>
|
17
|
+
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
19
|
+
version: '1.6'
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- - ~>
|
24
|
+
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
26
|
+
version: '1.6'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- - ~>
|
31
|
+
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
33
|
version: '1.0'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - ~>
|
38
|
+
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '1.0'
|
55
41
|
description: Log impressions from controller actions or from a model
|
@@ -58,9 +44,9 @@ executables: []
|
|
58
44
|
extensions: []
|
59
45
|
extra_rdoc_files: []
|
60
46
|
files:
|
61
|
-
- .gitignore
|
62
|
-
- .rspec
|
63
|
-
- .travis.yml
|
47
|
+
- ".gitignore"
|
48
|
+
- ".rspec"
|
49
|
+
- ".travis.yml"
|
64
50
|
- CHANGELOG.rdoc
|
65
51
|
- Gemfile
|
66
52
|
- LICENSE.txt
|
@@ -114,6 +100,7 @@ files:
|
|
114
100
|
- tests/test_app/app/controllers/articles_controller.rb
|
115
101
|
- tests/test_app/app/controllers/dummy_controller.rb
|
116
102
|
- tests/test_app/app/controllers/posts_controller.rb
|
103
|
+
- tests/test_app/app/controllers/profiles_controller.rb
|
117
104
|
- tests/test_app/app/controllers/widgets_controller.rb
|
118
105
|
- tests/test_app/app/helpers/application_helper.rb
|
119
106
|
- tests/test_app/app/mailers/.gitkeep
|
@@ -121,6 +108,7 @@ files:
|
|
121
108
|
- tests/test_app/app/models/article.rb
|
122
109
|
- tests/test_app/app/models/dummy.rb
|
123
110
|
- tests/test_app/app/models/post.rb
|
111
|
+
- tests/test_app/app/models/profile.rb
|
124
112
|
- tests/test_app/app/models/user.rb
|
125
113
|
- tests/test_app/app/models/widget.rb
|
126
114
|
- tests/test_app/app/views/articles/index.html.erb
|
@@ -130,6 +118,7 @@ files:
|
|
130
118
|
- tests/test_app/app/views/posts/edit.html.erb
|
131
119
|
- tests/test_app/app/views/posts/index.html.erb
|
132
120
|
- tests/test_app/app/views/posts/show.html.erb
|
121
|
+
- tests/test_app/app/views/profiles/show.html.erb
|
133
122
|
- tests/test_app/app/views/widgets/index.html.erb
|
134
123
|
- tests/test_app/app/views/widgets/new.html.erb
|
135
124
|
- tests/test_app/app/views/widgets/show.html.erb
|
@@ -156,6 +145,8 @@ files:
|
|
156
145
|
- tests/test_app/db/migrate/20110210205028_create_posts.rb
|
157
146
|
- tests/test_app/db/migrate/20111127184039_create_widgets.rb
|
158
147
|
- tests/test_app/db/migrate/20130719024021_create_impressions_table.rb
|
148
|
+
- tests/test_app/db/migrate/20150207135825_create_profiles.rb
|
149
|
+
- tests/test_app/db/migrate/20150207140310_create_friendly_id_slugs.rb
|
159
150
|
- tests/test_app/db/schema.rb
|
160
151
|
- tests/test_app/db/seeds.rb
|
161
152
|
- tests/test_app/lib/assets/.gitkeep
|
@@ -186,6 +177,7 @@ files:
|
|
186
177
|
- tests/test_app/spec/fixtures/articles.yml
|
187
178
|
- tests/test_app/spec/fixtures/impressions.yml
|
188
179
|
- tests/test_app/spec/fixtures/posts.yml
|
180
|
+
- tests/test_app/spec/fixtures/profiles.yml
|
189
181
|
- tests/test_app/spec/fixtures/widgets.yml
|
190
182
|
- tests/test_app/spec/initializers/initializers_spec.rb
|
191
183
|
- tests/test_app/spec/models/bots_spec.rb
|
@@ -205,17 +197,17 @@ require_paths:
|
|
205
197
|
- lib
|
206
198
|
required_ruby_version: !ruby/object:Gem::Requirement
|
207
199
|
requirements:
|
208
|
-
- -
|
200
|
+
- - ">="
|
209
201
|
- !ruby/object:Gem::Version
|
210
202
|
version: '0'
|
211
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
204
|
requirements:
|
213
|
-
- -
|
205
|
+
- - ">="
|
214
206
|
- !ruby/object:Gem::Version
|
215
207
|
version: 1.3.6
|
216
208
|
requirements: []
|
217
209
|
rubyforge_project:
|
218
|
-
rubygems_version: 2.
|
210
|
+
rubygems_version: 2.4.5
|
219
211
|
signing_key:
|
220
212
|
specification_version: 4
|
221
213
|
summary: Easy way to log impressions
|
@@ -234,6 +226,7 @@ test_files:
|
|
234
226
|
- tests/test_app/app/controllers/articles_controller.rb
|
235
227
|
- tests/test_app/app/controllers/dummy_controller.rb
|
236
228
|
- tests/test_app/app/controllers/posts_controller.rb
|
229
|
+
- tests/test_app/app/controllers/profiles_controller.rb
|
237
230
|
- tests/test_app/app/controllers/widgets_controller.rb
|
238
231
|
- tests/test_app/app/helpers/application_helper.rb
|
239
232
|
- tests/test_app/app/mailers/.gitkeep
|
@@ -241,6 +234,7 @@ test_files:
|
|
241
234
|
- tests/test_app/app/models/article.rb
|
242
235
|
- tests/test_app/app/models/dummy.rb
|
243
236
|
- tests/test_app/app/models/post.rb
|
237
|
+
- tests/test_app/app/models/profile.rb
|
244
238
|
- tests/test_app/app/models/user.rb
|
245
239
|
- tests/test_app/app/models/widget.rb
|
246
240
|
- tests/test_app/app/views/articles/index.html.erb
|
@@ -250,6 +244,7 @@ test_files:
|
|
250
244
|
- tests/test_app/app/views/posts/edit.html.erb
|
251
245
|
- tests/test_app/app/views/posts/index.html.erb
|
252
246
|
- tests/test_app/app/views/posts/show.html.erb
|
247
|
+
- tests/test_app/app/views/profiles/show.html.erb
|
253
248
|
- tests/test_app/app/views/widgets/index.html.erb
|
254
249
|
- tests/test_app/app/views/widgets/new.html.erb
|
255
250
|
- tests/test_app/app/views/widgets/show.html.erb
|
@@ -276,6 +271,8 @@ test_files:
|
|
276
271
|
- tests/test_app/db/migrate/20110210205028_create_posts.rb
|
277
272
|
- tests/test_app/db/migrate/20111127184039_create_widgets.rb
|
278
273
|
- tests/test_app/db/migrate/20130719024021_create_impressions_table.rb
|
274
|
+
- tests/test_app/db/migrate/20150207135825_create_profiles.rb
|
275
|
+
- tests/test_app/db/migrate/20150207140310_create_friendly_id_slugs.rb
|
279
276
|
- tests/test_app/db/schema.rb
|
280
277
|
- tests/test_app/db/seeds.rb
|
281
278
|
- tests/test_app/lib/assets/.gitkeep
|
@@ -306,6 +303,7 @@ test_files:
|
|
306
303
|
- tests/test_app/spec/fixtures/articles.yml
|
307
304
|
- tests/test_app/spec/fixtures/impressions.yml
|
308
305
|
- tests/test_app/spec/fixtures/posts.yml
|
306
|
+
- tests/test_app/spec/fixtures/profiles.yml
|
309
307
|
- tests/test_app/spec/fixtures/widgets.yml
|
310
308
|
- tests/test_app/spec/initializers/initializers_spec.rb
|
311
309
|
- tests/test_app/spec/models/bots_spec.rb
|
@@ -313,4 +311,3 @@ test_files:
|
|
313
311
|
- tests/test_app/spec/models/model_spec.rb
|
314
312
|
- tests/test_app/spec/rails_generators/rails_generators_spec.rb
|
315
313
|
- tests/test_app/spec/spec_helper.rb
|
316
|
-
has_rdoc:
|