rasti-app 0.0.7 → 0.0.8
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/rasti/app.rb +8 -6
- data/lib/rasti/app/asynchronic_interaction.rb +2 -2
- data/lib/rasti/app/facade.rb +11 -6
- data/lib/rasti/app/interaction.rb +2 -2
- data/lib/rasti/app/policy.rb +4 -4
- data/lib/rasti/app/version.rb +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: 1a3d68bed67e69a49b6b61e8f0c7058c1f3e4927
|
4
|
+
data.tar.gz: 10e1c6c3e9f64c6616d7987359ea81bfc35bce16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19a7db76e43ece80e16417fc0bffff50d0e50286eed9bf3c4ede22463d041bcdcb4c7a7f7de911b58a332d991a3f690c391c80e2cdb5de366130659a8d4996ec
|
7
|
+
data.tar.gz: 7bc3303502c93460d852747dd9edfeaf514c0a64951d0640dff2f7d5f733473b1c7507c250db7c6589814eb2536cbdd8ed7cba3c149197771e15d0c951f08a87
|
data/lib/rasti/app.rb
CHANGED
@@ -61,17 +61,19 @@ module Rasti
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def call(name, permission, params={})
|
64
|
-
|
65
|
-
|
64
|
+
form = self.class.facade.build_form name, params
|
65
|
+
authorize! permission, form
|
66
|
+
self.class.facade.call name, container, context, form
|
66
67
|
end
|
67
68
|
|
68
69
|
def enqueue(name, permission, params={})
|
69
|
-
|
70
|
-
|
70
|
+
form = self.class.facade.build_form name, params
|
71
|
+
authorize! permission, form
|
72
|
+
self.class.facade.enqueue name, context, form
|
71
73
|
end
|
72
74
|
|
73
|
-
def authorize!(permission,
|
74
|
-
policy.authorize! permission,
|
75
|
+
def authorize!(permission, form)
|
76
|
+
policy.authorize! permission, form
|
75
77
|
end
|
76
78
|
|
77
79
|
end
|
@@ -12,14 +12,14 @@ module Rasti
|
|
12
12
|
@job ||= Asynchronic[context.fetch(:job_id)].job
|
13
13
|
end
|
14
14
|
|
15
|
-
def enqueue(interaction,
|
15
|
+
def enqueue(interaction, form)
|
16
16
|
job.send :async, Job, queue: params.delete(:queue) || Asynchronic.default_queue,
|
17
17
|
alias: params.delete(:alias) || interaction,
|
18
18
|
dependency: params.delete(:dependency),
|
19
19
|
dependencies: params.delete(:dependencies),
|
20
20
|
interaction: interaction,
|
21
21
|
context: context,
|
22
|
-
params:
|
22
|
+
params: form.attributes
|
23
23
|
end
|
24
24
|
|
25
25
|
def result_of(reference)
|
data/lib/rasti/app/facade.rb
CHANGED
@@ -55,8 +55,9 @@ module Rasti
|
|
55
55
|
facade.synchronic_interactions.keys
|
56
56
|
end
|
57
57
|
|
58
|
-
def call_delegated_method(
|
59
|
-
facade.
|
58
|
+
def call_delegated_method(interaction_name, params={})
|
59
|
+
form = facade.build_form interaction_name, params
|
60
|
+
facade.call interaction_name, container, context, form
|
60
61
|
end
|
61
62
|
|
62
63
|
end
|
@@ -71,18 +72,22 @@ module Rasti
|
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
def
|
75
|
-
interaction_class(name).
|
75
|
+
def build_form(name, params={})
|
76
|
+
interaction_class(name).build_form params
|
76
77
|
end
|
77
78
|
|
78
|
-
def
|
79
|
+
def call(name, container, context, form)
|
80
|
+
interaction_class(name).new(container, context).call(form)
|
81
|
+
end
|
82
|
+
|
83
|
+
def enqueue(name, context, form)
|
79
84
|
interaction = interaction_class name
|
80
85
|
|
81
86
|
Job.enqueue queue: params.delete(:queue) || Asynchronic.default_queue,
|
82
87
|
alias: interaction,
|
83
88
|
interaction: interaction,
|
84
89
|
context: context,
|
85
|
-
params:
|
90
|
+
params: form.attributes
|
86
91
|
end
|
87
92
|
|
88
93
|
def synchronic_interactions
|
data/lib/rasti/app/policy.rb
CHANGED
@@ -40,16 +40,16 @@ module Rasti
|
|
40
40
|
@context = context
|
41
41
|
end
|
42
42
|
|
43
|
-
def authorized?(permission,
|
43
|
+
def authorized?(permission, form)
|
44
44
|
if self.class.authorizations.key? permission
|
45
|
-
instance_exec
|
45
|
+
instance_exec form, &self.class.authorizations[permission]
|
46
46
|
else
|
47
47
|
user.authorized? permission
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def authorize!(permission,
|
52
|
-
raise UnauthorizedError.new(user.name, permission) unless authorized? permission,
|
51
|
+
def authorize!(permission, form)
|
52
|
+
raise UnauthorizedError.new(user.name, permission) unless authorized? permission, form
|
53
53
|
end
|
54
54
|
|
55
55
|
private
|
data/lib/rasti/app/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rasti-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inflecto
|