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

Result refactor #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

rcoup
Copy link

@rcoup rcoup commented Feb 8, 2018

This fixes #13, which leads directly to easier mocking/testing of Chargebee APIs too.

It's mostly just cut & paste from result.py to the model classes. The Result._get*() methods no longer pass sub_types/etc to Model__init__(), because they're already defined on the class.

Model.init_dependent_*() methods are no longer called from Result, they're integrated into Model.construct(), and are simpler because there's no need to find and pass the dependent's subtypes.

I've added a test for subtypes using Customer, and a test for Estimate which was the only model using dependent_types.

(includes PR #22, but can refactor if/once that lands)

@rcoup
Copy link
Author

rcoup commented May 24, 2019

has been updated against master ~2.6.4.

Any chance of some attention?

@rcoup
Copy link
Author

rcoup commented Jan 20, 2020

Updated again against 2.7.1

Uses the Model.fields[0] by default, but can be overridden via `Model.repr_field`
* move sub type & dependent type declarations to the model classes
* dependent_sub_types moves to the sub type classes themselves
* simplify construct/init_* methods
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.

Be able to easily deserialise Model objects from cache responses
1 participant