diff --git a/README.rst b/README.rst index 484eb84..a815085 100644 --- a/README.rst +++ b/README.rst @@ -39,6 +39,14 @@ Usage status = 'canceled' order_api.addcomment(order_increment_id, status) + with magento.Store(url, apiuser, apipass) as store_api: + store_id = '1' + store_view_info = store_api.info(store_id) + store_views = store_api.list() + + with magento.Magento(url, apiuser, apipass) as magento_api: + magento_info = magento_api.info() + License ------- diff --git a/magento/__init__.py b/magento/__init__.py index d91e3f3..2c1d458 100644 --- a/magento/__init__.py +++ b/magento/__init__.py @@ -7,7 +7,7 @@ :license: AGPLv3, see LICENSE for more details ''' __all__ = [ - 'API', + 'API', 'Store', 'Magento', 'Customer', 'CustomerGroup', 'CustomerAddress', 'Country', 'Region', 'Category', 'CategoryAttribute', 'Product', 'ProductAttribute', @@ -17,6 +17,7 @@ ] from .api import API +from .miscellaneous import Store, Magento from .customer import Customer, CustomerGroup, CustomerAddress from .directory import Country, Region from .catalog import Category, CategoryAttribute diff --git a/magento/miscellaneous.py b/magento/miscellaneous.py new file mode 100644 index 0000000..dc7142a --- /dev/null +++ b/magento/miscellaneous.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +""" + miscellaneous + + This API allows to access additional magento information + + :copyright: (c) 2013 by Openlabs Technologies & Consulting (P) Limited + :license: AGPLv3, see LICENSE for more details. +""" +from magento.api import API + + +class Store(API): + """ + This API allows to retrieve information about store views + """ + + __slots__ = () + + def info(self, store_id): + """ + Returns information for store view + + :param store_id: ID of store view + :return: Dictionary containing information about store view + """ + return self.call('store.info', [store_id]) + + def list(self, filters=None): + """ + Returns list of store views + + :param filters: Dictionary of filters. + + Format : + {:{:}} + Example : + {'store_id':{'=':'1'}} + :return: List of Dictionaries + """ + return self.call('store.list', [filters]) + + +class Magento(API): + """ + This API returns information about current magento installation + """ + + __slots__ = () + + def info(self): + """ + Returns information about current magento + """ + return self.call('core_magento.info', [])