Use model to update service properties

We have a lot of places in settings where we update something by passing
in the `service_id`. `current_service` already knows about `service_id`,
so it’s cleaner to encapsulate these updates inside the model.
This commit is contained in:
Chris Hill-Scott
2018-11-05 16:03:11 +00:00
parent 2286c19aa5
commit a69551b2cb
2 changed files with 19 additions and 23 deletions

View File

@@ -47,6 +47,12 @@ class Service():
return self._dict[attr]
raise AttributeError('`{}` is not a service attribute'.format(attr))
def update(self, **kwargs):
return service_api_client.update_service(self.id, **kwargs)
def update_with_properties(self, properties):
return service_api_client.update_service_with_properties(self.id, properties)
@property
def trial_mode(self):
return self._dict['restricted']