Last active
March 26, 2020 16:09
-
-
Save onedebos/fa4b56cda0d9243c996776f3f3775ad4 to your computer and use it in GitHub Desktop.
Seed file for the CoronaQL tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
Summaries.create(id:1) | |
def get_countries | |
country_names = [] | |
base_url = "https://corona.lmao.ninja/countries" | |
request = HTTParty.get(base_url).body | |
response = JSON.parse(request) | |
response.each_with_index do |c, i| | |
country_name = response[i]["country"] | |
Country.create(country_name: country_name) | |
end | |
end | |
get_countries |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment