Skip to content

Commit 22053e0

Browse files
committed
handling revert
1 parent 760b662 commit 22053e0

File tree

6 files changed

+29
-0
lines changed

6 files changed

+29
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# IDE files
2+
.idea
3+
.vscode
4+
15
# Byte-compiled / optimized / DLL files
26
__pycache__/
37
*.py[cod]

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Links to the Demand API documentation are included for each function.
6262
[Get Project Detailed Report](https://developers.dynata.com/demand-api-reference/core-resources/projects/get-project-detailed-report): get_project_detailed_report(project_id)
6363
[Get Pricing & Feasibility](https://developers.dynata.com/demand-api-reference/core-resources/pricing-feasibility/get-pricing-feasibility): get_feasibility(project_id)
6464
[Get Invoice PDF](https://developers.dynata.com/demand-api-reference/billing_invoicing/invoicing/get-invoices): get_invoice(project_id)
65+
[Get Invoices Summary PDF](https://developers.dynata.com): get_invoices_summary(\*\*kwargs)
6566

6667
### Line Item Functions
6768

dynatademand/api.py

+7
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,13 @@ def get_sources(self):
425425
)
426426
return self._api_get('/sources')
427427

428+
def get_invoices_summary(self, **kwargs):
429+
self.validator.validate_request(
430+
'get_invoices_summary',
431+
query_params=kwargs
432+
)
433+
return self._api_get('/projects/invoices/summary', kwargs)
434+
428435
def reconcile_project(self, project_id, file, message):
429436
'''
430437
Sends a reconciliation request

dynatademand/validator.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
# Invoices
2222
'get_invoice': ['path', ],
23+
'get_invoices_summary': ['query', ],
2324

2425
# Line items
2526
'close_line_item': ['path', ],
165 KB
Binary file not shown.

tests/test_invoices.py

+16
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,19 @@ def test_get_invoice(self):
2727
self.api.get_invoice(1337)
2828
self.assertEqual(len(responses.calls), 1)
2929
self.assertEqual(responses.calls[0].response.headers['content-type'], 'application/pdf')
30+
31+
@responses.activate
32+
def test_get_invoices_summary(self):
33+
with open('./tests/test_files/get_invoices_summary.pdf', 'rb') as summary_file:
34+
responses.add(
35+
responses.GET,
36+
'{}/sample/v1/projects/invoices/summary'.format(BASE_HOST),
37+
body=summary_file.read(),
38+
content_type='application/pdf',
39+
stream=True,
40+
status=200)
41+
self.api.get_invoices_summary(startDate='2019-06-12',
42+
endDate='2019-06-19',
43+
extProjectId='010528ef-8984-48c1-a06d-4dae730da027')
44+
self.assertEqual(len(responses.calls), 1)
45+
self.assertEqual(responses.calls[0].response.headers['content-type'], 'application/pdf')

0 commit comments

Comments
 (0)