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

        if isinstance(val, dict):
            obj = processout.Card(self._client)
            obj.fill_with_data(val)
            self._card = obj
        else:
            self._card = val
        return self
コード例 #2
0
ファイル: card.py プロジェクト: SMAKSS/processout-python
    def find(self, card_id, options={}):
        """Find a card by its ID.
        Keyword argument:
        card_id -- ID of the card
        options -- Options for the request"""
        self.fill_with_data(options)

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

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

        body = response.body
        body = body["card"]

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

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

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

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

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

        return_values.append(a)

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