Skip to content

Commit

Permalink
Merge pull request #11 from priyankarani/feature/task-1736
Browse files Browse the repository at this point in the history
Store View API and Magento API #1736
  • Loading branch information
Sharoon Thomas committed Jun 29, 2013
2 parents 6be59e2 + eb68982 commit 178301c
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
3 changes: 2 additions & 1 deletion magento/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down
55 changes: 55 additions & 0 deletions magento/miscellaneous.py
Original file line number Diff line number Diff line change
@@ -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 :
{<attribute>:{<operator>:<value>}}
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', [])

0 comments on commit 178301c

Please sign in to comment.