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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5a5350b71d83ea8157ad7d9dea7ad8650eb98db
4
- data.tar.gz: cefb142c9d5451ba7afd7a964d9655e7b919153c
3
+ metadata.gz: 54cff924e8fb693f8295f90760fb855d4ed82e25
4
+ data.tar.gz: f1d0af1d6a8bd2a27bd99f1f3a5dd4f7c6db3414
5
5
  SHA512:
6
- metadata.gz: dda8de588f2e66ae52f20edc0d668ba8694d0fd294fd91320ae03f79df031270c82027ba405262b25ab56344579eb92fb5efa0e673c1d55a2e9fd63138672426
7
- data.tar.gz: 6c3b2783c6fa3eeca9949f45d31b5c6872c0fac844234e22ca2dd2b9aae22d574a31af9cbef34801e7887fd438517123e62a00de65191a56d0ae865630a954db
6
+ metadata.gz: ec65ac44f2c374fbd0fa4eafa83094338f30cd78aa27cd378857d0e5dab5c152158b311fccc4faea94b025fe25972a6bd389355b206404899eedc160b4b2b10c
7
+ data.tar.gz: d2ca2bf6eefc41120a65517eed20de0a9288d945a76c479b7f583cd02a3da86d0fa140d3712d26eb2c73f5d92dc11f78ce7fe4f606a723dbd64e99c41477e63a
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Weasel
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/weasel`. To experiment with that code, run `bin/console` for an interactive prompt.
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 user.present?
10
+ return unless actor.present?
11
11
 
12
- Weasel::EventsWorker.perform_async(user.id, thin_request)
12
+ Weasel::EventsWorker.perform_async(actor.class.name, actor.id, request_data)
13
13
  end
14
14
 
15
15
  private
16
16
 
17
- def user
18
- if defined?(current_user)
19
- current_user
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 thin_request
22
+ def request_data
26
23
  parameters = request.params
27
24
 
28
25
  rails_action = "#{parameters[:controller]}:#{parameters[:action]}"
@@ -1,3 +1,3 @@
1
1
  module Weasel
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -2,11 +2,11 @@ module Weasel
2
2
  class EventsWorker
3
3
  include Sidekiq::Worker
4
4
 
5
- def perform(user_id, request_hash)
6
- return if user_id.nil? || request_hash.empty?
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 = User.find(user_id)
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.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-04-26 00:00:00.000000000 Z
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.4.8
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: