weasel 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -3
- data/lib/weasel/concerns/auditable.rb +6 -9
- data/lib/weasel/version.rb +1 -1
- data/lib/weasel/workers/events_worker.rb +3 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54cff924e8fb693f8295f90760fb855d4ed82e25
|
4
|
+
data.tar.gz: f1d0af1d6a8bd2a27bd99f1f3a5dd4f7c6db3414
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec65ac44f2c374fbd0fa4eafa83094338f30cd78aa27cd378857d0e5dab5c152158b311fccc4faea94b025fe25972a6bd389355b206404899eedc160b4b2b10c
|
7
|
+
data.tar.gz: d2ca2bf6eefc41120a65517eed20de0a9288d945a76c479b7f583cd02a3da86d0fa140d3712d26eb2c73f5d92dc11f78ce7fe4f606a723dbd64e99c41477e63a
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Weasel
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Like [Jimmy Fratianno](https://en.wikipedia.org/wiki/Jimmy_Fratianno), this gem got the nickname "Weasel", from a witness who saw him outrun police. Telling all about **who** is doing **what** from **where** and **when**
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -7,22 +7,19 @@ module Weasel
|
|
7
7
|
def audit
|
8
8
|
yield
|
9
9
|
|
10
|
-
return unless
|
10
|
+
return unless actor.present?
|
11
11
|
|
12
|
-
Weasel::EventsWorker.perform_async(
|
12
|
+
Weasel::EventsWorker.perform_async(actor.class.name, actor.id, request_data)
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def
|
18
|
-
if defined?(current_user)
|
19
|
-
|
20
|
-
elsif defined?(current_admin)
|
21
|
-
current_admin
|
22
|
-
end
|
17
|
+
def actor
|
18
|
+
return current_user if defined?(current_user)
|
19
|
+
return current_admin if defined?(current_admin)
|
23
20
|
end
|
24
21
|
|
25
|
-
def
|
22
|
+
def request_data
|
26
23
|
parameters = request.params
|
27
24
|
|
28
25
|
rails_action = "#{parameters[:controller]}:#{parameters[:action]}"
|
data/lib/weasel/version.rb
CHANGED
@@ -2,11 +2,11 @@ module Weasel
|
|
2
2
|
class EventsWorker
|
3
3
|
include Sidekiq::Worker
|
4
4
|
|
5
|
-
def perform(
|
6
|
-
return if
|
5
|
+
def perform(actor_class, actor_id, request_hash)
|
6
|
+
return if user_class.nil? || actor_id.nil? || request_hash.empty?
|
7
7
|
|
8
8
|
Weasel::Event.create do |object|
|
9
|
-
object.actor =
|
9
|
+
object.actor = actor_class.constantize.find(actor_id)
|
10
10
|
object.action_data = request_hash
|
11
11
|
end
|
12
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weasel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Cavilliotti
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -150,8 +150,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
152
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
153
|
+
rubygems_version: 2.2.3
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Simple Audit gem
|
157
157
|
test_files: []
|
158
|
+
has_rdoc:
|