-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding documentation and object to 'create' function. #56
Changes from 10 commits
f558da3
ded0b9e
d6c6b76
c676039
36d6fe5
21e0daf
86e2a19
025320a
b9112ab
fba343e
52916d8
6de014c
767480b
4454fdf
c0d2fe2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,27 @@ def create(self, **kwargs): | |
if "requester_id" in kwargs: | ||
extra_headers["From"] = kwargs.pop("requester_id") | ||
|
||
data[self.sname] = kwargs | ||
new_kwargs = {} | ||
|
||
for kwarg_key, kwarg_value in kwargs.iteritems(): | ||
if kwarg_key.endswith('_id'): | ||
new_key = kwarg_key[:-3] | ||
new_kwargs[new_key] = { | ||
'id': kwarg_value, | ||
'type': new_key | ||
} | ||
elif kwarg_key.endswith('_ids'): | ||
new_key = kwarg_key[:-3] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we need to go from |
||
new_kwargs = [] | ||
for value in kwarg_value: | ||
new_kwarg = { | ||
'id': value, | ||
'type': new_key | ||
} | ||
new_kwargs.append(new_kwarg) | ||
else: | ||
new_kwargs[kwarg_key] = kwarg_value | ||
data[self.sname] = new_kwargs | ||
|
||
response = self.pagerduty.request("POST", path, data=_json_dumper(data), extra_headers=extra_headers) | ||
return self.container(self, **response.get(self.sname, {})) | ||
|
@@ -268,6 +288,9 @@ def update(self, entity_id, **kwargs): | |
|
||
|
||
class ScheduleUsers(Collection): | ||
"""This class exists because Users returned from a Schedule query are not | ||
paginated, whereas responses for Users class are. This causes a pagination | ||
bug if removed.""" | ||
name = 'users' | ||
paginated = False | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe if it ends in
_ids
it will be a list of ids["ID1", "ID2"]
that needs to be translated to a list of objectsThis seems to be doing the same thing as
_id