Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #362

Merged
merged 1 commit into from
Oct 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions stripe/api_resources/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,3 @@ def reject(self, reason=None, idempotency_key=None):
def deauthorize(self, **params):
params['stripe_user_id'] = self.id
return oauth.OAuth.deauthorize(**params)

@classmethod
def modify_external_account(cls, sid, external_account_id, **params):
url = "%s/%s/external_accounts/%s" % (
cls.class_url(), urllib.quote_plus(util.utf8(sid)),
urllib.quote_plus(util.utf8(external_account_id)))
return cls._modify(url, **params)
8 changes: 0 additions & 8 deletions stripe/api_resources/customer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import urllib
import warnings

from stripe import api_requestor, util
Expand Down Expand Up @@ -79,10 +78,3 @@ def delete_discount(self, **params):
url = self.instance_url() + '/discount'
_, api_key = requestor.request('delete', url)
self.refresh_from({'discount': None}, api_key, True)

@classmethod
def modify_source(cls, sid, source_id, **params):
url = "%s/%s/sources/%s" % (
cls.class_url(), urllib.quote_plus(util.utf8(sid)),
urllib.quote_plus(util.utf8(source_id)))
return cls._modify(url, **params)
2 changes: 1 addition & 1 deletion stripe/api_resources/invoice_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

class InvoiceItem(CreateableAPIResource, UpdateableAPIResource,
ListableAPIResource, DeletableAPIResource):
OBJECT_NAME = 'invoice_item'
OBJECT_NAME = 'invoiceitem'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably cut a new version for this or something to prevent many future instances of confusion around this bad naming ...

7 changes: 7 additions & 0 deletions stripe/test/api_resources/test_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ def test_list_balance_transactions(self):
'/v1/balance/history',
{}
)

def test_convert_to_stripe_object(self):
transaction = stripe.util.convert_to_stripe_object({
'id': 'txn_foo',
'object': 'balance_transaction',
})
self.assertIsInstance(transaction, stripe.BalanceTransaction)
7 changes: 7 additions & 0 deletions stripe/test/api_resources/test_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ def test_retrieve_invoice_items(self):
{'customer': 'cus_get_invoice_items'},
)

def test_convert_to_stripe_object(self):
item = stripe.util.convert_to_stripe_object({
'id': 'ii_foo',
'object': 'invoiceitem',
})
self.assertIsInstance(item, stripe.InvoiceItem)

def test_invoice_create(self):
customer = stripe.Customer(id="cus_invoice")
stripe.Invoice.create(customer=customer.id)
Expand Down
2 changes: 2 additions & 0 deletions stripe/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def load_object_classes():
api_resources.ApplicationFeeRefund.OBJECT_NAME:
api_resources.ApplicationFeeRefund,
api_resources.Balance.OBJECT_NAME: api_resources.Balance,
api_resources.BalanceTransaction.OBJECT_NAME:
api_resources.BalanceTransaction,
api_resources.BankAccount.OBJECT_NAME: api_resources.BankAccount,
api_resources.BitcoinReceiver.OBJECT_NAME:
api_resources.BitcoinReceiver,
Expand Down