LoginSignup
1
1

More than 5 years have passed since last update.

Octokit で repo hooks の config.url をとる方法

Last updated at Posted at 2014-01-29

ふつうに hook.config.url で取れそうだが、内部で利用されてる Sawyer が url という名前のアトリビュートを特別扱いするので、

client.hooks("owner/repo_name").each do |hook|
  begin
    p h.config.rels[:self].href
  rescue
    # rels[:self] 常にあるわけではないので undefined method `href' for nil:NilClass (NoMethodError) を握りつぶす必要がある
  end
end

こうしないといけない。

Config section missing for web hooks in GitHub Enterprise · Issue #414 · octokit/octokit.rb
https://github.com/octokit/octokit.rb/issues/414

黒魔術してるのはたぶんこのへん https://github.com/lostisland/sawyer/blob/master/lib/sawyer/link_parsers/simple.rb#L6-L24

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1