コード例 #1
0
ファイル: app.py プロジェクト: dmwesterhoff/givingtree-api
class EventTransactionViewSet(Resource):
    def __init__(self):
        self.requests = TransactionRequests()

    def get(self, id):
        return {'status':'success',
                'data':self.requests.transactions()}
コード例 #2
0
ファイル: app.py プロジェクト: dmwesterhoff/givingtree-api
class UserTransactionViewSet(Resource):
    def __init__(self):
        self.requests = TransactionRequests()

    def get(self, id):
        transactions = []
        for transaction in self.requests.transactions():
            transactions.append(transaction)

        return {'status':'success',
                'data':transactions}
コード例 #3
0
ファイル: app.py プロジェクト: dmwesterhoff/givingtree-api
class TransactionViewSet(Resource):
    def __init__(self):
        self.requests = TransactionRequests()

    def get(self):
        return {'status':'success','data':self.requests.transactions()}

    def post(self):
        _to_user = request.form['to_user']
        _from_user = request.form['from_user']
        _event = request.form['event']
        _amount = request.form['amount']
        _timestamp = request.form['timestamp']
        _note = request.form['note']
        return {'status':'success',
                'data': Transaction.create(to_user=_to_user,
                                  from_user=_from_user,
                                  event=_event,
                                  amount=_amount,
                                  timestamp=_timestamp,
                                  note=_note).dict() }

    def delete(self):
        return {'status':'success'}
コード例 #4
0
print '----- User request tests -----'
user_requests = UserRequests()
user = user_requests.user_with_email('*****@*****.**')
print user
print

print '----- Address request tests -----'
address_requests = AddressRequests()
address = address_requests.address_with_id(1)
print address
print

print '----- Account request tests -----'
account_requests = AccountRequests()
account = account_requests.account_with_id(1)
print account
print

print '----- Event request tests -----'
event_requests = EventRequests()
event = event_requests.event_with_id(1)
print event
print

print '----- Transaction request tests -----'
transaction_requests = TransactionRequests()
transaction = transaction_requests.transaction_with_id(1)
print transaction
print

コード例 #5
0
ファイル: app.py プロジェクト: dmwesterhoff/givingtree-api
 def __init__(self):
     self.requests = TransactionRequests()