Skip to content

Instantly share code, notes, and snippets.

@onedebos
Last active March 26, 2020 16:09
Show Gist options
  • Save onedebos/fa4b56cda0d9243c996776f3f3775ad4 to your computer and use it in GitHub Desktop.
Save onedebos/fa4b56cda0d9243c996776f3f3775ad4 to your computer and use it in GitHub Desktop.
Seed file for the CoronaQL tutorial
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