oid_rails4 0.0.3 → 0.0.4
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 +4 -4
- data/lib/obfuscate_id/version.rb +1 -1
- data/lib/obfuscate_id.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04b887cf3e747782495f1254c452af3aef96b112
|
|
4
|
+
data.tar.gz: 6e043ebec58bd93c9e82da0c0135dba316c98350
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 882e09cc0369d8ef60154585e59cea7b083b1c59a574534ce953be5f542d0eecab6875df99ba6441f01925506140e8c1031273f388e16237003a1eebfab93c48
|
|
7
|
+
data.tar.gz: e5f7238b5dd3603765d3c35bda3e0d8aebe3c3ab718113025b645fd60caf6052e383cd3ff26693a1502c6b2167195088fa27772105796ef4096b92097e126b4c
|
data/lib/obfuscate_id/version.rb
CHANGED
data/lib/obfuscate_id.rb
CHANGED
|
@@ -21,7 +21,7 @@ module ObfuscateId
|
|
|
21
21
|
module ClassMethods
|
|
22
22
|
def find(*args)
|
|
23
23
|
if has_obfuscated_id?
|
|
24
|
-
args[0] =
|
|
24
|
+
args[0] = deobfuscate_id(args[0])
|
|
25
25
|
end
|
|
26
26
|
super(*args)
|
|
27
27
|
end
|
|
@@ -29,6 +29,14 @@ module ObfuscateId
|
|
|
29
29
|
def has_obfuscated_id?
|
|
30
30
|
true
|
|
31
31
|
end
|
|
32
|
+
|
|
33
|
+
def deobfuscate_id(obfuscated_id)
|
|
34
|
+
ObfuscateId.show(obfuscated_id, obfuscate_id_spin) unless obfuscated_id.nil?
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def obfuscate_id(id)
|
|
38
|
+
ObfuscateId.hide(id, obfuscate_id_spin) unless id.nil?
|
|
39
|
+
end
|
|
32
40
|
|
|
33
41
|
# Generate a default spin from the Model name
|
|
34
42
|
# This makes it easy to drop obfuscate_id onto any model
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: oid_rails4
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Perelman
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-09-
|
|
11
|
+
date: 2013-09-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: scatter_swap
|