Skip to content

Instantly share code, notes, and snippets.

@johnsheehan
Created March 31, 2012 22:13
Show Gist options
  • Save johnsheehan/2269030 to your computer and use it in GitHub Desktop.
Save johnsheehan/2269030 to your computer and use it in GitHub Desktop.
class Command:
m = ''
r = ''
resources = {
'promo-codes' : {
'POST' : post_promo_code,
'DELETE' : delete_promo_code
},
'approved-jobs' : {
'POST' : post_approved_jobs
},
'unapproved-jobs' : {
'POST' : post_unapproved_jobs
}
}
def __init__(self, method, resource):
self.m = method
self.r = resource
def execute(self, data):
return self.resources[self.r][self.m](data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment