Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 157daf2

Browse files
committed
Updates to SendMixin and readme. Removed send_invoice from Invoice object.
1 parent 752ac39 commit 157daf2

File tree

6 files changed

+22
-23
lines changed

6 files changed

+22
-23
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
========
33

4+
* 0.7.4 (March 26th, 2018)
5+
* Fixed bug in SendMixin send method.
6+
* Added support for send_to email to SendMixin.
7+
* Removed send_invoice from Invoice object.
8+
* Removed sandbox from Session Managers.
9+
410
* 0.7.3 (November 28th, 2017)
511
* Fixed bug in ListMixin count method.
612

README.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Manually connecting with OAuth version 1.0
3939
from quickbooks import Oauth1SessionManager
4040
4141
session_manager = Oauth1SessionManager(
42-
sandbox=True,
4342
consumer_key=QUICKBOOKS_CLIENT_KEY,
4443
consumer_secret=QUICKBOOKS_CLIENT_SECRET,
4544
)
@@ -58,7 +57,6 @@ for use in the Callback method.
5857
.. code-block:: python
5958
6059
session_manager = Oauth1SessionManager(
61-
sandbox=True,
6260
consumer_key=QUICKBOOKS_CLIENT_KEY,
6361
consumer_secret=QUICKBOOKS_CLIENT_SECRET
6462
)
@@ -86,7 +84,6 @@ Manually connecting with OAuth version 2.0
8684
from quickbooks import Oauth2SessionManager
8785
8886
session_manager = Oauth2SessionManager(
89-
sandbox=True,
9087
client_id=QUICKBOOKS_CLIENT_ID,
9188
client_secret=QUICKBOOKS_CLIENT_SECRET,
9289
base_url='http://localhost:8000',
@@ -102,7 +99,6 @@ Manually connecting with OAuth version 2.0
10299
.. code-block:: python
103100
104101
session_manager = Oauth2SessionManager(
105-
sandbox=True,
106102
client_id=QUICKBOOKS_CLIENT_ID,
107103
client_secret=QUICKBOOKS_CLIENT_SECRET,
108104
base_url='http://localhost:8000',
@@ -123,7 +119,6 @@ OAuth version 1.0 - Setup the session manager using the stored ``access_token``
123119
.. code-block:: python
124120
125121
session_manager = Oauth1SessionManager(
126-
sandbox=True,
127122
consumer_key=CONSUMER_KEY,
128123
consumer_secret=CONSUMER_SECRET,
129124
access_token=ACCESS_TOKEN,
@@ -134,8 +129,7 @@ OAuth version 2.0 - Setup the session manager using the stored ``access_token``
134129

135130
.. code-block:: python
136131
137-
self.session_manager = Oauth2SessionManager(
138-
sandbox=True,
132+
session_manager = Oauth2SessionManager(
139133
client_id=realm_id,
140134
client_secret=CLIENT_SECRET,
141135
access_token=AUTH2_ACCESS_TOKEN,

quickbooks/auth.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
class AuthSessionManager(object):
3030
oauth_version = None
31-
sandbox = False
3231
session = None
3332
started = False
3433

@@ -70,9 +69,6 @@ def __init__(self, **kwargs):
7069
if 'access_token_secret' in kwargs:
7170
self.access_token_secret = kwargs['access_token_secret']
7271

73-
if 'sandbox' in kwargs:
74-
self.sandbox = kwargs['sandbox']
75-
7672
def start_session(self):
7773
if not self.started:
7874
if self.consumer_key == '':
@@ -176,9 +172,6 @@ def __init__(self, **kwargs):
176172
if 'base_url' in kwargs:
177173
self.base_url = kwargs['base_url']
178174

179-
if 'sandbox' in kwargs:
180-
self.sandbox = kwargs['sandbox']
181-
182175
def start_session(self):
183176
if not self.started:
184177
if self.client_id == '':

quickbooks/mixins.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,16 @@ def get(cls, id, qb=None):
100100

101101

102102
class SendMixin(object):
103-
def send(self, qb=None):
103+
def send(self, qb=None, send_to=None):
104104
if not qb:
105105
qb = QuickBooks()
106106

107107
end_point = "{0}/{1}/send".format(self.qbo_object_name, self.Id)
108-
results = qb.misc_operation(end_point)
108+
109+
if send_to:
110+
end_point = "{0}?sendTo={1}".format(end_point, send_to)
111+
112+
results = qb.misc_operation(end_point, None)
109113

110114
return results
111115

quickbooks/objects/invoice.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,3 @@ def email_sent(self):
103103
return True
104104

105105
return False
106-
107-
def send_invoice(self, send_to=None):
108-
url = self.api_url + "/company/{0}/invoice/{1}/send".format(self.company_id, self.Id)
109-
results = self.make_request("POST", url)
110-
111-
return results

tests/unit/test_mixins.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,4 +402,12 @@ def test_send(self, mock_misc_op):
402402
invoice.Id = 2
403403
invoice.send(qb=self.qb_client)
404404

405-
mock_misc_op.assert_called_with("Invoice/2/send")
405+
mock_misc_op.assert_called_with("Invoice/2/send", None)
406+
407+
@patch('quickbooks.mixins.QuickBooks.misc_operation')
408+
def test_send_with_send_to_email(self, mock_misc_op):
409+
invoice = Invoice()
410+
invoice.Id = 2
411+
invoice.send(qb=self.qb_client, send_to="[email protected]")
412+
413+
mock_misc_op.assert_called_with("Invoice/2/[email protected]", None)

0 commit comments

Comments
 (0)