コード例 #1
0
    def subscription(self, val):
        """Set subscription
        Keyword argument:
        val -- New subscription value"""
        if val is None:
            self._subscription = val
            return self

        if isinstance(val, dict):
            obj = processout.Subscription(self._client)
            obj.fill_with_data(val)
            self._subscription = obj
        else:
            self._subscription = val
        return self
コード例 #2
0
ファイル: customer.py プロジェクト: SMAKSS/processout-python
    def subscriptions(self, val):
        """Set subscriptions
        Keyword argument:
        val -- New subscriptions value"""
        if val is None:
            self._subscriptions = []
            return self

        if len(val) > 0 and isinstance(val[0], processout.Subscription):
            self._subscriptions = val
        else:
            l = []
            for v in val:
                obj = processout.Subscription(self._client)
                obj.fill_with_data(v)
                l.append(obj)
            self._subscriptions = l
        return self
コード例 #3
0
    def find(self, subscription_id, options={}):
        """Find a subscription by its ID.
        Keyword argument:
        subscription_id -- ID of the subscription
        options -- Options for the request"""
        self.fill_with_data(options)

        request = Request(self._client)
        path = "/subscriptions/" + quote_plus(subscription_id) + ""
        data = {}

        response = Response(request.get(path, data, options))
        return_values = []

        body = response.body
        body = body["subscription"]

        obj = processout.Subscription(self._client)
        return_values.append(obj.fill_with_data(body))

        return return_values[0]
コード例 #4
0
ファイル: customer.py プロジェクト: SMAKSS/processout-python
    def fetch_subscriptions(self, options={}):
        """Get the subscriptions belonging to the customer.
        Keyword argument:
        
        options -- Options for the request"""
        self.fill_with_data(options)

        request = Request(self._client)
        path = "/customers/" + quote_plus(self.id) + "/subscriptions"
        data = {}

        response = Response(request.get(path, data, options))
        return_values = []

        a = []
        body = response.body
        for v in body['subscriptions']:
            tmp = processout.Subscription(self._client)
            tmp.fill_with_data(v)
            a.append(tmp)

        return_values.append(a)

        return return_values[0]
コード例 #5
0
    def all(self, options={}):
        """Get all the subscriptions.
        Keyword argument:
        
        options -- Options for the request"""
        self.fill_with_data(options)

        request = Request(self._client)
        path = "/subscriptions"
        data = {}

        response = Response(request.get(path, data, options))
        return_values = []

        a = []
        body = response.body
        for v in body['subscriptions']:
            tmp = processout.Subscription(self._client)
            tmp.fill_with_data(v)
            a.append(tmp)

        return_values.append(a)

        return return_values[0]
コード例 #6
0
ファイル: client.py プロジェクト: SMAKSS/processout-python
 def new_subscription(self, prefill=None):
     """Create a new Subscription instance
     Keyword argument:
     prefill -- Data used to prefill the object (optional)"""
     return processout.Subscription(self, prefill)