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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9eda9f2d7a8e03e47bb7d23a1d6cabbf4293c803
4
- data.tar.gz: bc13378e957a35b7f96a6d91959aceb2c2c4b4f6
3
+ metadata.gz: fc7f5412356183bc4240f10134d66819dbd9a05b
4
+ data.tar.gz: f8ce805c136ce5c269e111134f25833fb8c61a5a
5
5
  SHA512:
6
- metadata.gz: 8e5b4b579054a15876c18fac6f9aa2e943de5239d6d6afb8b20f4125019620f140d6a7345b54920a50f5aee244f5042c0d6bfe96594cceb16e772707bfe0d6e6
7
- data.tar.gz: 5bbff614bca428be4940f99ce1de2f5a67fc8616171fb72f3cc3aba19abe54024305a6c14927b890e20090b0a773b60dd0637f87b1cd716484b67a9b7913d1f2
6
+ metadata.gz: 63d7c304cba528800c94270363be9dfa8cbd238fdd7200b82ab4344fce56390b5e7e3413e28626cd8c1092802062fa346e51831f24c779b8338b87b8e8743b2a
7
+ data.tar.gz: d68799840defcf2cbfab3d284b5aeaf090bb1ff9ad8c9e41f6bc937e24fee6accb9bfe08fc538360017fef1d09ff5bcd0395d36177bb439b073803b491c6d1a7
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Alex Kleissner
1
+ Copyright (c) 2014 Keen IO
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,11 +1,23 @@
1
1
  # devise_keen gem
2
2
 
3
- Track user signin and signouts automatically to your Keen IO project.
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
- * `keen_collection`
18
- The optional collection name to store events in. If not set, will default to `devise-keen`
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.keen_collection = "user-events"
40
+ config.keen_collection_prefix = "user-events"
29
41
  ```
30
42
 
31
43
  ## Contributing to devise_keen
32
44
 
33
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
34
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
35
- * Fork the project.
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 Alex Kleissner. See LICENSE.txt for
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 = "http://github.com/alex@keen.io/devise_keen"
18
+ gem.homepage = "https://github.com/keenlabs/devise_keen"
19
19
  gem.license = "MIT"
20
- gem.summary = "Add basic automatic logging to the Keen IO service when a user logs in."
21
- gem.description = "Publish an event to your Keen IO project every time a user logs in. Allows for customizing the collection name."
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.1
1
+ 0.2.0
@@ -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.1.1 ruby lib
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.1.1"
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 logs in. Allows for customizing the collection name."
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 = "http://github.com/alex@keen.io/devise_keen"
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 = "Add basic automatic logging to the Keen IO service when a user logs in."
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
@@ -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.keen_collection = "devise-keen"
28
- mattr_accessor :keen_collection
29
- @@keen_collection = "devise-keen"
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
@@ -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: self.current_sign_in_at})
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(action, params)
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(self.class.keen_collection, event_params)
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, :keen_collection)
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.1.1
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 logs in. Allows
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
- - test/helper.rb
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: Add basic automatic logging to the Keen IO service when a user logs in.
187
+ summary: Log signin and signout events to Keen IO.
190
188
  test_files: []
@@ -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
@@ -1,4 +0,0 @@
1
- require 'helper'
2
-
3
- class TestDeviseKeen < Test::Unit::TestCase
4
- end