entity_events 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e0b7c68e15961317833572b8d7a89052a333e67f
4
+ data.tar.gz: fbcaef6d049367c14133c3f32d9e56c1dea2c3d9
5
+ SHA512:
6
+ metadata.gz: 02e6cad9a181fd97885079a3b77976ab8339ca9ea321ce5696668d770897f94de3a66cf84506a3def7cd1714adba0256f81785ecb5e921c22a441d9e38ab2b45
7
+ data.tar.gz: 8c8be966b40416101de3042ee95744ab4ef8f57e9db62c8928cc68714004ca7847b5753fe665d57741e53ff91c6cdc0abede19be69276c143ddf0376f9622733
data/README.rdoc CHANGED
@@ -4,9 +4,9 @@ ABOUT
4
4
 
5
5
  Entity Events is a meta data collection tool which uses the MIT licence, written by Josh Dean on Chalkle.com time.
6
6
 
7
- In a nut shell, it records whenever one entity interacts with another entity.
7
+ In a nutshell, it records whenever one entity interacts with another entity.
8
8
 
9
- Some have criticized Entity Events as doing the work of a third party metrics service, which to some extent is valid. However I enjoy the flexibility and ownership of recording this myself.
9
+ Some have criticized Entity Events as doing the work of a third party metrics service, which to some extent is valid. However I enjoy the flexibility, extensibility, and ownership of recording this myself.
10
10
 
11
11
  It is my long term goal to make a gem which will provide basic query functions for the data Entity Events records.
12
12
 
@@ -14,7 +14,54 @@ The design pattern was inspired by Pundit.
14
14
 
15
15
  This is the first gem I've written so beware if might be a little gnarly and please do contribute if you like the concept but feel you could do some things better.
16
16
 
17
- IMPLEMENTATION
18
17
 
19
- gemfile
20
- http://rubygems.org/entity_events
18
+ DESCRIPTION OF FUNCTIONS
19
+ Whenever a request is made an Interaction record is written to the database. An Interaction describes an 'actor' making an 'action' on a 'target'. This is usually the current_user, the controller action which the request is routed to, and the target the object the request is related to.
20
+
21
+ i.e. { actor: User, action: Views, target: Post }
22
+
23
+ Additionally, all the requests params are stored in that interaction, as well as the controller and action names (for querying purposes), and also an option params[:flag] which I added so I could record which href a user used to get there
24
+
25
+
26
+ BASIC IMPLEMENTATION
27
+
28
+ 1. Add to gemfile then bundle install
29
+
30
+ ===ruby
31
+ gem 'entity_events'
32
+ ===
33
+
34
+ 2. create and run a new migration
35
+
36
+ ===ruby
37
+ class CreateInteraction < ActiveRecord::Migration
38
+ def change
39
+ create_table :interactions do |t|
40
+ t.string :action
41
+ t.string :controller
42
+ t.string :flag
43
+ t.text :parameters
44
+ t.references :actor, polymorphic: true
45
+ t.references :target, polymorphic: true
46
+ t.timestamps
47
+ end
48
+ end
49
+ end
50
+ ===
51
+
52
+ 3. On application_controller.rbgit
53
+
54
+ ===ruby
55
+ before_filter :entity_events
56
+
57
+ def entity_events
58
+ auto_log = true
59
+ EntityEvents.record(params, current_user, auto_log)
60
+ end
61
+ ===
62
+
63
+
64
+ CUSTOMIZATION
65
+
66
+ The bool auto_log in application_controller.entity_events should be set to true
67
+ Under /app/events/ create
@@ -1,3 +1,3 @@
1
1
  module EntityEvents
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entity_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Josh Dean
@@ -14,7 +13,6 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,17 +27,15 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: sqlite3
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: In a nut shell, it records whenever one entity interacts with another
@@ -51,19 +46,22 @@ executables: []
51
46
  extensions: []
52
47
  extra_rdoc_files: []
53
48
  files:
49
+ - MIT-LICENSE
50
+ - README.rdoc
51
+ - Rakefile
52
+ - lib/entity_events.rb
54
53
  - lib/entity_events/event_finder.rb
55
54
  - lib/entity_events/interaction.rb
56
55
  - lib/entity_events/version.rb
57
- - lib/entity_events.rb
58
56
  - lib/tasks/entity_events_tasks.rake
59
- - MIT-LICENSE
60
- - Rakefile
61
- - README.rdoc
57
+ - test/dummy/README.rdoc
58
+ - test/dummy/Rakefile
62
59
  - test/dummy/app/assets/javascripts/application.js
63
60
  - test/dummy/app/assets/stylesheets/application.css
64
61
  - test/dummy/app/controllers/application_controller.rb
65
62
  - test/dummy/app/helpers/application_helper.rb
66
63
  - test/dummy/app/views/layouts/application.html.erb
64
+ - test/dummy/config.ru
67
65
  - test/dummy/config/application.rb
68
66
  - test/dummy/config/boot.rb
69
67
  - test/dummy/config/database.yml
@@ -79,7 +77,6 @@ files:
79
77
  - test/dummy/config/initializers/wrap_parameters.rb
80
78
  - test/dummy/config/locales/en.yml
81
79
  - test/dummy/config/routes.rb
82
- - test/dummy/config.ru
83
80
  - test/dummy/db/development.sqlite3
84
81
  - test/dummy/db/migrate/20141124235638_create_interaction.rb
85
82
  - test/dummy/db/schema.rb
@@ -88,35 +85,32 @@ files:
88
85
  - test/dummy/public/422.html
89
86
  - test/dummy/public/500.html
90
87
  - test/dummy/public/favicon.ico
91
- - test/dummy/Rakefile
92
- - test/dummy/README.rdoc
93
88
  - test/dummy/script/rails
94
89
  - test/entity_events_test.rb
95
90
  - test/test_helper.rb
96
91
  homepage: http://rubygems.org/gems/entity_events
97
92
  licenses:
98
93
  - MIT
94
+ metadata: {}
99
95
  post_install_message:
100
96
  rdoc_options: []
101
97
  require_paths:
102
98
  - lib
103
99
  required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
100
  requirements:
106
- - - ! '>='
101
+ - - '>='
107
102
  - !ruby/object:Gem::Version
108
103
  version: '0'
109
104
  required_rubygems_version: !ruby/object:Gem::Requirement
110
- none: false
111
105
  requirements:
112
- - - ! '>='
106
+ - - '>='
113
107
  - !ruby/object:Gem::Version
114
108
  version: '0'
115
109
  requirements: []
116
110
  rubyforge_project:
117
- rubygems_version: 1.8.23.2
111
+ rubygems_version: 2.3.0
118
112
  signing_key:
119
- specification_version: 3
113
+ specification_version: 4
120
114
  summary: Entity Events is a meta data collection tool
121
115
  test_files:
122
116
  - test/dummy/app/assets/javascripts/application.js