{"id":14955481,"url":"https://github.com/mborromeo/wisperable","last_synced_at":"2025-10-24T07:31:05.893Z","repository":{"id":55351360,"uuid":"152155368","full_name":"mborromeo/wisperable","owner":"mborromeo","description":"Configure and Broadcast ActiveModel events via Wisper","archived":true,"fork":false,"pushed_at":"2021-01-05T10:55:34.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-29T14:15:18.946Z","etag":null,"topics":["activemodel","activemodel-events","activerecord","event-broadcasting","event-broadcasts","gem","rails","rails5","rails6","ruby","wisper"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mborromeo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-08T22:35:37.000Z","updated_at":"2024-10-07T19:53:53.000Z","dependencies_parsed_at":"2022-08-14T22:01:15.917Z","dependency_job_id":null,"html_url":"https://github.com/mborromeo/wisperable","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborromeo%2Fwisperable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborromeo%2Fwisperable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborromeo%2Fwisperable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mborromeo%2Fwisperable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mborromeo","download_url":"https://codeload.github.com/mborromeo/wisperable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237932070,"owners_count":19389560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activemodel","activemodel-events","activerecord","event-broadcasting","event-broadcasts","gem","rails","rails5","rails6","ruby","wisper"],"created_at":"2024-09-24T13:11:13.081Z","updated_at":"2025-10-24T07:31:05.212Z","avatar_url":"https://github.com/mborromeo.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wisperable [![Build Status](https://travis-ci.org/mborromeo/wisperable.svg?branch=master)](https://travis-ci.org/mborromeo/wisperable)\n\nGet notified of any ActiveModel events using the [Wisper gem](https://github.com/krisleech/wisper).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'wisperable', '~\u003e 0.2'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install wisperable\n\n## Usage\n\nAdd `import Wisperable::Model` to your models, and configure which events you want to listen for with `wisperable events: [:created, :updated, :destroyed]`\n\nLet's see an example:\n```ruby\nclass Account\n  include Wisperable::Model\n  wisperable events: [:created, :updated, :destroyed]\nend\n```\n\nWhen any create, update or destroy event will happen on an instance of Account, a corresponding `account_created`, `account_updated` or `account_destroyed` will be broadcasted by Wisper.\n\nYou can customize the broadcasting key to be used:\n```ruby\nclass Account\n  include Wisperable::Model\n  wisperable events: [:created, :updated, :destroyed], publish_key: 'user'\nend\n```\n\nIn this key, the broadcast message will be in the form of `user_created`, `user_updated` and `user_destroyed`.\n\n##### Events parameters\n`_created` event broadcasts one parameter with the created object.  \n`_updated` event broadcasts two parameters with the updated object and the changed attributes.  \n`_destroyed` event broadcasts one parameter with a copy of the destroyed model attribute. \n\nPlease see the following example of a PORO (Plain Old Ruby Object) able to intercept Wisperable broadcasts:\n```ruby\nclass AccountNotifier\n  def account_created(account)\n    # account has been created.\n  end\n  \n  def account_updated(account, changes)\n    # account has been updated. \n    # changes contains the changed attributes.\n  end\n  \n  def account_destroyed(account)\n    # account contains a copy of the destroyed Account model.\n  end\nend\n```\n\nPlease see [Wisper](https://github.com/krisleech/wisper) for any other subscribers setup instruction.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/mborromeo/wisperable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\nIf you want to contribute with a pull request please follow these steps:\n  * Fork the project, create a new branch from `master`.\n  * Squash commits which are related.\n  * Write a good enough commit message.\n  * Do not bump the VERSION, but do indicate in the pull request message if the change is not backwards compatible.\n  * Issue a Pull Request\n\nAnd... thanks for any contribution!\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Wisperable project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mborromeo/wisperable/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmborromeo%2Fwisperable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmborromeo%2Fwisperable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmborromeo%2Fwisperable/lists"}