cpan-testers / cpantesters-api

An API in to data held by CPAN Testers: Test reports and CPAN uploads
Other
4 stars 4 forks source link

Create helper to pull data from remote API #22

Closed preaction closed 6 years ago

preaction commented 6 years ago

It's useful to run the API locally for testing purposes. But, to make useful tests, we need real data to work with.

For example, in order for the backend processes to run, we need the uploads table. It's too onerous to require the user to mirror CPAN and run the upload backend process. To test some backend processes, we would need some rows from the test_reports table.

We should have a command, sync, that syncs data from a remote API server. It should take a URL, which is the API URL to request from the remote. It should make the request, and be able to map the data that comes back from the API into the correct CPAN::Testers::Schema ResultSet class to write to the local database.

The sync command should be in a module CPAN::Testers::API::Command::sync using the Mojolicious::Commands CLI framework.

In the future, we could create a sync --push that could take data in the local database and push it to the remote.

This functionality may be more useful in the CPAN::Testers::Schema project, so it can be shared with all CPAN::Testers projects.

preaction commented 6 years ago

This will be more useful in the CPAN Testers Schema project. Moved it to https://github.com/cpan-testers/cpantesters-schema/issues/20