Project

webhook

0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Execute webhook callbacks easily
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9
~> 2.9
~> 2.0
 Project Readme

Webhook

Code Climate Build Status

Client library for making webhook calls. Compatible with Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.0, 2.2.0, REE, JRuby 1.8 and 1.9.

There are no runtime dependencies.

Installation

Add this line to your application's Gemfile:

gem 'webhook', '~> 1.0.0'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install webhook

Usage

require 'webhook'

code, message, body = Webhook.post('http://requestb.in/yadzsfya', :name => 'Abletech', :age => '6')

if code == '200'
  puts "Success: #{body}"
else
  puts "Error (#{code}): {message}\n#{body}"
end

Basic Authentication

If your webhook endpoint requires HTTP basic authentication, you can embed these in the supplied URL. For example:

Webhook.post('http://myusername:mypassword@requestb.in/jdhdyfhd')

Configuration

You can configure your webhook using the following block. If you are using Rails, you would normally add this code block in config/initializers/webhook.rb

Webhook.configure do |config|
  config.user_agent = "My Application"
end

Testing

rake spec

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request