Module: Travis::GithubApi
- Defined in:
- lib/travis/github_api.rb
Defined Under Namespace
Classes: ServiceHookError
Class Method Summary
collapse
Class Method Details
.add_service_hook(owner_name, name, oauth_token, data) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/travis/github_api.rb', line 9
def add_service_hook(owner_name, name, oauth_token, data)
client = Octokit::Client.new(:oauth_token => oauth_token)
client.subscribe_service_hook("#{owner_name}/#{name}", 'Travis', data)
rescue Octokit::UnprocessableEntity => e
raise ServiceHookError, 'error subscribing to the GitHub push event'
rescue Octokit::Unauthorized => e
raise ServiceHookError, 'error authorizing with given GitHub OAuth token'
end
|
.remove_service_hook(owner_name, name, oauth_token) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/travis/github_api.rb', line 19
def remove_service_hook(owner_name, name, oauth_token)
client = Octokit::Client.new(:oauth_token => oauth_token)
client.unsubscribe_service_hook("#{owner_name}/#{name}", 'Travis')
rescue Octokit::UnprocessableEntity => e
raise ServiceHookError, 'error unsubscribing from the GitHub push event'
end
|
.repositories_for_user(login) ⇒ Object
27
28
29
|
# File 'lib/travis/github_api.rb', line 27
def repositories_for_user(login)
Octokit.repositories(login)
end
|