Last active
March 26, 2020 15:57
-
-
Save onedebos/604ce086ad9f7ccc960fab0b5112bf1f to your computer and use it in GitHub Desktop.
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
module Types | |
class SummaryType < Types::BaseObject | |
field :total_cases, Integer, null: false | |
field :total_deaths, Integer, null: false | |
field :total_recovered, Integer, null: false | |
def request | |
base_url = "https://corona.lmao.ninja/all" | |
request = HTTParty.get(base_url).body | |
response = JSON.parse(request) | |
end | |
def total_cases | |
request["cases"] | |
end | |
def total_deaths | |
request["deaths"] | |
end | |
def total_recovered | |
request["recovered"] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment