roda-action 0.0.3 → 0.1.0
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/README.md +14 -9
- data/lib/roda/plugins/action.rb +6 -0
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe13a1e82411d9fa8e993940512347f734bf7166
|
|
4
|
+
data.tar.gz: 8e5e19bbef13019484f3b1bb3bfb42720d838577
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22270429c09091d13a10407ff74545bb999c4fa8d802c4de1826997442d5bb50dc70fe7fa08a081f0351fd1734c1092ba648ec195dc08451fec5754739144b75
|
|
7
|
+
data.tar.gz: 404d94426405fbbf1178449e19e1ec97f48d5b7c0033d81dd2225e094afaf65cd46a2e91a29abb2fc33a8d086a63e9af3a3f3b98e8246319542e20d4d00a5a93
|
data/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# roda-action
|
|
1
|
+
# roda-action <a href="https://gitter.im/AMHOL/roda-action" target="_blank"></a>
|
|
2
2
|
|
|
3
3
|
A plugin for Roda to resolve actions from roda-container
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```ruby
|
|
8
|
-
gem 'roda-action', '0.0
|
|
8
|
+
gem 'roda-action', '0.1.0'
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -42,11 +42,11 @@ end
|
|
|
42
42
|
MyApplication.route do |r|
|
|
43
43
|
r.on 'users' do
|
|
44
44
|
r.is do
|
|
45
|
-
r.get(&
|
|
45
|
+
r.get(&action(:users_controller, :index))
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
r.is :id do |id|
|
|
49
|
-
r.get(&
|
|
49
|
+
r.get(&action(:users_controller, :show).bind_arguments(id))
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
end
|
|
@@ -54,6 +54,8 @@ end
|
|
|
54
54
|
|
|
55
55
|
If you wish to have access to the usual Roda application instance methods in your registered controllers, it is recommended that you register the application and resolve it for use in your controllers:
|
|
56
56
|
|
|
57
|
+
NOTE: Be sure to use `.instance` as below, see: https://github.com/AMHOL/roda-container#thread-safety
|
|
58
|
+
|
|
57
59
|
```ruby
|
|
58
60
|
class MyApplication < Roda
|
|
59
61
|
plugin :json
|
|
@@ -91,20 +93,23 @@ MyApplication.register(:users_repository, [
|
|
|
91
93
|
])
|
|
92
94
|
|
|
93
95
|
MyApplication.register(:users_controller) do
|
|
94
|
-
UsersController.new(
|
|
96
|
+
UsersController.new(
|
|
97
|
+
MyApplication.instance.resolve(:app),
|
|
98
|
+
MyApplication.resolve(:users_repository)
|
|
99
|
+
)
|
|
95
100
|
end
|
|
96
101
|
|
|
97
102
|
MyApplication.route do |r|
|
|
98
|
-
|
|
103
|
+
register(:app, self, call: false)
|
|
99
104
|
|
|
100
105
|
r.on 'users' do
|
|
101
106
|
r.is do
|
|
102
|
-
r.get(&
|
|
103
|
-
r.post(&
|
|
107
|
+
r.get(&action(:users_controller, :index))
|
|
108
|
+
r.post(&action(:users_controller, :create))
|
|
104
109
|
end
|
|
105
110
|
|
|
106
111
|
r.is :id do |id|
|
|
107
|
-
r.get(&
|
|
112
|
+
r.get(&action(:users_controller, :show).bind_arguments(id))
|
|
108
113
|
end
|
|
109
114
|
end
|
|
110
115
|
end
|
data/lib/roda/plugins/action.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roda-action
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Holland
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-05-
|
|
11
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: roda-container
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.0
|
|
19
|
+
version: 0.1.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.0
|
|
26
|
+
version: 0.1.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: bundler
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|