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

Nested resource class methods #350

Merged
merged 2 commits into from
Oct 19, 2017

Conversation

ob-stripe
Copy link
Contributor

r? @brandur-stripe
cc @stripe/api-libraries

Basically a port of stripe/stripe-ruby#597 for the Python library.

A couple differences:

  • implemented as a decorator, because Python

  • the update methods are called modify_<nested_resource> instead of update_<nested_resource> to match the pre-existing naming convention in the library.

Everything else should be the same.

@brandur-stripe
Copy link
Contributor

Man Olivier you are on a roll here! Nice work — I'm especially loving the really extensive test suite, and the fact that the decorator class has tests directly.

I'll wait on a little discussion in stripe/stripe-ruby#597, but LGTM.

if path is None:
path = "%ss" % resource
if operations is None:
operations = ['create', 'retrieve', 'update', 'delete', 'list']
Copy link
Contributor

Choose a reason for hiding this comment

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

@ob-stripe Relating to stripe/stripe-ruby#600, mind if we require an explicit list of supported operations here?

@ob-stripe
Copy link
Contributor Author

Pushed another commit to require an explicit list of operations.

@brandur-stripe
Copy link
Contributor

Thanks OB!

I think you missed one. From CI:

Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/unittest2/loader.py", line 456, in _find_test_path
    module = self._get_module_from_name(name)
  File "/home/travis/virtualenv/python2.6.9/lib/python2.6/site-packages/unittest2/loader.py", line 395, in _get_module_from_name
    __import__(name)
  File "/home/travis/build/stripe/stripe-python/stripe/test/resources/test_api_resource.py", line 121, in <module>
    class NestedResourceClassMethodsTests(StripeApiTestCase):
  File "/home/travis/build/stripe/stripe-python/stripe/test/resources/test_api_resource.py", line 122, in NestedResourceClassMethodsTests
    @stripe.resource.nested_resource_class_methods('nested')
  File "/home/travis/build/stripe/stripe-python/stripe/resource.py", line 113, in nested_resource_class_methods
    raise ValueError("operations list required")
ValueError: operations list required

@ob-stripe ob-stripe force-pushed the ob-nested-resource-class-methods branch from bfdca8f to 872b354 Compare October 18, 2017 19:33
@ob-stripe
Copy link
Contributor Author

Oops! Should be fixed now.

@brandur-stripe brandur-stripe merged commit e6ee7be into master Oct 19, 2017
@brandur-stripe brandur-stripe deleted the ob-nested-resource-class-methods branch October 19, 2017 16:22
@brandur-stripe
Copy link
Contributor

Released as 1.68.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants