summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/provider/__init__.py
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-01-07 18:58:06 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-01-09 14:27:42 -0300
commitfc0663054c4f76c1103291c334bb60c0dff1280b (patch)
tree7f2041f67d6769812e9b0974ebe5c89b0711824b /src/leap/bitmask/provider/__init__.py
parent504936617069b7dcba497ba6daf630769c36d4fd (diff)
Refactor provider utilities.
Diffstat (limited to 'src/leap/bitmask/provider/__init__.py')
-rw-r--r--src/leap/bitmask/provider/__init__.py37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/leap/bitmask/provider/__init__.py b/src/leap/bitmask/provider/__init__.py
index 68f3ded0..ca6426f4 100644
--- a/src/leap/bitmask/provider/__init__.py
+++ b/src/leap/bitmask/provider/__init__.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-Module initialization for leap.bitmask.provider
+Provider utilities.
"""
import os
@@ -25,6 +25,10 @@ from leap.bitmask import __version__ as BITMASK_VERSION
from leap.common.check import leap_assert
+# The currently supported API versions by the client.
+SUPPORTED_APIS = ["1"]
+
+
def get_provider_path(domain):
"""
Returns relative path for provider config.
@@ -38,19 +42,24 @@ def get_provider_path(domain):
return os.path.join("leap", "providers", domain, "provider.json")
-class SupportedClient(object):
+def supports_api(api_version):
"""
- Class responsible of checking for client compatibility.
+ :param api_version: the version number of the api that we need to check
+ :type api_version: str
+
+ :returns: if that version is supported or not.
+ :return type: bool
"""
+ return api_version in SUPPORTED_APIS
+
- @classmethod
- def supports(self, minimum_version):
- """
- :param minimum_version: the version number of the client that
- we need to check.
- :type minimum_version: str
-
- :returns: True if that version is supported or False otherwise.
- :return type: bool
- """
- return LooseVersion(minimum_version) <= LooseVersion(BITMASK_VERSION)
+def supports_client(minimum_version):
+ """
+ :param minimum_version: the version number of the client that
+ we need to check.
+ :type minimum_version: str
+
+ :returns: True if that version is supported or False otherwise.
+ :return type: bool
+ """
+ return LooseVersion(minimum_version) <= LooseVersion(BITMASK_VERSION)