reaction 1.0.5 → 1.0.6
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/reaction/action.rb +8 -3
- data/lib/reaction/has_attributes.rb +2 -1
- data/lib/reaction/param.rb +8 -5
- data/lib/reaction/type.rb +2 -2
- data/lib/reaction/validator.rb +1 -1
- data/reaction.gemspec +1 -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: 99de6fc7804e30ba92cef84cfdab18be9c361954
|
|
4
|
+
data.tar.gz: abbb453e161b81ca074eaafb63f5e4dabec70a39
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd584eb1154eae39bf5c5d0de24a41f909c535a12107711e083f702e53f7b5f20a70830d3872846d6253b2b740a9b7226ebcfce65d0abd47c7286f9c78801a06
|
|
7
|
+
data.tar.gz: 81cdb79f9a8eaa2fe9e0774973b1899bb202852d20ea4f9e39a4b7bbe9ee7fd80ba956fd6490dbc112d0386dc479b15b883635291994f697750de81e66060302
|
data/lib/reaction/action.rb
CHANGED
|
@@ -15,7 +15,8 @@ module Reaction
|
|
|
15
15
|
return false unless validate_attributes
|
|
16
16
|
_params.each do |name, param|
|
|
17
17
|
unless param.process
|
|
18
|
-
failure(param.error)
|
|
18
|
+
failure(param.error)
|
|
19
|
+
return false
|
|
19
20
|
end
|
|
20
21
|
end
|
|
21
22
|
perform
|
|
@@ -23,13 +24,17 @@ module Reaction
|
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def success(result)
|
|
26
|
-
@successful = true
|
|
27
27
|
@result = result
|
|
28
|
+
@successful = true
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
def failure(error)
|
|
31
|
-
@successful = false
|
|
32
32
|
@error = error
|
|
33
|
+
@successful = false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def failed?
|
|
37
|
+
@successful == false
|
|
33
38
|
end
|
|
34
39
|
|
|
35
40
|
# This is how you retrieve a param. Pass in a mode of :raw in
|
|
@@ -56,7 +56,8 @@ CODE
|
|
|
56
56
|
unless send(attribute)
|
|
57
57
|
# This is a server side error - we didn't set a valid attribute
|
|
58
58
|
# for some reason, and attributes are things the server sets.
|
|
59
|
-
failure(AttributeError.new(attribute))
|
|
59
|
+
failure(AttributeError.new(attribute))
|
|
60
|
+
return false
|
|
60
61
|
end
|
|
61
62
|
end
|
|
62
63
|
end
|
data/lib/reaction/param.rb
CHANGED
|
@@ -23,23 +23,26 @@ module Reaction
|
|
|
23
23
|
if type.process(raw_value)
|
|
24
24
|
validators.each do |validator|
|
|
25
25
|
unless validator.process(type.result)
|
|
26
|
-
failure(validator.error)
|
|
26
|
+
failure(validator.error)
|
|
27
|
+
return false
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
else
|
|
30
|
-
failure(type.error)
|
|
31
|
+
failure(type.error)
|
|
32
|
+
return false
|
|
31
33
|
end
|
|
32
|
-
success(type.result)
|
|
34
|
+
success(type.result)
|
|
35
|
+
true
|
|
33
36
|
end
|
|
34
37
|
|
|
35
38
|
def success(result)
|
|
36
|
-
@successful = true
|
|
37
39
|
@result = result
|
|
40
|
+
@successful = true
|
|
38
41
|
end
|
|
39
42
|
|
|
40
43
|
def failure(error)
|
|
41
|
-
@successful = false
|
|
42
44
|
@error = ParamError.new(name, error)
|
|
45
|
+
@successful = false
|
|
43
46
|
end
|
|
44
47
|
|
|
45
48
|
def provided?
|
data/lib/reaction/type.rb
CHANGED
|
@@ -28,8 +28,8 @@ module Reaction
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def success(result)
|
|
31
|
-
@successful = true
|
|
32
31
|
@result = result
|
|
32
|
+
@successful = true
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def failed?
|
|
@@ -37,8 +37,8 @@ module Reaction
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def failure(error)
|
|
40
|
-
@successful = false
|
|
41
40
|
@error = error
|
|
41
|
+
@successful = false
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def validate_with(validator, options, value)
|
data/lib/reaction/validator.rb
CHANGED
data/reaction.gemspec
CHANGED
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |gem|
|
|
6
6
|
gem.name = 'reaction'
|
|
7
|
-
gem.version = '1.0.
|
|
7
|
+
gem.version = '1.0.6'
|
|
8
8
|
gem.authors = ["Jon Calhoun", "Jon Calhoun", "Ryan Jackson"]
|
|
9
9
|
gem.email = ["joncalhoun@gmail.com", "jon@paidlabs.com", "ryan@paidlabs.com"]
|
|
10
10
|
gem.description = 'Reaction makes it easy to build reusable controller actions along with reusable validators and param type converters.'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: reaction
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon Calhoun
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2016-05-
|
|
13
|
+
date: 2016-05-16 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: redcarpet
|