Skip to content

Commit 72f8d9d

Browse files
committed
get by id
1 parent c7b4e08 commit 72f8d9d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

lib/github_api/client/repos/hooks.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ def list(*args)
5252
end
5353
alias :all :list
5454

55+
56+
# List repository hooks by id
57+
#
58+
# @example
59+
# github = Github.new
60+
# github.repos.hooks.list 'user-id'
61+
# github.repos.hooks.list 'user-id' { |hook| ... }
62+
#
63+
# @api public
64+
def list_by_id(*args)
65+
arguments(args, required: [:id])
66+
67+
response = get_request("/repos/#{arguments.id}/hooks", arguments.params)
68+
return response unless block_given?
69+
response.each { |el| yield el }
70+
end
71+
alias :all :list_by_id
72+
5573
# Get a single hook
5674
#
5775
# @example

0 commit comments

Comments
 (0)