def create(self, resource, debug=False): request = Request() path = 'api/{username}/scenes'.format(username=self.user['name']) url = 'http://{bridge_ip}/{path}'.format(bridge_ip=self.bridge['ip'], path=path) resource['data']['name'] = resource['which'] status, content = request.post(url, resource['data']) if debug: return dict(info=status, resource=content) else: return dict(resource=content)
def create(self, resource, debug=False): """ """ request = Request() url = 'http://{bridge_ip}/api'.format(bridge_ip=self.bridge['ip']) if 'user' in resource: resource['user']['username'] = resource['user'].pop('name') status, content = request.post(url, resource['user']) if debug: return dict(info=status, resource=content) else: return dict(resource=content)
def create(self, resource, debug=False): """ """ request = Request() path = "api/{username}/schedules".format(username=self.user["name"]) url = "http://{bridge_ip}/{path}".format(bridge_ip=self.bridge["ip"], path=path) resource["data"]["name"] = resource["which"] status, content = request.post(url, resource["data"]) if debug: return dict(info=status, resource=content) else: return dict(resource=content)
def create(self, resource, debug=False): """ """ request = Request() url = 'http://{bridge_ip}/api'.format(bridge_ip=self.bridge['ip']) if resource.has_key('user'): resource['user']['username'] = resource['user'].pop('name') status, content = request.post(url, resource['user']) if debug: return dict(info=status, resource=content) else: return dict(resource=content)
def find(self, resource, debug=False): """ @summary: Search for new lights. """ request = Request() services = {'new': {'service': 'lights'}} service = services[resource['which']]['service'] path = 'api/{username}/{service}'.format(username=self.user['name'], service=service) url = 'http://{bridge_ip}/{path}'.format(bridge_ip=self.bridge['ip'], path=path) status, content = request.post(url) if debug: return dict(info=status, resource=content) else: return dict(resource=content)
def find(self, resource, debug=False): """ @summary: Search for new lights. """ request = Request() services = { 'new':{'service':'lights'} } service = services[resource['which']]['service'] path = 'api/{username}/{service}'.format( username=self.user['name'], service=service ) url = 'http://{bridge_ip}/{path}'.format(bridge_ip=self.bridge['ip'], path=path) status, content = request.post(url) if debug: return dict(info=status, resource=content) else: return dict(resource=content)