{"id":31211533,"url":"https://github.com/jbox-web/punching_bag","last_synced_at":"2025-09-21T05:30:50.581Z","repository":{"id":308917490,"uuid":"1034493514","full_name":"jbox-web/punching_bag","owner":"jbox-web","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-10T02:17:11.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-10T05:47:53.649Z","etag":null,"topics":[],"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/jbox-web.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-08T13:31:44.000Z","updated_at":"2025-09-10T02:17:15.000Z","dependencies_parsed_at":"2025-08-08T17:50:52.178Z","dependency_job_id":"1b23bb9d-332a-4682-98fa-48596a9fed85","html_url":"https://github.com/jbox-web/punching_bag","commit_stats":null,"previous_names":["jbox-web/punching_bag"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jbox-web/punching_bag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbox-web%2Fpunching_bag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbox-web%2Fpunching_bag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbox-web%2Fpunching_bag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbox-web%2Fpunching_bag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbox-web","download_url":"https://codeload.github.com/jbox-web/punching_bag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbox-web%2Fpunching_bag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276195627,"owners_count":25601152,"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","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-09-21T05:30:48.266Z","updated_at":"2025-09-21T05:30:50.518Z","avatar_url":"https://github.com/jbox-web.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Punching Bag\n\n[![CI](https://github.com/jbox-web/punching_bag/workflows/CI/badge.svg)](https://github.com/jbox-web/punching_bag/actions)\n[![Maintainability](https://qlty.sh/gh/jbox-web/projects/punching_bag/maintainability.svg)](https://qlty.sh/gh/jbox-web/projects/punching_bag)\n\nPunching Bag is a hit tracking plugin for Ruby on Rails that specializes in simple trending.\n\n## Features\n\n* Total hit count\n* Hit counts for the last day, week, month, etc.\n* Simple trending based on most hits in the last day, week, month, etc.\n* Rake task to group old hit records for better performance\n* [ActsAsTaggableOn](https://github.com/mbleigh/acts-as-taggable-on) integration for trending tags/topics support\n* [Voight-Kampff](https://github.com/biola/Voight-Kampff) integration for bot checking\n\n## Requirements\n\n- An existing Rails app\n- Ruby \u003e= 2.3\n\n## Installation\n\n__In your Gemfile add:__\n\n    gem \"punching_bag\"\n\n__In the terminal run:__\n\n    bundle install\n    rails g punching_bag\n    rake db:migrate\n\n__In your model add:__\n\n    acts_as_punchable\n\n## Usage\n\n__Tracking hits in your controller__\n\n    class PostsController \u003c ApplicationController\n      def show\n        @post.punch(request)\n      end\n    end\n\n__Getting a total hit count in your view__\n\n    @post.hits\n\n__Getting a hit count for a time period in your view__\n\n    @post.hits(1.week.ago)\n\n__Getting a list of the five all-time most hit posts__\n\n    Post.most_hit\n\n__Getting a list of the 10 most hit posts for the last 24 hours__\n\n    Post.most_hit(1.day.ago, 10)  # limit is 5 by default, pass nil for no limits\n\n__Sorting posts based on all time hit count__\n\n    Post.sort_by_popularity('DESC')   # DESC by default, can also use ASC\n\n__Getting a hit count on a tag for the last month__\n\n    tag.hits(1.month.ago)\n\n__Getting a list of the 10 most hit tags in the last week__\n\n    ActsAsTaggableOn::Tag.most_hit(1.month.ago, 10)\n\n__Compressing old hit records to improve performance__  \n*The default settings combine records by day if they're older than 7 days, by month if they're older than 1 month and by year if they're older than 1 year*\n\n    rake punching_bag:combine\n\n__Compressing old hit records using custom settings__  \n*This time we'll combine records by day if they're older than 14 days, by month if they're older than 3 months and by year if they're older than 2 years*\n\n    rake punching_bag:combine[14,3,2]\n\n## Notes\n\n* The `punching_bag:combine` rake tasks is not run automatically. You'll have to run it manually or add it as a cron job.\n* The `punching_bag:combine` rake task can take a while depending on how many records need to be combined.\n* Passing the `request` object to the `punch` method is optional but without it requests from bots, crawlers and spiders will be tracked.\n* See the [Voight-Kampff](https://github.com/biola/Voight-Kampff) documentation if you'd like to customize the list of user-agents considered bots.\n* The tag related features will only work if you have [ActsAsTaggableOn](https://github.com/mbleigh/acts-as-taggable-on) installed and enabled on the same models as Punching Bag.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbox-web%2Fpunching_bag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbox-web%2Fpunching_bag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbox-web%2Fpunching_bag/lists"}