Class: Github::Repos::PubSubHubbub
- Defined in:
- lib/github_api/repos/pub_sub_hubbub.rb
Constant Summary collapse
- OPTIONS =
{ :headers => { CONTENT_TYPE => 'application/x-www-form-urlencoded' } }
Constants included from Github::Request
Github::Request::METHODS, Github::Request::METHODS_WITH_BODIES
Constants included from Connection
Constants included from Constants
Constants::ACCEPT, Constants::ACCEPTED_OAUTH_SCOPES, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::HEADER_LAST, Constants::HEADER_LINK, Constants::HEADER_NEXT, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::OAUTH_SCOPES, Constants::PARAM_PAGE, Constants::PARAM_PER_PAGE, Constants::PARAM_START_PAGE, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::SERVER, Constants::USER_AGENT
Constants included from MimeType
Instance Attribute Summary
Attributes inherited from API
Attributes included from Authorization
Instance Method Summary collapse
-
#subscribe(*args) ⇒ Object
Subscribe to existing topic/event through pubsubhubbub.
-
#subscribe_service(*args) ⇒ Object
(also: #subscribe_repository, #subscribe_repo)
Subscribe repository to service hook through pubsubhubbub.
-
#unsubscribe(*args) ⇒ Object
Unsubscribe from existing topic/event through pubsubhubbub.
-
#unsubscribe_service(*args) ⇒ Object
(also: #unsubscribe_repository, #unsubscribe_repo)
Subscribe repository to service hook through pubsubhubbub.
Methods inherited from API
#api_methods_in, #append_arguments, #arguments, inherited, #initialize, #method_missing, #process_basic_auth, #set, #setup, #with, #yield_or_eval
Methods included from Github::RateLimit
#ratelimit, #ratelimit_remaining
Methods included from Github::Request
#delete_request, #get_request, #patch_request, #post_request, #put_request, #request
Methods included from Connection
#caching?, #clear_cache, #connection, #default_middleware, #default_options, #stack
Methods included from MimeType
Methods included from Authorization
#auth_code, #authenticated?, #authentication, #authorize_url, #basic_authed?, #client, #get_token
Constructor Details
This class inherits a constructor from Github::API
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Github::API
Instance Method Details
#subscribe(*args) ⇒ Object
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 protected]',
:verify => 'sync',
:secret => '...'
25 26 27 28 29 30 31 |
# File 'lib/github_api/repos/pub_sub_hubbub.rb', line 25 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_service(*args) ⇒ Object Also known as: subscribe_repository, subscribe_repo
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 ispush
Examples
github = Github.new :oauth_token => '...'
github.repos.pubsubhubbub.subscribe_service 'user-name', 'repo-name', 'campfire',
:subdomain => 'github',
:room => 'Commits',
:token => 'abc123',
:event => 'watch'
70 71 72 73 74 75 76 77 |
# File 'lib/github_api/repos/pub_sub_hubbub.rb', line 70 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) ⇒ Object
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 protected]',
:verify => 'sync',
:secret => '...'
47 48 49 50 51 52 53 |
# File 'lib/github_api/repos/pub_sub_hubbub.rb', line 47 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_service(*args) ⇒ Object Also known as: unsubscribe_repository, unsubscribe_repo
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 ispush
Examples
github = Github.new :oauth_token => '...'
github.repos.pubsubhubbub.unsubscribe_service 'user-name', 'repo-name', 'campfire'
92 93 94 95 96 97 98 99 |
# File 'lib/github_api/repos/pub_sub_hubbub.rb', line 92 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 |