Skip to content

Commit

Permalink
new product api added
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed May 9, 2016
1 parent dcb16c8 commit 797d1e0
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/omni/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
from . import media
from . import merchandise
from . import money_sale_slip
from . import product
from . import return_
from . import sale_order
from . import sale_snapshot
Expand Down Expand Up @@ -78,6 +79,7 @@
from .media import MediaApi
from .merchandise import MerchandiseApi
from .money_sale_slip import MoneySaleSlipApi
from .product import ProductApi
from .return_ import ReturnApi
from .sale_order import SaleOrderApi
from .sale_snapshot import SaleSnapshotApi
Expand Down
2 changes: 2 additions & 0 deletions src/omni/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from . import entity
from . import return_
from . import invoice
from . import product
from . import customer
from . import supplier
from . import transfer
Expand Down Expand Up @@ -101,6 +102,7 @@ class Api(
entity.EntityApi,
return_.ReturnApi,
invoice.InvoiceApi,
product.ProductApi,
customer.CustomerApi,
supplier.SupplierApi,
transfer.TransferApi,
Expand Down
56 changes: 56 additions & 0 deletions src/omni/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Hive Omni ERP
# Copyright (c) 2008-2016 Hive Solutions Lda.
#
# This file is part of Hive Omni ERP.
#
# Hive Omni ERP 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 Omni ERP 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 Omni ERP. 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 """

from . import util

class ProductApi(object):

def list_products(self, *args, **kwargs):
util.filter_args(kwargs)
url = self.base_url + "omni/products.json"
contents = self.get(
url,
**kwargs
)
return contents

def get_product(self, object_id):
url = self.base_url + "omni/products/%d.json" % object_id
contents = self.get(url)
return contents

0 comments on commit 797d1e0

Please sign in to comment.