Exemple #1
0
 def create_chart(self, name, space, **query_props):
     """Create a new chart in space"""
     payload = Chart(self, name).get_payload()
     for k, v in query_props.items():
         payload[k] = v
     resp = self._mexe("spaces/%s/charts" % space.id, method="POST", query_props=payload)
     resp['space_id'] = space.id
     return Chart.from_dict(self, resp)
Exemple #2
0
 def create_chart(self, name, space, **query_props):
     """Create a new chart in space"""
     payload = Chart(self, name).get_payload()
     for k, v in query_props.items():
         payload[k] = v
     resp = self._mexe("spaces/%s/charts" % space.id, method="POST", query_props=payload)
     resp['space_id'] = space.id
     return Chart.from_dict(self, resp)
Exemple #3
0
 def get_chart(self, chart_id, space_or_space_id, **query_props):
     """Get specific chart by ID from Space"""
     space_id = None
     if type(space_or_space_id) is int:
         space_id = space_or_space_id
     elif type(space_or_space_id) is Space:
         space_id = space_or_space_id.id
     else:
         raise ValueError("Space parameter is invalid")
     # TODO: Add better handling around 404s
     resp = self._mexe("spaces/%s/charts/%s" % (space_id, chart_id), method="GET", query_props=query_props)
     resp['space_id'] = space_id
     return Chart.from_dict(self, resp)
Exemple #4
0
 def get_chart(self, chart_id, space_or_space_id, **query_props):
     """Get specific chart by ID from Space"""
     space_id = None
     if type(space_or_space_id) is int:
         space_id = space_or_space_id
     elif type(space_or_space_id) is Space:
         space_id = space_or_space_id.id
     else:
         raise ValueError("Space parameter is invalid")
     # TODO: Add better handling around 404s
     resp = self._mexe("spaces/%s/charts/%s" % (space_id, chart_id), method="GET", query_props=query_props)
     resp['space_id'] = space_id
     return Chart.from_dict(self, resp)