covid19_data_ruby 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/covid19_data_ruby.rb +15 -9
- data/lib/covid19_data_ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a1b448d1d0d601301a82efc26af4ccc82f9bbcda85eed5db3c300b21f107f1d
|
4
|
+
data.tar.gz: 35ec0eaea939d9a8356457fcc61d526fdcb1a05f9d619c4f870f061a2c4b1bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9596f84dce018376f96c436c416fea1deeffdddae598b7baa7e4c8cf5158ae188ff73e41b84bea5471f5f5112be593981532571b008051f46b2db263c77d2a9
|
7
|
+
data.tar.gz: 6c2eb705c13be68c57eb26bacaca0446d8ed85c54017e61ee09d9bf155b0dfb1aa94fee675176a6066d2e8b4517f8855b52988f38ab5db62d6cab969c43fbfc2
|
data/lib/covid19_data_ruby.rb
CHANGED
@@ -2,27 +2,33 @@ require 'json'
|
|
2
2
|
require 'net/http'
|
3
3
|
|
4
4
|
class Covid19Data
|
5
|
-
BASE_URL = 'https://coronavirus-tracker-api.herokuapp.com/v2/'
|
5
|
+
BASE_URL = 'https://coronavirus-tracker-api.herokuapp.com/v2/'.freeze
|
6
|
+
DEFAULT_SOURCE = 'jhu'.freeze
|
6
7
|
|
7
8
|
class << self
|
8
|
-
def
|
9
|
-
uri = URI(BASE_URL
|
9
|
+
def get_sources
|
10
|
+
uri = URI("#{BASE_URL}sources")
|
11
|
+
get_json_data(uri)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_latest(source: DEFAULT_SOURCE)
|
15
|
+
uri = URI("#{BASE_URL}latest?source=#{source}")
|
10
16
|
get_json_data(uri)
|
11
17
|
end
|
12
18
|
|
13
|
-
def get_all_locations
|
14
|
-
uri = URI(BASE_URL
|
19
|
+
def get_all_locations(source: DEFAULT_SOURCE)
|
20
|
+
uri = URI("#{BASE_URL}locations?source=#{source}")
|
15
21
|
get_json_data(uri)
|
16
22
|
end
|
17
23
|
|
18
|
-
def find_by_country_code(country_code, with_timelines
|
24
|
+
def find_by_country_code(country_code, with_timelines: false, source: DEFAULT_SOURCE)
|
19
25
|
timelines = with_timelines ? '&timelines=true' : ''
|
20
|
-
uri = URI("#{BASE_URL}locations?country_code=#{country_code.upcase}#{timelines}")
|
26
|
+
uri = URI("#{BASE_URL}locations?country_code=#{country_code.upcase}#{timelines}&source=#{source}")
|
21
27
|
get_json_data(uri)
|
22
28
|
end
|
23
29
|
|
24
|
-
def find_by_location(id)
|
25
|
-
uri = URI("#{BASE_URL}locations/#{id}")
|
30
|
+
def find_by_location(id, source: DEFAULT_SOURCE)
|
31
|
+
uri = URI("#{BASE_URL}locations/#{id}?source=#{source}")
|
26
32
|
get_json_data(uri)
|
27
33
|
end
|
28
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: covid19_data_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jillian Somera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Ruby wrapper for the coronavirus API at https://github.com/ExpDev07/coronavirus-tracker-api
|
14
14
|
email:
|