TODO: Add import from live API to help developers
jwo opened this issue · 2 comments
jwo commented
We used to be able to run rails google:import
and get a full local database, but we'll get out of that business soon as #16 and #17 land
So, let's create a rake task:
- Pulls all needs from api.harveyneeds.org/api/v1/needs and then creates local needs
- Pulls all shelters from api.harveyneeds.org/api/v1/shelters and then creates local shelters
Something like this with the http
gem
Http.get("https://api.harveyneeds.org/api/v1/needs").body.to_json["needs"].each do |need|
Need.create! need
end
nihonjinrxs commented
If no one else has picked this one up, I can tackle it.
nihonjinrxs commented
I was doing this in an additive way, with the API method as default. After we confirmed the import works as expected, I was going to tear out the Google Sheets version.
Per discussion with @jwo on Slack, will instead replace the Google Sheets imports with API-based ones.