class AddressViewSet(Resource): def __init__(self): self.requests = AddressRequests() def get(self): return {'status':'success','data':self.requests.addresses()} def post(self): _line1 = request.form['line1'] _line2 = request.form['line2'] _city = request.form['city'] _postal_code = request.form['postal_code'] _state = request.form['state'] _country = request.form['country'] return {'status':'success', 'data': Address.create(line1=_line1, line2=_line2, city=_city, postal_code=_postal_code, state=_state, country=_country).dict() } def delete(self): return {'status':'success'}
from requests.userrequests import UserRequests from requests.addressrequests import AddressRequests from requests.accountrequests import AccountRequests from requests.eventrequests import EventRequests from requests.transactionrequests import TransactionRequests 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 -----'
def __init__(self): self.requests = AddressRequests()