Skip to content

Commit

Permalink
add a helper method to subscribe and get the publish notification
Browse files Browse the repository at this point in the history
  • Loading branch information
blaine committed Jan 27, 2010
1 parent 614aaf0 commit 579ecd6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions common.rb
Expand Up @@ -47,3 +47,20 @@ def doRequest(opts = {})
@hub.unsubscribe(opts[:callback], opts[:topic], opts[:verify], opts[:verify_token], opts[:params])
end
end

def get_publish_notification
@request_mode = 'subscribe'
doRequest.should be_a_kind_of(Net::HTTPNoContent)

request = nil
@subscriber.on_request = lambda { |req, res| request = req }

@hub.publish(@topic_url)

wait_for { request != nil }

request.should_not be_nil
return request
end


0 comments on commit 579ecd6

Please sign in to comment.