class Github::Repos::PubSubHubbub

Constants

OPTIONS

Public Instance Methods

subscribe(*args) click to toggle source

Subscribe to existing topic/event through pubsubhubbub

Parameters

  • topic - Required string - The URI of the GitHub repository to subscribe to. The path must be in the format of /:user/:repo/events/:event.

  • callback - Required string - The URI to receive the updates to the topic.

Examples

github = Github.new :oauth_token => '...'
github.repos.pubsubhubbub.subscribe
  'https://github.com/:user/:repo/events/push',
  'github://Email?address=peter-murach@gmail.com',
  :verify => 'sync',
  :secret => '...'
# File lib/github_api/repos/pub_sub_hubbub.rb, line 24
def subscribe(*args)
  params = arguments(args, :required => [:topic, :callback]).params
  _merge_action!("subscribe", topic, callback, params)
  params['options'] = OPTIONS

  post_request("/hub", params)
end
subscribe_repo(*args)
Alias for: subscribe_service
subscribe_repository(*args)
Alias for: subscribe_service
subscribe_service(*args) click to toggle source

Subscribe repository to service hook through pubsubhubbub

Parameters

  • repo-name - Required string,

  • service-name - Required string

  • :event - Required hash key for the type of event. The default event is push

Examples

github = Github.new :oauth_token => '...'
github.repos.pubsubhubbub.subscribe_service 'user-name', 'repo-name', 'campfire',
  :subdomain => 'github',
  :room => 'Commits',
  :token => 'abc123',
  :event => 'watch'
# File lib/github_api/repos/pub_sub_hubbub.rb, line 69
def subscribe_service(*args)
  params   = arguments(args, :required => [:user, :repo, :service]).params
  event    = params.delete('event') || 'push'
  topic    = "#{site}/#{user}/#{repo}/events/#{event}"
  callback = "github://#{service}?#{params.serialize}"

  subscribe(topic, callback)
end
unsubscribe(*args) click to toggle source

Unsubscribe from existing topic/event through pubsubhubbub

Parameters

  • topic - Required string - The URI of the GitHub repository to unsubscribe from. The path must be in the format of /:user/:repo/events/:event.

  • callback - Required string - The URI to unsubscribe the topic from.

Examples

github = Github.new :oauth_token => '...'
github.repos.pubsubhubbub.unsubscribe
  'https://github.com/:user/:repo/events/push',
  'github://Email?address=peter-murach@gmail.com',
  :verify => 'sync',
  :secret => '...'
# File lib/github_api/repos/pub_sub_hubbub.rb, line 46
def unsubscribe(*args)
  params = arguments(args, :required => [:topic, :callback]).params
  _merge_action!("unsubscribe", topic, callback, params)
  params['options'] = OPTIONS

  post_request("/hub", params)
end
unsubscribe_repo(*args)
Alias for: unsubscribe_service
unsubscribe_repository(*args)
Alias for: unsubscribe_service
unsubscribe_service(*args) click to toggle source

Subscribe repository to service hook through pubsubhubbub

Parameters

  • repo-name - Required string,

  • service-name - Required string

  • :event - Optional hash key for the type of event. The default event is push

Examples

github = Github.new :oauth_token => '...'
github.repos.pubsubhubbub.unsubscribe_service 'user-name', 'repo-name', 'campfire'
# File lib/github_api/repos/pub_sub_hubbub.rb, line 91
def unsubscribe_service(*args)
  params   = arguments(args, :required => [:user, :repo, :service]).params
  event    = params.delete('event') || 'push'
  topic    = "#{site}/#{user}/#{repo}/events/#{event}"
  callback = "github://#{service}"

  unsubscribe(topic, callback)
end