File tree Expand file tree Collapse file tree 1 file changed +3
-38
lines changed Expand file tree Collapse file tree 1 file changed +3
-38
lines changed Original file line number Diff line number Diff line change 11# jsonapi-hanami
2- Hanami integration for [ jsonapi-rb] ( https ://github.com/ jsonapi-rb/jsonapi-rb ) .
2+ Hanami integration for [ jsonapi-rb] ( http ://jsonapi-rb.org ) .
33
44## Status
55
@@ -22,44 +22,9 @@ Or install it manually as:
2222$ gem install jsonapi-hanami
2323```
2424
25- ## Usage
25+ ## Usage and documentation
2626
27- ``` ruby
28- module API ::Controllers ::Posts
29- class Create
30- include API ::Action
31- include JSONAPI ::Hanami ::Action
32-
33- deserializable_resource :user , DeserializableCreatePost
34- # or
35- deserializable_resource :user do
36- # ...
37- end
38-
39- params do
40- # ...
41- end
42-
43- def call (params )
44- unless params.valid?
45- self .errors = params.errors
46- return
47- end
48-
49- repo = UserRepository .new
50- user = repo.create(params[:user ])
51-
52- self .data = user
53- self .meta = { foo: ' bar' }
54- self .links = { self: ' foo://bar' }
55- self .jsonapi = { version: ' 1.0' , meta: { foo: ' bar' } }
56- # Also available:
57- # self.included = { posts: [:author, comments: [:author]] }
58- # self.fields = { posts: [:title, :date], users: [:name] }
59- end
60- end
61- end
62- ```
27+ See [ jsonapi-rb.org/guides] ( http://jsonapi-rb.org/guides ) .
6328
6429## License
6530
You can’t perform that action at this time.
0 commit comments