From 584743eca88a9c920c37160b3af14b8cadccee59 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 16 Nov 2012 13:40:03 -0500 Subject: [PATCH] [manual] Uniformize the subscriptions API method names. This requires a zephyr_mirror deployment when it is pushed to prod. (imported from commit 6543441fb264b518f8705d7989d068a1d50ce5d6) --- bots/zephyr_mirror.py | 2 +- common.py | 8 ++++---- examples/{get-subscriptions => list-subscriptions} | 6 +++--- examples/subscribe | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) rename examples/{get-subscriptions => list-subscriptions} (82%) diff --git a/bots/zephyr_mirror.py b/bots/zephyr_mirror.py index 43b1287..ec6b80f 100755 --- a/bots/zephyr_mirror.py +++ b/bots/zephyr_mirror.py @@ -495,7 +495,7 @@ def add_humbug_subscriptions(verbose): zephyr_subscriptions.add(cls) if len(zephyr_subscriptions) != 0: - res = humbug_client.subscribe(list(zephyr_subscriptions)) + res = humbug_client.add_subscriptions(list(zephyr_subscriptions)) if res.get("result") != "success": print "Error subscribing to streams:" print res["msg"] diff --git a/common.py b/common.py index 56040f0..9696b69 100644 --- a/common.py +++ b/common.py @@ -103,12 +103,12 @@ class HumbugAPI(): def get_public_streams(self, request = {}): return self.do_api_query(request, "/api/v1/get_public_streams") - def get_subscriptions(self, request = {}): - return self.do_api_query(request, "/api/v1/get_subscriptions") + def list_subscriptions(self, request = {}): + return self.do_api_query(request, "/api/v1/subscriptions/list") - def subscribe(self, streams): + def add_subscriptions(self, streams): request = {'streams': streams} - return self.do_api_query(request, "/api/v1/subscribe") + return self.do_api_query(request, "/api/v1/subscriptions/add") def call_on_each_message(self, callback, options = {}): max_message_id = None diff --git a/examples/get-subscriptions b/examples/list-subscriptions similarity index 82% rename from examples/get-subscriptions rename to examples/list-subscriptions index 70472f2..81f4500 100755 --- a/examples/get-subscriptions +++ b/examples/list-subscriptions @@ -3,11 +3,11 @@ import sys import os import optparse -usage = """get-subscriptions --user= [options] +usage = """list-subscriptions --user= [options] Prints out a list of the user's subscriptions. -Example: get-subscriptions --user=tabbott@humbughq.com --site=http://127.0.0.1:8000 +Example: list-subscriptions --user=tabbott@humbughq.com --site=http://127.0.0.1:8000 """ parser = optparse.OptionParser(usage=usage) parser.add_option('--site', @@ -30,4 +30,4 @@ client = api.common.HumbugAPI(email=options.user, verbose=True, site=options.site) -print client.get_subscriptions() +print client.list_subscriptions() diff --git a/examples/subscribe b/examples/subscribe index beea5bc..5e19c2b 100755 --- a/examples/subscribe +++ b/examples/subscribe @@ -38,4 +38,4 @@ if options.streams == "": print >>sys.stderr, "Usage:", parser.usage sys.exit(1) -print client.subscribe(options.streams.split()) +print client.add_subscriptions(options.streams.split())