{"id":13878366,"url":"https://github.com/nejdetkadir/followability","last_synced_at":"2025-04-13T18:41:30.174Z","repository":{"id":61436361,"uuid":"551578452","full_name":"nejdetkadir/followability","owner":"nejdetkadir","description":"Implements the social network followable functionality for your Active Record models","archived":false,"fork":false,"pushed_at":"2022-11-30T12:07:52.000Z","size":148,"stargazers_count":62,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T19:03:17.340Z","etag":null,"topics":["follow","following","following-a-tutorial","rails-gem","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"","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/nejdetkadir.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-14T17:11:12.000Z","updated_at":"2024-09-17T06:50:59.000Z","dependencies_parsed_at":"2022-10-17T17:51:21.480Z","dependency_job_id":null,"html_url":"https://github.com/nejdetkadir/followability","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nejdetkadir%2Ffollowability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nejdetkadir%2Ffollowability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nejdetkadir%2Ffollowability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nejdetkadir%2Ffollowability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nejdetkadir","download_url":"https://codeload.github.com/nejdetkadir/followability/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248764376,"owners_count":21158074,"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":["follow","following","following-a-tutorial","rails-gem","ruby","ruby-gem"],"created_at":"2024-08-06T08:01:47.473Z","updated_at":"2025-04-13T18:41:30.151Z","avatar_url":"https://github.com/nejdetkadir.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"[![Gem Version](https://badge.fury.io/rb/followability.svg)](https://badge.fury.io/rb/followability)\n![test](https://github.com/nejdetkadir/followability/actions/workflows/test.yml/badge.svg?branch=main)\n![rubocop](https://github.com/nejdetkadir/followability/actions/workflows/rubocop.yml/badge.svg?branch=main)\n[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)\n![Ruby Version](https://img.shields.io/badge/ruby_version-\u003e=_2.7.0-blue.svg)\n\n# Followability\nImplements the social network followable functionality for your Active Record models\n\n## Installation\n```ruby\ngem 'followability', github: 'nejdetkadir/followability', branch: 'main'\n```\n\nInstall the gem and add to the application's Gemfile by executing:\n```bash\n$ bundle add followability\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n```bash\n$ gem install followability\n```\n\nRun the generator for creating database migration and copying localization files.\n```bash\n$ rails g followability:install\n```\n\n## Usage\nSimply drop in `followability` to a model:\n\n```ruby\nclass User \u003c ActiveRecord::Base\n  followability\nend\n```\n\nNow, instances of `User` have followability.\n```ruby\nUser.followability?\n# =\u003e true\n```\n\n### Following actions\nAvaiable methods:\n- decline_follow_request_of\n- remove_follow_request_for\n- send_follow_request_to\n- unfollow\n- following?\n- mutual_following_with?\n- sent_follow_request_to?\n\n### Usage\n```ruby\n@foo = User.first\n@bar = User.last\n\n@foo.send_follow_request_to(@bar)\n# =\u003e true\n\n@foo.sent_follow_request_to?(@bar)\n# =\u003e true\n\n@bar.decline_follow_request_of(@foo)\n# =\u003e true\n\n@bar.accept_follow_request_of(@foo)\n# =\u003e false\n\n@bar.errors.full_messages\n# =\u003e [...]\n\n@bar.unfollow(@foo)\n# =\u003e false\n\n@bar.errors.full_messages\n# =\u003e [...]\n\n@foo.remove_follow_request_for(@bar)\n# =\u003e false\n\n@foo.errors.full_messages\n# =\u003e [...]\n\n@foo.mutual_following_with?(@bar)\n# =\u003e false\n\n@bar.following?(@foo)\n# =\u003e false\n```\n\n### Blocking actions\nAvaiable methods:\n- block\n- unblock\n- blocked?\n- blocked_by?\n\n### Usage\n```ruby\n@foo.block(@bar)\n# =\u003e true\n\n@foo.blocked?(@bar)\n# =\u003e true\n\n@bar.blocked_by?(@foo)\n# =\u003e true\n\n@foo.unblock(@bar)\n# =\u003e true\n```\n\n### Common\nAvaiable methods:\n- myself?\n\n### Usage\n```ruby\nclass User \u003c ActiveRecord::Base\n  followability\n  \n  def follow_request_removed_by_someone(record)\n    unless myself?(record)\n      # Do something\n    end\n  end\nend\n```\n\n### Relations\nAvaiable methods:\n- follow_requests\n- pending_requests\n- followerable_relationships\n- followable_relationships\n- followers\n- following\n- blocks\n- blockers\n\n### Usage\n```ruby\n@foo.follow_requests\n# =\u003e [#\u003cFollowability::Relationship ...\u003e]\n\n@foo.pending_requests\n# =\u003e [#\u003cFollowability::Relationship ...\u003e]\n\n@foo.followerable_relationships\n# =\u003e [#\u003cFollowability::Relationship ...\u003e]\n\n@foo.followable_relationships\n# =\u003e [#\u003cFollowability::Relationship ...\u003e]\n\n@foo.followers\n# =\u003e [#\u003cUser ...\u003e]\n\n@foo.following\n# =\u003e [#\u003cUser ...\u003e]\n\n@foo.blocks\n# =\u003e [#\u003cUser ...\u003e]\n\n@foo.blockers\n# =\u003e [#\u003cUser ...\u003e]\n```\n\n### Callback Methods\nAvailable methods:\n- follow_request_sent_to_me\n- follow_request_sent_to_someone\n- follow_request_accepted_by_me\n- follow_request_accepted_by_someone\n- follow_request_declined_by_me\n- follow_request_declined_by_someone\n- follow_request_removed_by_me\n- follow_request_removed_by_someone\n- followable_blocked_by_me\n- followable_blocked_by_someone\n- followable_unblocked_by_me\n- followable_unblocked_by_someone\n- unfollowed_by_me\n- unfollowed_by_someone\n- followability_triggered\n\n### Usage\n```ruby\nclass User \u003c ActiveRecord::Base\n  followability\n\n  def follow_request_sent_to_me(record)\n    Notifications::FollowRequestSentToMeJob.perform_later(from_id: record.id)\n  end\n\n  def follow_request_sent_to_someone(record); end\n  def follow_request_accepted_by_me(record); end\n  def follow_request_accepted_by_someone(record); end\n  def follow_request_declined_by_me(record); end\n  def follow_request_declined_by_someone(record); end\n  def follow_request_removed_by_me(record); end\n  def follow_request_removed_by_someone(record); end\n  def followable_blocked_by_me(record); end\n  def followable_blocked_by_someone(record); end\n  def followable_unblocked_by_me(record); end\n  def followable_unblocked_by_someone(record); end\n  def unfollowed_by_me(record); end\n\n  def unfollowed_by_someone(record)\n    Followability::RemoveFollowedUserJob.perform_later(user_id: record.id)\n  end\n\n  def followability_triggered(record, callback_name); end\nend\n```\n\n## I18n\n```yml\n---\nen:\n  followability:\n    errors:\n      block:\n        unblock:\n          myself: 'You can not run this action for yourself'\n        block:\n          myself: 'You can not run this action for yourself'\n          blocked_by: 'You can not block to who blocked to you'\n          already_blocked: '%{klass} already blocked'\n          not_blocked_for_blocking: 'You can not unblock to %{klass} because was not blocked'\n      follow:\n        unfollow:\n          myself: 'You can not run this action for yourself'\n          empty_relation: 'You can not unfollow to %{klass} because was not followed'\n        decline_follow_request_of:\n          myself: 'You can not run this action for yourself'\n          empty_relation: 'You can not decline follow request of %{klass} because was not sent'\n        accept_follow_request_of:\n          myself: 'You can not run this action for yourself'\n          empty_relation: 'You can not accept follow request of %{klass} because was not sent'\n        remove_follow_request_for:\n          empty_relation: 'You can not remove follow request of %{klass} because was not sent'\n          myself: 'You can not run this action for yourself'\n        send_follow_request_to:\n          myself: 'You can not run this action for yourself'\n          blocked_by: 'You can not send follow request to who blocked to you'\n          following: 'You are already following to %{klass}'\n          already_sent: 'You are already sent follow request'\n          blocked: 'You can not send follow request to blocked %{klass}'\n```\n\n## Mentioned Youtube Video\n![Friend Request And Followers - Followability Gem | Ruby On Rails 7 Tutorial](docs/youtube-video.jpeg)\n\nYou can watch [@Deanout](https://github.com/Deanout)'s [Friend Request And Followers - Followability Gem | Ruby On Rails 7 Tutorial Video](https://www.youtube.com/watch?v=UVa1QPaITQM) on Youtube.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` 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 the created tag, 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/nejdetkadir/followability. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nejdetkadir/followability/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](LICENSE).\n\n## Code of Conduct\n\nEveryone interacting in the Followability project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/nejdetkadir/followability/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnejdetkadir%2Ffollowability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnejdetkadir%2Ffollowability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnejdetkadir%2Ffollowability/lists"}