Skip to content

Commit

Permalink
new address api
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 18, 2016
1 parent 54fcee6 commit 5dbbc2b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/budy/__init__.py
Expand Up @@ -35,6 +35,7 @@
""" The license for the module """

from . import account
from . import address
from . import bag
from . import base
from . import category
Expand All @@ -44,6 +45,7 @@
from . import product

from .account import AccountApi
from .address import AddressApi
from .bag import BagApi
from .base import Api
from .category import CategoryApi
Expand Down
53 changes: 53 additions & 0 deletions src/budy/address.py
@@ -0,0 +1,53 @@
#!/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 AddressApi(object):

def list_bags(self, *args, **kwargs):
url = self.base_url + "addresses"
contents = self.get(
url,
**kwargs
)
return contents

def get_bag(self, key):
url = self.base_url + "addresses/%s" % key
contents = self.get(url, auth = False)
return contents
2 changes: 2 additions & 0 deletions src/budy/base.py
Expand Up @@ -43,6 +43,7 @@
from . import color
from . import order
from . import account
from . import address
from . import country
from . import product
from . import category
Expand All @@ -58,6 +59,7 @@ class Api(
color.ColorApi,
order.OrderApi,
account.AccountApi,
address.AddressApi,
country.CountryApi,
product.ProductApi,
category.CategoryApi,
Expand Down

0 comments on commit 5dbbc2b

Please sign in to comment.