module Hoe::Travis
def travis_edit_hook repo, hook, enable = true
def travis_edit_hook repo, hook, enable = true patch = unless Net::HTTP.const_defined? :Patch then # Ruby 1.8 Class.new Net::HTTPRequest do |c| c.const_set :METHOD, 'PATCH' c.const_set :REQUEST_HAS_BODY, true c.const_set :RESPONSE_HAS_BODY, true end else Net::HTTP::Patch end id = hook['id'] body = { 'name' => hook['name'], 'active' => enable, 'config' => hook['config'] } travis_github_request "/repos/#{repo}/hooks/#{id}", body, patch end