Skip to content

Commit

Permalink
Added a new class method that will return a Action object by its id a…
Browse files Browse the repository at this point in the history
…nd the droplet ID. #55
  • Loading branch information
koalalorenzo committed Oct 7, 2014
1 parent ce5fb9c commit 7462af4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions digitalocean/Action.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ def __init__(self, *args, **kwargs):

super(Action, self).__init__(*args, **kwargs)

@classmethod
def get_object(cls, api_token, droplet_id, action_id):
"""
Class method that will return a Action object by ID and Droplet ID.
"""
action = cls(token=api_token, droplet_id=droplet_id, id=action_id)
action.load()
return action


def load(self):
action = self.get_data(
"droplets/%s/actions/%s" % (
Expand Down

0 comments on commit 7462af4

Please sign in to comment.