Skip to content

Commit 4cc855d

Browse files
committed
documenting implemented functions
1 parent 75a13ed commit 4cc855d

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,31 @@ A Python client library for the [Dynata Cmix API](https://wiki2.criticalmix.net/
1010

1111
## Example Usage
1212

13-
Something here
13+
cmix = CmixAPI(
14+
username="test_username",
15+
password="test_password",
16+
client_id="test_client_id",
17+
client_secret="test_client_secret"
18+
)
19+
cmix.authenticate()
20+
surveys = cmix.get_surveys('closed')
1421

1522
## Supported API Functions
1623

17-
Something here
24+
authenticate(self, \*args, \*\*kwargs)
25+
fetch_banner_filter(self, survey_id, question_a, question_b, response_id)
26+
fetch_raw_results(self, survey_id, payload)
27+
get_surveys(self, status, \*args, \*\*kwargs)
28+
get_survey_definition(self, survey_id)
29+
get_survey_xml(self, survey_id)
30+
get_survey_test_url(self, survey_id)
31+
get_survey_respondents(self, survey_id, respondent_type, live)
32+
get_survey_status(self, survey_id)
33+
get_survey_completes(self, survey_id)
34+
create_export_archive(self, survey_id, export_type)
35+
get_archive_status(self, survey_id, archive_id, layout_id)
36+
update_project(self, project_id, status=None)
37+
create_survey(self, xml_string)
1838

1939
## Contributing
2040

src/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from __future__ import unicode_literals
33
import requests
44
import logging
5-
import os
65

76
from .error import CmixError
87

tests/test_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def test_create_export_archive(self):
6868
'name': 'Default'
6969
}]
7070
mock_get.return_value = mock_response
71-
self.cmix_api.create_export_archive(self.survey_id, 'XLSX_READABLE')
72-
self.assertEqual(1, 1)
71+
response = self.cmix_api.create_export_archive(self.survey_id, 'XLSX_READABLE')
72+
self.assertEqual(response['response'], 1)
7373

7474
def test_create_export_archive_errors_handled(self):
7575
with mock.patch('src.api.requests.post') as mock_post:
@@ -255,7 +255,8 @@ def test_get_archive_status(self):
255255

256256
mock_request.return_value = mock_response
257257
response = self.cmix_api.get_archive_status(survey_id, archive_id, layout_id)
258-
self.assertEqual(1, 1)
258+
self.assertEqual(response['status'], 'COMPLETE')
259+
self.assertEqual(response['archiveUrl'], 'http://popresearch.com/')
259260

260261
def test_error_if_not_authenticated(self):
261262
self.cmix_api._authentication_headers = None

0 commit comments

Comments
 (0)