Missed methods, tests (#19)

This commit is contained in:
Alex Lushpai 2020-08-20 14:44:41 +03:00 committed by GitHub
parent 41084fd4be
commit 12790245f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 9129 additions and 322 deletions

View File

@ -4,6 +4,7 @@ python:
- '3.5'
- '3.6'
- '3.7'
- '3.8'
before_install:
- pip install -r requirements.txt
script:

4
README
View File

@ -75,5 +75,5 @@ Documentation
- `English`_
- `Russian`_
.. _English: http://www.retailcrm.pro/docs/Developers/Index
.. _Russian: http://www.retailcrm.ru/docs/Developers/Index
.. _English: https://help.retailcrm.pro/Developers/Index
.. _Russian: https://help.retailcrm.ru/Developers/Index

View File

@ -77,5 +77,5 @@ result = client.task_create(task, site)
## Documentation
* [English](http://www.retailcrm.pro/docs/Developers/Index)
* [Russian](http://www.retailcrm.ru/docs/Developers/Index)
* [English](https://help.retailcrm.pro/Developers/Index)
* [Russian](https://help.retailcrm.ru/Developers/Index)

View File

@ -1,4 +1,6 @@
multidimensional-urlencode==0.0.4
nose==1.3.7
requests==2.20.0
coverage==4.5.4
requests==2.24.0
coverage==5.2.1
pook==1.0.1
setuptools==49.6.0

View File

@ -19,9 +19,9 @@ class Client(Base):
def customers(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -32,8 +32,8 @@ class Client(Base):
def customer_create(self, customer, site=None):
"""
:param customer:
:param site:
:param customer: object
:param site: string
:return: Response
"""
self.parameters['customer'] = json.dumps(customer)
@ -45,8 +45,8 @@ class Client(Base):
def customers_fix_external_ids(self, customers, site=None):
"""
:param customers:
:param site:
:param customers: object
:param site: string
:return: Response
"""
self.parameters['customers'] = json.dumps(customers)
@ -58,8 +58,8 @@ class Client(Base):
def customers_upload(self, customers, site=None):
"""
:param customers:
:param site:
:param customers: array of objects
:param site: string
:return: Response
"""
self.parameters['customers'] = json.dumps(customers)
@ -71,9 +71,9 @@ class Client(Base):
def customer(self, uid, uid_type='externalId', site=None):
"""
:param uid:
:param uid_type:
:param site:
:param uid: string
:param uid_type: string
:param site: string
:return: Response
"""
if uid_type != 'externalId':
@ -86,9 +86,9 @@ class Client(Base):
def customer_edit(self, customer, uid_type='externalId', site=None):
"""
:param customer:
:param uid_type:
:param site:
:param customer: object
:param uid_type: string
:param site: string
:return: Response
"""
self.parameters['customer'] = json.dumps(customer)
@ -103,7 +103,7 @@ class Client(Base):
def orders(self, filters=None, limit=20, page=1):
"""
:param filters: array
:param filters: object
:param limit: integer
:param page: integer
:return: Response
@ -142,11 +142,11 @@ class Client(Base):
def orders_history(self, start=None, end=None, limit=100, offset=0, skip=True):
"""
:param start:
:param end:
:param limit:
:param offset:
:param skip:
:param start: DateTime
:param end: DateTime
:param limit: integer
:param offset: integer
:param skip: boolean
:return: Response
"""
self.parameters['startDate'] = start
@ -215,9 +215,9 @@ class Client(Base):
def packs(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -228,7 +228,7 @@ class Client(Base):
def pack_create(self, pack):
"""
:param pack:
:param pack: object
:return: Response
"""
self.parameters['pack'] = json.dumps(pack)
@ -237,9 +237,9 @@ class Client(Base):
def packs_history(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -250,7 +250,7 @@ class Client(Base):
def pack(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
@ -258,7 +258,7 @@ class Client(Base):
def pack_delete(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
@ -266,7 +266,7 @@ class Client(Base):
def pack_edit(self, pack):
"""
:param pack:
:param pack: object
:return: Response
"""
self.parameters['pack'] = json.dumps(pack)
@ -289,7 +289,7 @@ class Client(Base):
def delivery_services_edit(self, delivery_service):
"""
:param delivery_service:
:param delivery_service: object
:return: Response
"""
self.parameters['deliveryService'] = json.dumps(delivery_service)
@ -305,7 +305,7 @@ class Client(Base):
def delivery_types_edit(self, delivery_type):
"""
:param delivery_type:
:param delivery_type: object
:return: Response
"""
self.parameters['deliveryType'] = json.dumps(delivery_type)
@ -322,7 +322,7 @@ class Client(Base):
def order_methods_edit(self, order_method):
"""
:param order_method:
:param order_method: object
:return: Response
"""
self.parameters['orderMethod'] = json.dumps(order_method)
@ -338,7 +338,7 @@ class Client(Base):
def order_types_edit(self, order_type):
"""
:param order_type:
:param order_type: object
:return: Response
"""
self.parameters['orderType'] = json.dumps(order_type)
@ -354,7 +354,7 @@ class Client(Base):
def payment_statuses_edit(self, payment_status):
"""
:param payment_status:
:param payment_status: object
:return: Response
"""
self.parameters['paymentStatus'] = json.dumps(payment_status)
@ -370,7 +370,7 @@ class Client(Base):
def payment_types_edit(self, payment_type):
"""
:param payment_type:
:param payment_type: object
:return: Response
"""
self.parameters['paymentType'] = json.dumps(payment_type)
@ -386,7 +386,7 @@ class Client(Base):
def product_statuses_edit(self, product_status):
"""
:param product_status:
:param product_status: object
:return: Response
"""
self.parameters['productStatus'] = json.dumps(product_status)
@ -402,7 +402,7 @@ class Client(Base):
def sites_edit(self, site):
"""
:param site:
:param site: object
:return: Response
"""
self.parameters['site'] = json.dumps(site)
@ -411,7 +411,7 @@ class Client(Base):
def status_groups(self):
"""
:return
:return: Response
"""
return self.get('/reference/status-groups')
@ -425,7 +425,7 @@ class Client(Base):
def statuses_edit(self, status):
"""
:param status:
:param status: object
:return: Response
"""
self.parameters['status'] = json.dumps(status)
@ -441,18 +441,18 @@ class Client(Base):
def stores_edit(self, store):
"""
:param store:
:param store: object
:return: Response
"""
self.parameters['status'] = json.dumps(store)
self.parameters['store'] = json.dumps(store)
return self.post('/reference/stores/' + store['code'] + '/edit')
def inventories(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -463,8 +463,8 @@ class Client(Base):
def inventories_upload(self, offers, site=None):
"""
:param offers:
:param site:
:param offers: array of objects
:param site: string
:return: Response
"""
if site is not None:
@ -476,10 +476,10 @@ class Client(Base):
def telephony_call_event(self, phone, call_type, code, status):
"""
:param phone:
:param call_type:
:param code:
:param status:
:param phone: string
:param call_type: string
:param code: string
:param status: string
:return: Response
"""
self.parameters['hangupStatus'] = status
@ -491,7 +491,7 @@ class Client(Base):
def telephony_calls_upload(self, calls):
"""
:param calls:
:param calls: array of objects
:return: Response
"""
self.parameters['calls'] = json.dumps(calls)
@ -500,9 +500,9 @@ class Client(Base):
def telephony_manager(self, phone, details=True):
"""
:param phone:
:param details:
:return: Response
:param phone: string
:param details: string
:return: Response string
"""
self.parameters['phone'] = phone
self.parameters['details'] = details
@ -511,12 +511,12 @@ class Client(Base):
def telephony_settings(self, code, client_id, make_call_url, active, name, image):
"""
:param code:
:param client_id:
:param make_call_url:
:param active:
:param name:
:param image:
:param code: string
:param client_id: string
:param make_call_url: string
:param active: string
:param name: string
:param image: string
:return: Response
"""
self.parameters['code'] = code
@ -527,3 +527,10 @@ class Client(Base):
self.parameters['image'] = image
return self.post('/telephony/settings/' + str(code))
def statistic_update(self):
"""
:return: Response
"""
return self.get('/statistic/update')

View File

@ -19,9 +19,9 @@ class Client(Base):
def customers(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -32,8 +32,8 @@ class Client(Base):
def customer_create(self, customer, site=None):
"""
:param customer:
:param site:
:param customer: object
:param site: string
:return: Response
"""
self.parameters['customer'] = json.dumps(customer)
@ -45,8 +45,8 @@ class Client(Base):
def customers_fix_external_ids(self, customers, site=None):
"""
:param customers:
:param site:
:param customers: array of objects
:param site: string
:return: Response
"""
self.parameters['customers'] = json.dumps(customers)
@ -58,9 +58,9 @@ class Client(Base):
def customers_history(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -71,8 +71,8 @@ class Client(Base):
def customers_upload(self, customers, site=None):
"""
:param customers:
:param site:
:param customers: array of objects
:param site: string
:return: Response
"""
self.parameters['customers'] = json.dumps(customers)
@ -84,9 +84,9 @@ class Client(Base):
def customer(self, uid, uid_type='externalId', site=None):
"""
:param uid:
:param uid_type:
:param site:
:param uid: string
:param uid_type: string
:param site: string
:return: Response
"""
if uid_type != 'externalId':
@ -99,9 +99,9 @@ class Client(Base):
def customer_edit(self, customer, uid_type='externalId', site=None):
"""
:param customer:
:param uid_type:
:param site:
:param customer: object
:param uid_type: string
:param site: string
:return: Response
"""
self.parameters['customer'] = json.dumps(customer)
@ -116,7 +116,7 @@ class Client(Base):
def delivery_setting(self, code):
"""
:param code:
:param code: string
:return: Response
"""
@ -124,17 +124,17 @@ class Client(Base):
def delivery_setting_edit(self, configuration):
"""
:param configuration::
:param configuration: object
:return: Response
"""
self.parameters['configuration'] = json.dumps(configuration)
return self.post('/delivery/generic/setting/' + str(configuration['code'])) + '/edit'
return self.post('/delivery/generic/setting/' + str(configuration['code']) + '/edit')
def delivery_tracking(self, code, status_update):
"""
:param code:
:param status_update:
:param code: string
:param status_update: array of objects
:return: Response
"""
self.parameters['statusUpdate'] = json.dumps(status_update)
@ -143,16 +143,16 @@ class Client(Base):
def marketplace_setting_edit(self, configuration):
"""
:param configuration::
:param configuration: object
:return: Response
"""
self.parameters['configuration'] = json.dumps(configuration)
return self.post('/marketplace/external/setting/' + str(configuration['code'])) + '/edit'
return self.post('/marketplace/external/setting/' + str(configuration['code']) + '/edit')
def orders(self, filters=None, limit=20, page=1):
"""
:param filters: array
:param filters: object
:param limit: integer
:param page: integer
:return: Response
@ -178,7 +178,7 @@ class Client(Base):
def orders_fix_external_ids(self, orders, site=None):
"""
:param orders: object
:param orders: array of objects
:param site: string
:return: Response
"""
@ -191,9 +191,9 @@ class Client(Base):
def orders_history(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -215,7 +215,7 @@ class Client(Base):
def orders_upload(self, orders, site=None):
"""
:param orders: object
:param orders: array of objects
:param site: string
:return: Response
"""
@ -260,9 +260,9 @@ class Client(Base):
def packs(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -273,7 +273,7 @@ class Client(Base):
def pack_create(self, pack):
"""
:param pack:
:param pack: object
:return: Response
"""
self.parameters['pack'] = json.dumps(pack)
@ -282,9 +282,9 @@ class Client(Base):
def packs_history(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -295,7 +295,7 @@ class Client(Base):
def pack(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
@ -303,7 +303,7 @@ class Client(Base):
def pack_delete(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
@ -311,7 +311,7 @@ class Client(Base):
def pack_edit(self, pack):
"""
:param pack:
:param pack: object
:return: Response
"""
self.parameters['pack'] = json.dumps(pack)
@ -334,7 +334,7 @@ class Client(Base):
def delivery_services_edit(self, delivery_service):
"""
:param delivery_service:
:param delivery_service: object
:return: Response
"""
self.parameters['deliveryService'] = json.dumps(delivery_service)
@ -350,7 +350,7 @@ class Client(Base):
def delivery_types_edit(self, delivery_type):
"""
:param delivery_type:
:param delivery_type: object
:return: Response
"""
self.parameters['deliveryType'] = json.dumps(delivery_type)
@ -367,7 +367,7 @@ class Client(Base):
def order_methods_edit(self, order_method):
"""
:param order_method:
:param order_method: object
:return: Response
"""
self.parameters['orderMethod'] = json.dumps(order_method)
@ -383,7 +383,7 @@ class Client(Base):
def order_types_edit(self, order_type):
"""
:param order_type:
:param order_type: object
:return: Response
"""
self.parameters['orderType'] = json.dumps(order_type)
@ -399,7 +399,7 @@ class Client(Base):
def payment_statuses_edit(self, payment_status):
"""
:param payment_status:
:param payment_status: object
:return: Response
"""
self.parameters['paymentStatus'] = json.dumps(payment_status)
@ -431,7 +431,7 @@ class Client(Base):
def price_types_edit(self, price_type):
"""
:param price_type:
:param price_type: object
:return: Response
"""
self.parameters['priceType'] = json.dumps(price_type)
@ -447,7 +447,7 @@ class Client(Base):
def product_statuses_edit(self, product_status):
"""
:param product_status:
:param product_status: object
:return: Response
"""
self.parameters['productStatus'] = json.dumps(product_status)
@ -463,7 +463,7 @@ class Client(Base):
def sites_edit(self, site):
"""
:param site:
:param site: object
:return: Response
"""
self.parameters['site'] = json.dumps(site)
@ -486,7 +486,7 @@ class Client(Base):
def statuses_edit(self, status):
"""
:param status:
:param status: object
:return: Response
"""
self.parameters['status'] = json.dumps(status)
@ -502,18 +502,18 @@ class Client(Base):
def stores_edit(self, store):
"""
:param store:
:param store: object
:return: Response
"""
self.parameters['status'] = json.dumps(store)
self.parameters['store'] = json.dumps(store)
return self.post('/reference/stores/' + store['code'] + '/edit')
def inventories(self, filters=None, limit=20, page=1):
"""
:param filters:
:param limit:
:param page:
:param filters: object
:param limit: integer
:param page: integer
:return: Response
"""
self.parameters['filter'] = filters
@ -524,8 +524,8 @@ class Client(Base):
def inventories_upload(self, offers, site=None):
"""
:param offers:
:param site:
:param offers: array of objects
:param site: string
:return: Response
"""
if site is not None:
@ -537,7 +537,7 @@ class Client(Base):
def prices_upload(self, prices):
"""
:param prices:
:param prices: array of objects
:return: Response
"""
self.parameters['prices'] = json.dumps(prices)
@ -546,7 +546,7 @@ class Client(Base):
def products(self, filters=None, limit=20, page=1):
"""
:param filters: array
:param filters: object
:param limit: integer
:param page: integer
:return: Response
@ -559,7 +559,7 @@ class Client(Base):
def store_setting(self, code):
"""
:param code:
:param code: string
:return: Response
"""
@ -567,16 +567,16 @@ class Client(Base):
def store_setting_edit(self, configuration):
"""
:param configuration::
:param configuration: object
:return: Response
"""
self.parameters['configuration'] = json.dumps(configuration)
return self.post('/store/setting/' + str(configuration['code'])) + '/edit'
return self.post('/store/setting/' + str(configuration['code']) + '/edit')
def telephony_call_event(self, event):
"""
:param event:
:param event: object
:return: Response
"""
self.parameters['event'] = json.dumps(event)
@ -585,27 +585,29 @@ class Client(Base):
def telephony_calls_upload(self, calls):
"""
:param calls:
:param calls: array of objects
:return: Response
"""
self.parameters['calls'] = json.dumps(calls)
return self.post('/telephony/calls/upload')
def telephony_manager(self, phone, details=True):
def telephony_manager(self, phone, details=True, ignore_status=False):
"""
:param phone:
:param details:
:param phone: string
:param details: string
:param ignore_status: string
:return: Response
"""
self.parameters['phone'] = phone
self.parameters['details'] = details
self.parameters['ignoreStatus'] = ignore_status
return self.get('/telephony/manager')
def telephony_setting(self, code):
"""
:param code:
:param code: string
:return: Response
"""
@ -613,12 +615,12 @@ class Client(Base):
def telephony_setting_edit(self, configuration):
"""
:param configuration::
:param configuration: object
:return: Response
"""
self.parameters['configuration'] = json.dumps(configuration)
return self.post('/telephony/setting/' + str(configuration['code'])) + '/edit'
return self.post('/telephony/setting/' + str(configuration['code']) + '/edit')
def user_groups(self, limit=20, page=1):
"""
@ -633,7 +635,7 @@ class Client(Base):
def users(self, filters=None, limit=20, page=1):
"""
:param filters: array
:param filters: object
:param limit: integer
:param page: integer
:return: Response
@ -646,8 +648,15 @@ class Client(Base):
def user(self, uid):
"""
:param uid:
:param uid: integer
:return: Response
"""
return self.get('/users/' + str(uid))
def statistic_update(self):
"""
:return: Response
"""
return self.get('/statistic/update')

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ def read(filename):
setup(
name='retailcrm',
version='5.0.3',
version='5.1.0',
description='retailCRM API client',
long_description=read('README'),
url='https://github.com/retailcrm/api-client-python',
@ -25,7 +25,7 @@ setup(
license='MIT',
packages=['retailcrm', 'retailcrm/versions'],
package_data={},
install_requires=['requests', 'multidimensional_urlencode', 'nose'],
install_requires=['requests', 'multidimensional_urlencode', 'nose', 'coverage', 'pook', 'setuptools'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Other Environment',
@ -38,6 +38,7 @@ setup(
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development :: Libraries :: Python Modules',
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff