Skip to content

Commit

Permalink
documenting implemented functions
Browse files Browse the repository at this point in the history
  • Loading branch information
wogsland committed Jan 14, 2020
1 parent 75a13ed commit 4cc855d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,31 @@ A Python client library for the [Dynata Cmix API](https://wiki2.criticalmix.net/

## Example Usage

Something here
cmix = CmixAPI(
username="test_username",
password="test_password",
client_id="test_client_id",
client_secret="test_client_secret"
)
cmix.authenticate()
surveys = cmix.get_surveys('closed')

## Supported API Functions

Something here
authenticate(self, \*args, \*\*kwargs)
fetch_banner_filter(self, survey_id, question_a, question_b, response_id)
fetch_raw_results(self, survey_id, payload)
get_surveys(self, status, \*args, \*\*kwargs)
get_survey_definition(self, survey_id)
get_survey_xml(self, survey_id)
get_survey_test_url(self, survey_id)
get_survey_respondents(self, survey_id, respondent_type, live)
get_survey_status(self, survey_id)
get_survey_completes(self, survey_id)
create_export_archive(self, survey_id, export_type)
get_archive_status(self, survey_id, archive_id, layout_id)
update_project(self, project_id, status=None)
create_survey(self, xml_string)

## Contributing

Expand Down
1 change: 0 additions & 1 deletion src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import unicode_literals
import requests
import logging
import os

from .error import CmixError

Expand Down
7 changes: 4 additions & 3 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def test_create_export_archive(self):
'name': 'Default'
}]
mock_get.return_value = mock_response
self.cmix_api.create_export_archive(self.survey_id, 'XLSX_READABLE')
self.assertEqual(1, 1)
response = self.cmix_api.create_export_archive(self.survey_id, 'XLSX_READABLE')
self.assertEqual(response['response'], 1)

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

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

def test_error_if_not_authenticated(self):
self.cmix_api._authentication_headers = None
Expand Down

0 comments on commit 4cc855d

Please sign in to comment.