Skip to content

Commit

Permalink
added collection api
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Silva committed Apr 1, 2016
1 parent 92edae8 commit 5049f67
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/budy/__init__.py
Expand Up @@ -39,6 +39,7 @@
from . import bag
from . import base
from . import category
from . import collection
from . import color
from . import country
from . import order
Expand All @@ -49,6 +50,7 @@
from .bag import BagApi
from .base import Api
from .category import CategoryApi
from .collection import CollectionApi
from .color import ColorApi
from .country import CountryApi
from .order import OrderApi
Expand Down
2 changes: 2 additions & 0 deletions src/budy/base.py
Expand Up @@ -47,6 +47,7 @@
from . import country
from . import product
from . import category
from . import collection
from . import subscription

BASE_URL = "http://localhost:8080/api/"
Expand All @@ -63,6 +64,7 @@ class Api(
country.CountryApi,
product.ProductApi,
category.CategoryApi,
collection.CollectionApi,
subscription.SubscriptionApi
):

Expand Down
49 changes: 49 additions & 0 deletions src/budy/collection.py
@@ -0,0 +1,49 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Hive Budy API
# Copyright (c) 2008-2016 Hive Solutions Lda.
#
# This file is part of Hive Budy API.
#
# Hive Budy API is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foundation, either version 2.0 of the License, or (at your option) any
# later version.
#
# Hive Budy API is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Apache License for more details.
#
# You should have received a copy of the Apache License along with
# Hive Budy API. If not, see <http://www.apache.org/licenses/>.

__author__ = "João Magalhães <joamag@hive.pt>"
""" The author(s) of the module """

__version__ = "1.0.0"
""" The version of the module """

__revision__ = "$LastChangedRevision$"
""" The revision number of the module """

__date__ = "$LastChangedDate$"
""" The last change date of the module """

__copyright__ = "Copyright (c) 2008-2016 Hive Solutions Lda."
""" The copyright for the module """

__license__ = "Apache License, Version 2.0"
""" The license for the module """

class CollectionApi(object):

def list_collections(self, *args, **kwargs):
url = self.base_url + "collections"
contents = self.get(
url,
auth = False,
**kwargs
)
return contents

0 comments on commit 5049f67

Please sign in to comment.