devise_keen 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +20 -13
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/devise_keen.gemspec +6 -8
- data/lib/devise_keen.rb +3 -3
- data/lib/devise_keen/model.rb +6 -6
- metadata +5 -7
- data/test/helper.rb +0 -34
- data/test/test_devise_keen.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc7f5412356183bc4240f10134d66819dbd9a05b
|
4
|
+
data.tar.gz: f8ce805c136ce5c269e111134f25833fb8c61a5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63d7c304cba528800c94270363be9dfa8cbd238fdd7200b82ab4344fce56390b5e7e3413e28626cd8c1092802062fa346e51831f24c779b8338b87b8e8743b2a
|
7
|
+
data.tar.gz: d68799840defcf2cbfab3d284b5aeaf090bb1ff9ad8c9e41f6bc937e24fee6accb9bfe08fc538360017fef1d09ff5bcd0395d36177bb439b073803b491c6d1a7
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,23 @@
|
|
1
1
|
# devise_keen gem
|
2
2
|
|
3
|
-
Track user signin and signouts
|
3
|
+
Track user signin and signouts to your Keen IO project automatically.
|
4
4
|
|
5
5
|
## Requirements
|
6
6
|
|
7
|
+
As this is a devise extension, you'll need the devise gem, along with some Keen IO related gems.
|
8
|
+
|
7
9
|
The devise_keen gem requires the [keen gem](https://rubygems.org/gems/keen) and a [Keen IO account](https://keen.io) (free to sign up).
|
8
10
|
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
The only thing you need to do is install the keen_devise gem,
|
14
|
+
|
15
|
+
`gem install keen_devise`
|
16
|
+
|
17
|
+
or add the `keen_devise` gem to your Gemfile:
|
18
|
+
|
19
|
+
`gem 'keen_devise'`
|
20
|
+
|
9
21
|
## Configuration
|
10
22
|
|
11
23
|
There are three configuration paramters:
|
@@ -14,8 +26,8 @@ There are three configuration paramters:
|
|
14
26
|
*Required*. The project id to write to.
|
15
27
|
* `keen_write_key`
|
16
28
|
*Required*. The Keen IO write key.
|
17
|
-
* `
|
18
|
-
|
29
|
+
* `keen_collection_prefix`
|
30
|
+
This gems stores the signin and signout events in two different collections. If you do not specify a prefix, it will default to `devise-keen`. The collection names will look like {keen_collection_prefix}-signin and {keen_collection_prefix}-signout.
|
19
31
|
|
20
32
|
Define these variables in `config/initializers/devise.rb`.
|
21
33
|
|
@@ -25,21 +37,16 @@ Example config:
|
|
25
37
|
# Keen IO Config
|
26
38
|
config.keen_project_id = "ASDF12345"
|
27
39
|
config.keen_write_key = "REALLYLONGWRITEKEYHERE1234567890"
|
28
|
-
config.
|
40
|
+
config.keen_collection_prefix = "user-events"
|
29
41
|
```
|
30
42
|
|
31
43
|
## Contributing to devise_keen
|
32
44
|
|
33
|
-
*
|
34
|
-
*
|
35
|
-
*
|
36
|
-
* Start a feature/bugfix branch.
|
37
|
-
* Commit and push until you are happy with your contribution.
|
38
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
39
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
45
|
+
* Make sure you're on the latest version of the gem to make sure the feature hasn't already been implemented.
|
46
|
+
* If it hasn't, check to see if someone has created an issue for it.
|
47
|
+
* If you want to be an awesome contributor, fork it, branch it, push it!
|
40
48
|
|
41
49
|
## Copyright
|
42
50
|
|
43
|
-
Copyright (c) 2014
|
44
|
-
further details.
|
51
|
+
Copyright (c) 2014 Keen IO. See LICENSE.txt for further details.
|
45
52
|
|
data/Rakefile
CHANGED
@@ -15,10 +15,10 @@ require 'jeweler'
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
17
|
gem.name = "devise_keen"
|
18
|
-
gem.homepage = "
|
18
|
+
gem.homepage = "https://github.com/keenlabs/devise_keen"
|
19
19
|
gem.license = "MIT"
|
20
|
-
gem.summary = "
|
21
|
-
gem.description = "Publish an event to your Keen IO project every time a user
|
20
|
+
gem.summary = "Log signin and signout events to Keen IO."
|
21
|
+
gem.description = "Publish an event to your Keen IO project every time a user signs in or out. Allows for customizing the collection name."
|
22
22
|
gem.email = "alex@keen.io"
|
23
23
|
gem.authors = ["Alex Kleissner"]
|
24
24
|
# dependencies defined in Gemfile
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/devise_keen.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: devise_keen 0.
|
5
|
+
# stub: devise_keen 0.2.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "devise_keen"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.2.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Alex Kleissner"]
|
14
14
|
s.date = "2014-09-16"
|
15
|
-
s.description = "Publish an event to your Keen IO project every time a user
|
15
|
+
s.description = "Publish an event to your Keen IO project every time a user signs in or out. Allows for customizing the collection name."
|
16
16
|
s.email = "alex@keen.io"
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
@@ -34,14 +34,12 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/devise_keen/hooks/signout.rb",
|
35
35
|
"lib/devise_keen/model.rb",
|
36
36
|
"lib/devise_keen/rails.rb",
|
37
|
-
"lib/devise_keen/version.rb"
|
38
|
-
"test/helper.rb",
|
39
|
-
"test/test_devise_keen.rb"
|
37
|
+
"lib/devise_keen/version.rb"
|
40
38
|
]
|
41
|
-
s.homepage = "
|
39
|
+
s.homepage = "https://github.com/keenlabs/devise_keen"
|
42
40
|
s.licenses = ["MIT"]
|
43
41
|
s.rubygems_version = "2.2.2"
|
44
|
-
s.summary = "
|
42
|
+
s.summary = "Log signin and signout events to Keen IO."
|
45
43
|
|
46
44
|
if s.respond_to? :specification_version then
|
47
45
|
s.specification_version = 4
|
data/lib/devise_keen.rb
CHANGED
@@ -24,9 +24,9 @@ module Devise
|
|
24
24
|
# Public: The name of the collection to use when recording events.
|
25
25
|
# Set keen_collection in the Devise configuration file (config/initializers/devise.rb)
|
26
26
|
#
|
27
|
-
# Devise.
|
28
|
-
mattr_accessor :
|
29
|
-
@@
|
27
|
+
# Devise.keen_collection_prefix = "devise-keen"
|
28
|
+
mattr_accessor :keen_collection_prefix
|
29
|
+
@@keen_collection_prefix = "devise-keen"
|
30
30
|
end
|
31
31
|
|
32
32
|
module KeenTrackable
|
data/lib/devise_keen/model.rb
CHANGED
@@ -5,7 +5,7 @@ module Devise
|
|
5
5
|
module Models
|
6
6
|
module KeenTrackable
|
7
7
|
def keen_record_signin
|
8
|
-
self.publish_action("signin", {sign_in_time:
|
8
|
+
self.publish_action("signin", {sign_in_time: Time.now.iso8601})
|
9
9
|
end
|
10
10
|
|
11
11
|
def keen_record_signout
|
@@ -13,9 +13,10 @@ module Devise
|
|
13
13
|
end
|
14
14
|
|
15
15
|
protected
|
16
|
-
def publish_action(
|
16
|
+
def publish_action(collection, params)
|
17
17
|
raise new Exception("Must define keen_project_id.") if self.class.keen_project_id.nil?
|
18
18
|
raise new Exception("Must define keen_write_key.") if self.class.keen_write_key.nil?
|
19
|
+
collection_name = "#{self.class.keen_collection_prefix}-#{collection}"
|
19
20
|
|
20
21
|
keen = Keen::Client.new(project_id: self.class.keen_project_id,
|
21
22
|
write_key: self.class.keen_write_key)
|
@@ -24,18 +25,17 @@ module Devise
|
|
24
25
|
user: {
|
25
26
|
id: self.id,
|
26
27
|
email: self.email
|
27
|
-
}
|
28
|
-
action: "#{action}"
|
28
|
+
}
|
29
29
|
}
|
30
30
|
|
31
31
|
event_params.merge!(params)
|
32
32
|
|
33
|
-
keen.publish(
|
33
|
+
keen.publish(collection_name, event_params)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
Devise::Models.config(self, :keen_project_id)
|
38
38
|
Devise::Models.config(self, :keen_write_key)
|
39
|
-
Devise::Models.config(self, :
|
39
|
+
Devise::Models.config(self, :keen_collection_prefix)
|
40
40
|
end
|
41
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_keen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Kleissner
|
@@ -136,8 +136,8 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description: Publish an event to your Keen IO project every time a user
|
140
|
-
for customizing the collection name.
|
139
|
+
description: Publish an event to your Keen IO project every time a user signs in or
|
140
|
+
out. Allows for customizing the collection name.
|
141
141
|
email: alex@keen.io
|
142
142
|
executables: []
|
143
143
|
extensions: []
|
@@ -161,9 +161,7 @@ files:
|
|
161
161
|
- lib/devise_keen/model.rb
|
162
162
|
- lib/devise_keen/rails.rb
|
163
163
|
- lib/devise_keen/version.rb
|
164
|
-
|
165
|
-
- test/test_devise_keen.rb
|
166
|
-
homepage: http://github.com/alex@keen.io/devise_keen
|
164
|
+
homepage: https://github.com/keenlabs/devise_keen
|
167
165
|
licenses:
|
168
166
|
- MIT
|
169
167
|
metadata: {}
|
@@ -186,5 +184,5 @@ rubyforge_project:
|
|
186
184
|
rubygems_version: 2.2.2
|
187
185
|
signing_key:
|
188
186
|
specification_version: 4
|
189
|
-
summary:
|
187
|
+
summary: Log signin and signout events to Keen IO.
|
190
188
|
test_files: []
|
data/test/helper.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
|
3
|
-
module SimpleCov::Configuration
|
4
|
-
def clean_filters
|
5
|
-
@filters = []
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
SimpleCov.configure do
|
10
|
-
clean_filters
|
11
|
-
load_adapter 'test_frameworks'
|
12
|
-
end
|
13
|
-
|
14
|
-
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
-
add_filter "/.rvm/"
|
16
|
-
end
|
17
|
-
require 'rubygems'
|
18
|
-
require 'bundler'
|
19
|
-
begin
|
20
|
-
Bundler.setup(:default, :development)
|
21
|
-
rescue Bundler::BundlerError => e
|
22
|
-
$stderr.puts e.message
|
23
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
24
|
-
exit e.status_code
|
25
|
-
end
|
26
|
-
require 'test/unit'
|
27
|
-
require 'shoulda'
|
28
|
-
|
29
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
30
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
31
|
-
require 'devise_keen'
|
32
|
-
|
33
|
-
class Test::Unit::TestCase
|
34
|
-
end
|
data/test/test_devise_keen.rb
DELETED