From c5a4d5de3c28901c0a45fe7f6a3bce129c008911 Mon Sep 17 00:00:00 2001 From: Manuel HUEZ Date: Fri, 18 Nov 2016 16:20:35 -0500 Subject: [PATCH] Improve expand and client setter --- processout/activity.py | 8 ++++---- processout/authorizationrequest.py | 20 +++++++++---------- processout/card.py | 8 ++++---- processout/coupon.py | 8 ++++---- processout/customer.py | 8 ++++---- processout/customeraction.py | 2 +- processout/discount.py | 20 +++++++++---------- processout/event.py | 8 ++++---- processout/gateway.py | 2 +- processout/gatewayconfiguration.py | 14 ++++++------- processout/invoice.py | 26 ++++++++++++------------ processout/plan.py | 8 ++++---- processout/product.py | 8 ++++---- processout/project.py | 2 +- processout/refund.py | 8 ++++---- processout/subscription.py | 26 ++++++++++++------------ processout/token.py | 14 ++++++------- processout/transaction.py | 32 +++++++++++++++--------------- processout/webhook.py | 14 ++++++------- setup.py | 4 ++-- spec.py | 8 +++++++- 21 files changed, 127 insertions(+), 121 deletions(-) diff --git a/processout/activity.py b/processout/activity.py index 510d64a..981a4ec 100755 --- a/processout/activity.py +++ b/processout/activity.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Activity: +class Activity(object): def __init__(self, client, prefill = None): self._client = client @@ -47,12 +47,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property diff --git a/processout/authorizationrequest.py b/processout/authorizationrequest.py index a04a097..3dc7915 100755 --- a/processout/authorizationrequest.py +++ b/processout/authorizationrequest.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class AuthorizationRequest: +class AuthorizationRequest(object): def __init__(self, client, prefill = None): self._client = client @@ -54,12 +54,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property @@ -72,12 +72,12 @@ def customer(self, val): """Set customer Keyword argument: val -- New customer value""" - if isinstance(val, Customer): - self._customer = val - else: + if isinstance(val, dict): obj = processout.Customer(self._client) obj.fillWithData(val) self._customer = obj + else: + self._customer = val return self @property @@ -90,12 +90,12 @@ def token(self, val): """Set token Keyword argument: val -- New token value""" - if isinstance(val, Token): - self._token = val - else: + if isinstance(val, dict): obj = processout.Token(self._client) obj.fillWithData(val) self._token = obj + else: + self._token = val return self @property diff --git a/processout/card.py b/processout/card.py index 9fbc7e8..4920005 100755 --- a/processout/card.py +++ b/processout/card.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Card: +class Card(object): def __init__(self, client, prefill = None): self._client = client @@ -54,12 +54,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property diff --git a/processout/coupon.py b/processout/coupon.py index bf01c97..e31997e 100755 --- a/processout/coupon.py +++ b/processout/coupon.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Coupon: +class Coupon(object): def __init__(self, client, prefill = None): self._client = client @@ -54,12 +54,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property diff --git a/processout/customer.py b/processout/customer.py index 1ed8e5e..8089f2e 100755 --- a/processout/customer.py +++ b/processout/customer.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Customer: +class Customer(object): def __init__(self, client, prefill = None): self._client = client @@ -58,12 +58,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property diff --git a/processout/customeraction.py b/processout/customeraction.py index be6e4c0..c260094 100755 --- a/processout/customeraction.py +++ b/processout/customeraction.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class CustomerAction: +class CustomerAction(object): def __init__(self, client, prefill = None): self._client = client diff --git a/processout/discount.py b/processout/discount.py index 895c97c..177915b 100755 --- a/processout/discount.py +++ b/processout/discount.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Discount: +class Discount(object): def __init__(self, client, prefill = None): self._client = client @@ -50,12 +50,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property @@ -68,12 +68,12 @@ def subscription(self, val): """Set subscription Keyword argument: val -- New subscription value""" - if isinstance(val, Subscription): - self._subscription = val - else: + if isinstance(val, dict): obj = processout.Subscription(self._client) obj.fillWithData(val) self._subscription = obj + else: + self._subscription = val return self @property @@ -86,12 +86,12 @@ def coupon(self, val): """Set coupon Keyword argument: val -- New coupon value""" - if isinstance(val, Coupon): - self._coupon = val - else: + if isinstance(val, dict): obj = processout.Coupon(self._client) obj.fillWithData(val) self._coupon = obj + else: + self._coupon = val return self @property diff --git a/processout/event.py b/processout/event.py index a831874..6ece36e 100755 --- a/processout/event.py +++ b/processout/event.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Event: +class Event(object): def __init__(self, client, prefill = None): self._client = client @@ -47,12 +47,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property diff --git a/processout/gateway.py b/processout/gateway.py index 153170a..9f9ec17 100755 --- a/processout/gateway.py +++ b/processout/gateway.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Gateway: +class Gateway(object): def __init__(self, client, prefill = None): self._client = client diff --git a/processout/gatewayconfiguration.py b/processout/gatewayconfiguration.py index 0d27d4d..7165f02 100755 --- a/processout/gatewayconfiguration.py +++ b/processout/gatewayconfiguration.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class GatewayConfiguration: +class GatewayConfiguration(object): def __init__(self, client, prefill = None): self._client = client @@ -46,12 +46,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property @@ -64,12 +64,12 @@ def gateway(self, val): """Set gateway Keyword argument: val -- New gateway value""" - if isinstance(val, Gateway): - self._gateway = val - else: + if isinstance(val, dict): obj = processout.Gateway(self._client) obj.fillWithData(val) self._gateway = obj + else: + self._gateway = val return self @property diff --git a/processout/invoice.py b/processout/invoice.py index 21f3365..0871942 100755 --- a/processout/invoice.py +++ b/processout/invoice.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Invoice: +class Invoice(object): def __init__(self, client, prefill = None): self._client = client @@ -57,12 +57,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property @@ -75,12 +75,12 @@ def transaction(self, val): """Set transaction Keyword argument: val -- New transaction value""" - if isinstance(val, Transaction): - self._transaction = val - else: + if isinstance(val, dict): obj = processout.Transaction(self._client) obj.fillWithData(val) self._transaction = obj + else: + self._transaction = val return self @property @@ -93,12 +93,12 @@ def customer(self, val): """Set customer Keyword argument: val -- New customer value""" - if isinstance(val, Customer): - self._customer = val - else: + if isinstance(val, dict): obj = processout.Customer(self._client) obj.fillWithData(val) self._customer = obj + else: + self._customer = val return self @property @@ -111,12 +111,12 @@ def subscription(self, val): """Set subscription Keyword argument: val -- New subscription value""" - if isinstance(val, Subscription): - self._subscription = val - else: + if isinstance(val, dict): obj = processout.Subscription(self._client) obj.fillWithData(val) self._subscription = obj + else: + self._subscription = val return self @property diff --git a/processout/plan.py b/processout/plan.py index 87a62b1..869c4bc 100755 --- a/processout/plan.py +++ b/processout/plan.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Plan: +class Plan(object): def __init__(self, client, prefill = None): self._client = client @@ -53,12 +53,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property diff --git a/processout/product.py b/processout/product.py index d9dbf16..9acf9d1 100755 --- a/processout/product.py +++ b/processout/product.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Product: +class Product(object): def __init__(self, client, prefill = None): self._client = client @@ -54,12 +54,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property diff --git a/processout/project.py b/processout/project.py index 8029643..a1f692b 100755 --- a/processout/project.py +++ b/processout/project.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Project: +class Project(object): def __init__(self, client, prefill = None): self._client = client diff --git a/processout/refund.py b/processout/refund.py index 5c74d92..2e9d7d9 100755 --- a/processout/refund.py +++ b/processout/refund.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Refund: +class Refund(object): def __init__(self, client, prefill = None): self._client = client @@ -49,12 +49,12 @@ def transaction(self, val): """Set transaction Keyword argument: val -- New transaction value""" - if isinstance(val, Transaction): - self._transaction = val - else: + if isinstance(val, dict): obj = processout.Transaction(self._client) obj.fillWithData(val) self._transaction = obj + else: + self._transaction = val return self @property diff --git a/processout/subscription.py b/processout/subscription.py index dcfb441..97dbda9 100755 --- a/processout/subscription.py +++ b/processout/subscription.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Subscription: +class Subscription(object): def __init__(self, client, prefill = None): self._client = client @@ -65,12 +65,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property @@ -83,12 +83,12 @@ def plan(self, val): """Set plan Keyword argument: val -- New plan value""" - if isinstance(val, Plan): - self._plan = val - else: + if isinstance(val, dict): obj = processout.Plan(self._client) obj.fillWithData(val) self._plan = obj + else: + self._plan = val return self @property @@ -101,12 +101,12 @@ def customer(self, val): """Set customer Keyword argument: val -- New customer value""" - if isinstance(val, Customer): - self._customer = val - else: + if isinstance(val, dict): obj = processout.Customer(self._client) obj.fillWithData(val) self._customer = obj + else: + self._customer = val return self @property @@ -119,12 +119,12 @@ def token(self, val): """Set token Keyword argument: val -- New token value""" - if isinstance(val, Token): - self._token = val - else: + if isinstance(val, dict): obj = processout.Token(self._client) obj.fillWithData(val) self._token = obj + else: + self._token = val return self @property diff --git a/processout/token.py b/processout/token.py index 47398a4..cd37ef8 100755 --- a/processout/token.py +++ b/processout/token.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Token: +class Token(object): def __init__(self, client, prefill = None): self._client = client @@ -47,12 +47,12 @@ def customer(self, val): """Set customer Keyword argument: val -- New customer value""" - if isinstance(val, Customer): - self._customer = val - else: + if isinstance(val, dict): obj = processout.Customer(self._client) obj.fillWithData(val) self._customer = obj + else: + self._customer = val return self @property @@ -65,12 +65,12 @@ def card(self, val): """Set card Keyword argument: val -- New card value""" - if isinstance(val, Card): - self._card = val - else: + if isinstance(val, dict): obj = processout.Card(self._client) obj.fillWithData(val) self._card = obj + else: + self._card = val return self @property diff --git a/processout/transaction.py b/processout/transaction.py index f2ed44e..842db9b 100755 --- a/processout/transaction.py +++ b/processout/transaction.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Transaction: +class Transaction(object): def __init__(self, client, prefill = None): self._client = client @@ -58,12 +58,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property @@ -76,12 +76,12 @@ def customer(self, val): """Set customer Keyword argument: val -- New customer value""" - if isinstance(val, Customer): - self._customer = val - else: + if isinstance(val, dict): obj = processout.Customer(self._client) obj.fillWithData(val) self._customer = obj + else: + self._customer = val return self @property @@ -94,12 +94,12 @@ def subscription(self, val): """Set subscription Keyword argument: val -- New subscription value""" - if isinstance(val, Subscription): - self._subscription = val - else: + if isinstance(val, dict): obj = processout.Subscription(self._client) obj.fillWithData(val) self._subscription = obj + else: + self._subscription = val return self @property @@ -112,12 +112,12 @@ def token(self, val): """Set token Keyword argument: val -- New token value""" - if isinstance(val, Token): - self._token = val - else: + if isinstance(val, dict): obj = processout.Token(self._client) obj.fillWithData(val) self._token = obj + else: + self._token = val return self @property @@ -130,12 +130,12 @@ def card(self, val): """Set card Keyword argument: val -- New card value""" - if isinstance(val, Card): - self._card = val - else: + if isinstance(val, dict): obj = processout.Card(self._client) obj.fillWithData(val) self._card = obj + else: + self._card = val return self @property diff --git a/processout/webhook.py b/processout/webhook.py index a72eef4..dcfabf0 100755 --- a/processout/webhook.py +++ b/processout/webhook.py @@ -10,7 +10,7 @@ # The content of this file was automatically generated -class Webhook: +class Webhook(object): def __init__(self, client, prefill = None): self._client = client @@ -53,12 +53,12 @@ def project(self, val): """Set project Keyword argument: val -- New project value""" - if isinstance(val, Project): - self._project = val - else: + if isinstance(val, dict): obj = processout.Project(self._client) obj.fillWithData(val) self._project = obj + else: + self._project = val return self @property @@ -71,12 +71,12 @@ def event(self, val): """Set event Keyword argument: val -- New event value""" - if isinstance(val, Event): - self._event = val - else: + if isinstance(val, dict): obj = processout.Event(self._client) obj.fillWithData(val) self._event = obj + else: + self._event = val return self @property diff --git a/setup.py b/setup.py index bd894c4..35f6530 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,12 @@ setup( name = 'processout', packages = ['processout', 'processout.errors', 'processout.networking'], - version = '5.0.1', + version = '5.0.2', description = 'ProcessOut API bindings.', author = 'ProcessOut', author_email = 'hi@processout.com', url = 'https://github.com/processout/processout-python', - download_url = 'https://github.com/processout/processout-python/tarball/5.0.1', + download_url = 'https://github.com/processout/processout-python/tarball/5.0.2', keywords = ['ProcessOut', 'api', 'bindings'], classifiers = [], ) diff --git a/spec.py b/spec.py index eb01e36..186173b 100644 --- a/spec.py +++ b/spec.py @@ -32,5 +32,11 @@ def main(argv): }).create(customer.id) assert subscription.id != "", "The created subscription ID should not be empty" -if __name__ == '__main__': + # Expand a customers' project and fetch gateways + customer = client.newCustomer().create({"expand": ["project"]}); + assert customer.project != None, "The customer project should be expanded" + + confs = customer.project.fetchGatewayConfigurations() + +if __name__ == "__main__": main(sys.argv[1:]) \ No newline at end of file