Module: Travis::CLI::Gh::GitHub::Hooks

Included in:
Signature
Defined in:
lib/travis/cli/gh/github.rb

Instance Method Summary collapse

Instance Method Details

#hooksObject



67
68
69
70
71
# File 'lib/travis/cli/gh/github.rb', line 67

def hooks
  @hooks ||= gh["/repos/#{repository.slug}/hooks"]
rescue GH::Error
  error "admin access needed for #{repository.slug} in order to access hooks"
end

#travis_hookObject



73
74
75
76
77
# File 'lib/travis/cli/gh/github.rb', line 73

def travis_hook
  @travis_hook ||= hooks.detect { |h| h['name'] == 'travis' }
  error "GitHub hook not found. Project might not be enabled." unless @travis_hook
  @travis_hook
end