Skip to content
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

using jsonlite to automatically build payloads #155

Merged
merged 7 commits into from
Apr 20, 2020
Merged

using jsonlite to automatically build payloads #155

merged 7 commits into from
Apr 20, 2020

Conversation

jmobrien
Copy link
Collaborator

@jmobrien jmobrien commented Apr 17, 2020

Suggested change--still needs tests written, but thought I'd go ahead and put it in the pipe for review. So far seems to work fine.

  • Uses toJSON from package jsonlite for automated construction of payloads, eliminating the massive manual build using a bunch of ifelses and paste. qualtRics has imported functions from jsonlite for quite a while now, so this doesn't add any new dependencies.

  • purrr::discard drops any null parameters when building, as qualtrics API doesn't like actual json nulls or empty sets.

  • Retains original technique for formattingstart_date and end_date to fit ISO 8601 as expected (https://api.qualtrics.com/docs/dates-and-times). Looking ahead, though, could be easier now to set up more flexible handling of start and end times, useful now that since-last-response request functionality is gone, see last_response still fetches all responses #153.

@juliasilge
Copy link
Collaborator

This is fantastic @jmobrien! Thank you so much. 💯

@juliasilge juliasilge merged commit cd6ec25 into ropensci:master Apr 20, 2020
juliasilge added a commit that referenced this pull request Apr 20, 2020
@jmobrien
Copy link
Collaborator Author

jmobrien commented Apr 20, 2020

Glad it helped. As mentioned above, next steps might be for someone to think about how best to have this tool accept the standard date/time output used by the readr tools we're currently employing in read_survey for formatting csvs and assigning data types to variables.

I played around with it for a bit earlier before submitting but didn't see a standard tool that could do date+time with the "T" separator, and I didn't feel confident about homebrewing something. Plus I wasn't sure how to implement timezones in a way that made the most sense and properly considered implications, if any, of how the useLocal flag was set.

@juliasilge
Copy link
Collaborator

If you want to open an issue with your ideas and any summary of what you tried, we can save that for later.

@jmobrien
Copy link
Collaborator Author

Can't say I spent a ton of time on it, but I'll write a few lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants