MAHDLab / rIP

Detecting Fraud in Online Surveys by Tracing, Scoring, and Visualizing IP Addresses
MIT License
26 stars 4 forks source link

Added discrete API endpoints #6

Closed hrbrmstr closed 5 years ago

hrbrmstr commented 5 years ago

Greetings!

I've added discrete API endpoints for the three services you use so others can use this as a general purpose utility package as well as for the task-specific functionality already provided.

Each endpoint is tied to an environment variable for the secret info (API key or contact info) as encouraging users to hard-code that info into a script is fairly dangerous and not a best practice. This is documented in each function. There are examples for the three discrete API callers but they're wrapped in \donrun{} blocks since they make live API calls and require API keys.

The NAMESPACE file is now auto-generated via {roxygen2} and there is new package-level documentation generated via rIP-package.R which also manages discrete Imports. Given the specification of core package dependencies in the DESCRIPTION file and now automatically in the NAMESPACE file, you really don't need to use requireNamespace(…) calls anymore. I didn't want to modify your core function.

I bumped up the version a full minor point (lots of big but not major changes), added myself to the DESCRIPTION and also added URL and BugReports fields.

NOTE aaa.R now contains an on-load computed package global .RIP_UA which is an httr user_agent object. It's considered best practice to use an identifiable user agent when making API calls so the service provider can track usage and also follow up with any issues they see. It's usable with your core function but I (again) didn't want to touch that bit of code.

I can tweak any component of this PR to fit any desired style guide or operational requirements.

hrbrmstr commented 5 years ago

testthat infra instantiated and three light checks run. I'll try to find a list of consistently "bad" or "known proxy" IPs (part of what I do at work anyway) and get them into more extended tests.

pdwaggoner commented 5 years ago

Sounds good. And if you could add them to the repo in a “tests” folder that’d be great

pdwaggoner commented 5 years ago

Never mind ^^. I didn’t check before commenting. All looks great. Thanks for the contribution! We will push the new version to CRAN shortly.