{"id":14969800,"url":"https://github.com/esbanarango/zapier-rest-hooks","last_synced_at":"2025-09-22T10:31:54.509Z","repository":{"id":10855219,"uuid":"60993648","full_name":"esbanarango/zapier-REST-hooks","owner":"esbanarango","description":"Rails engine that provides all the functionality/structure for Zapier REST hooks pattern.","archived":false,"fork":false,"pushed_at":"2023-03-08T19:48:18.000Z","size":120,"stargazers_count":23,"open_issues_count":15,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-02T09:22:04.650Z","etag":null,"topics":["gem","rails","zapier","zapier-rest-hooks"],"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/esbanarango.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-12T23:07:50.000Z","updated_at":"2023-09-04T17:34:39.000Z","dependencies_parsed_at":"2024-09-23T05:41:00.563Z","dependency_job_id":null,"html_url":"https://github.com/esbanarango/zapier-REST-hooks","commit_stats":{"total_commits":57,"total_committers":5,"mean_commits":11.4,"dds":0.1578947368421053,"last_synced_commit":"6ce382fcf49ffd374c5cd69981af95520809f2bd"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esbanarango%2Fzapier-REST-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esbanarango%2Fzapier-REST-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esbanarango%2Fzapier-REST-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esbanarango%2Fzapier-REST-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esbanarango","download_url":"https://codeload.github.com/esbanarango/zapier-REST-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233841626,"owners_count":18738651,"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":["gem","rails","zapier","zapier-rest-hooks"],"created_at":"2024-09-24T13:42:24.587Z","updated_at":"2025-09-22T10:31:54.163Z","avatar_url":"https://github.com/esbanarango.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZapierRestHooks\n[![Gem Version](https://badge.fury.io/rb/zapier_rest_hooks.svg)](https://badge.fury.io/rb/zapier_rest_hooks) [![Build Status](https://travis-ci.org/esbanarango/zapier-REST-hooks.svg?branch=master)](https://travis-ci.org/esbanarango/zapier-REST-hooks) [![Code Climate](https://codeclimate.com/github/esbanarango/zapier-REST-hooks/badges/gpa.svg)](https://codeclimate.com/github/esbanarango/zapier-REST-hooks) [![Test Coverage](https://codeclimate.com/github/esbanarango/zapier-REST-hooks/badges/coverage.svg)](https://codeclimate.com/github/esbanarango/zapier-REST-hooks/coverage)\n\nRails engine that provides functionality for [Zapier REST hooks pattern](https://zapier.com/developer/documentation/v2/rest-hooks/).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'zapier_rest_hooks'\n```\n\nAfter you've added _ZapierRestHooks_ to your gemfile, you can install it with:\n\n````bash\nrails generate zapier_rest_hooks:install\n````\n\nThe generator will mount ZapierRestHooks in your config/routes.rb at the path `/hooks`.\n\nNow run `rake db:migrate`\n\n## Usage\n\nBy adding __ZapierRestHooks__ engine to your Rails app, you will have access to [ZapierRestHooks::Hook](https://github.com/esbanarango/zapier-REST-hooks/blob/master/app/models/zapier_rest_hooks/hook.rb) model. This model maps the Hook object described on [Zapier REST Hooks pattern](https://zapier.com/developer/documentation/v2/rest-hooks/#rest-hooks).\n\nHere's an example on how you can integrate _hooks_ into your existing models.\n\n###### Note:\nThis is simple example, in real life you should wrap `ZapierRestHooks::Hook.trigger` inside a Job.\n\nA hook can be scoped to an owner. By default it's _nil_ but you can specify it if you need it.\n\n````ruby\nclass Candidate \u003c ActiveRecord::Base\n  # Relations\n  belongs_to :organization\n\n  # Callbacks\n  after_create :trigger_hooks_with_owner, if: :organization\n  after_create :trigger_hooks_without_owner, unless: :organization\n\n  private\n\n  def trigger_hooks_with_owner\n    return unless ZapierRestHooks::Hook.hooks_exist?('new_candidate', organization)\n    # Scoped event.\n    ZapierRestHooks::Hook.trigger('new_candidate', self.to_json, organization)\n  end\n\n  def trigger_hooks_without_owner\n    return unless ZapierRestHooks::Hook.hooks_exist?('new_candidate')\n    # Global event.\n    ZapierRestHooks::Hook.trigger('new_candidate', self.to_json)\n  end\nend\n````\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/esbanarango/zapier-REST-hooks. 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\n\n## Author\n\nThis was written by [Esteban Arango Medina](http://esbanarango.com), based on [Ryan Alyn Porter](https://github.com/endymion) initial solution.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesbanarango%2Fzapier-rest-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesbanarango%2Fzapier-rest-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesbanarango%2Fzapier-rest-hooks/lists"}