Skip to content

Commit db0b1b1

Browse files
authored
Merge pull request #54 from dynata/dev
feature-summary
2 parents cff72b2 + 744e6d9 commit db0b1b1

File tree

7 files changed

+46
-0
lines changed

7 files changed

+46
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"startDate": {
5+
"type": "string",
6+
"description": "The format is YY-MM-DD"
7+
},
8+
"endDate": {
9+
"type": "string",
10+
"description": "The format is YY-MM-DD"
11+
},
12+
"extProjectId": {
13+
"type": "string"
14+
}
15+
},
16+
"required": []
17+
}

dynatademand/validator.py

Lines changed: 1 addition & 0 deletions
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

Lines changed: 16 additions & 0 deletions
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)