{"repo":"hanami/hanami-action","free":true,"listed":false,"github":"https://github.com/hanami/hanami-action","clone":"git clone https://github.com/hanami/hanami-action.git","description":"Complete, fast and testable actions for Rack and Hanami","language":"Ruby","stars":243,"topics":["hanami","ruby","rack","api","http","controller"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"[actions]: https://github.com/hanami/hanami-action/actions [chat]: https://discord.gg/naQApPAsZB [forum]: https://discourse.hanamirb.org [rubygem]: https://rubygems.org/gems/hanami-action Hanami Action [ ][rubygem] [ ][actions] [ ][forum] [ ][chat] [!NOTE] Hanami Controller has been renamed to Hanami Action. Installation Add this line to your application's Gemfile: And then execute: Or install it yourself as: Usage Hanami Action is a micro library for web frameworks. It works beautifully with Hanami Router, but it can be employed everywhere. It's designed to be fast and testable. Actions The core of this framework are the actions. They are the endpoints that respond to incoming HTTP requests. Hanami::Action follows the Hanami philosophy: a single purpose object with a minimal interface. In this case, Hanami::Action provides the key public interface of #call(env) , making your actions Rack-compatible. To provide custom behaviour when your actions are being called, you can implement #handle(request, response) An action is an object and you have full control over it . In other words, you have the freedom to instantiate, inject dependencies and test it, both at the unit and integration level. In the example below, the default repository is ArticleRepository . During a unit test we can inject a stubbed version, and invoke #call with the params. We're avoiding HTTP calls , we're also going to avoid hitting the database (it depends on the stubbed repository), we're just dealing with","default_branch":null,"files":null,"tree":[],"storefront":"/r/hanami","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/hanami/hanami-action/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}