8000 Ensure the `Calls.iter` method filters like the `Calls.list` method. by goodtune · Pull Request #193 · twilio/twilio-python · GitHub
[go: up one dir, main page]

Skip to content

Ensure the Calls.iter method filters like the Calls.list method. #193

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

Merged
merged 3 commits into from
Nov 20, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Ensure the Calls.iter method filters like the Calls.list method.
  • Loading branch information
goodtune committed Nov 20, 2014
commit 840ea843241e8ee20d5884c2e192e30c93f1b314
19 changes: 19 additions & 0 deletions twilio/rest/resources/calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,25 @@ def list(self, from_=None, ended_after=None,
kwargs["EndTime"] = parse_date(ended)
return self.get_instances(kwargs)

@normalize_dates
def iter(self, from_=None, ended_after=None,
ended_before=None, ended=None, started_before=None,
started_after=None, started=None, **kwargs):
"""
Returns an iterator of :class:`Call` resources.

:param date after: Only list calls started after this datetime
:param date before: Only list calls started before this datetime
"""
kwargs["from"] = from_
kwargs["StartTime<"] = started_before
kwargs["StartTime>"] = started_after
kwargs["StartTime"] = parse_date(started)
kwargs["EndTime<"] = ended_before
kwargs["EndTime>"] = ended_after
kwargs["EndTime"] = parse_date(ended)
return super(Calls, self).iter(**kwargs)

def create(self, to, from_, url, status_method=None, **kwargs):
"""
Make a phone call to a number.
Expand Down
0