Skip to content

Commit

Permalink
packaged for pipit
Browse files Browse the repository at this point in the history
  • Loading branch information
bolaurent committed May 9, 2017
1 parent c17b404 commit a680471
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 74 deletions.
8 changes: 8 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Copyright 2017 Bo Laurent

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

5 changes: 5 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# file GENERATED by distutils, do NOT edit
setup.cfg
setup.py
zuora_restful_python/__init__.py
zuora_restful_python/zuora.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# zuora-restful-python
# zuora_restful_python
A python class for accessing the Zuora API via REST

## References
Expand Down
12 changes: 0 additions & 12 deletions config.py

This file was deleted.

2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
15 changes: 15 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from distutils.core import setup
setup(
name = 'zuora_restful_python',
packages = ['zuora_restful_python'], # this must be the same as the name above
version = '0.1',
description = 'zuora REST API wrapper',
author = 'Bo Laurent',
author_email = '[email protected]',
url = 'https://github.com/bolaurent/zuora_restful_python', # use the URL to the github repo
download_url = 'https://github.com/peterldowns/mypackage/archive/0.1.tar.gz', # I'll explain this in a second
keywords = ['zuora', 'rest', 'api'],
classifiers = [
'Programming Language :: Python :: 3'
],
)
50 changes: 0 additions & 50 deletions zoql.py

This file was deleted.

Empty file.
24 changes: 13 additions & 11 deletions zuora.py → zuora_restful_python/zuora.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@
import json
import time
import datetime
import pdb


ZUORA_CHUNKSIZE = 50




class Zuora(object):
"""
config should be a dict as follows:
{
"user": "username",
"password": "password",
"endpoint": "https://rest.apisandbox.zuora.com/v1",
}
"""

def __init__(self, config):
self.config = config
self.auth = (config['user'], config['password'])
Expand Down Expand Up @@ -239,13 +250,6 @@ def updateAccountingPeriod(self, accountingPeriodId, payload):
response = self._put('/accounting-periods/' + accountingPeriodId, payload)
assert response['success'], response

# not tested
# def getCustomExchangeRates(self, currency, startDate, endDate):
# payload = {'startDate': startDate, 'endDate': endDate}
# response = self._get('/custom-exchange-rates/' + currency, payload=payload)
# pdb.set_trace()
# pass

def createInvoiceItemAdjustment(self, type, amount, sourceType, sourceId, adjustmentDate, invoiceNumber=None, invoiceId=None):
payload = {
'Type': type,
Expand All @@ -261,9 +265,7 @@ def createInvoiceItemAdjustment(self, type, amount, sourceType, sourceId, adjust
payload['InvoiceNumber'] = invoiceNumber

response = self._post('/object/invoice-item-adjustment/', payload)
if not response['Success']:
pdb.set_trace()
# assert response['Success'], response
assert response['Success'], response
return response

def updateInvoiceItemAdjustment(self, id, reasonCode=None, status=None, transferredToAccounting=None):
Expand Down

0 comments on commit a680471

Please sign in to comment.