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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee2d8bc102232e841985b142165365c27415095ae57424d7eee3e9cb50373d99
4
- data.tar.gz: 452907cd143de3d6c7b844d3af9e87cc6751cc4d6f067f9e8fc347a87ab2e1b4
3
+ metadata.gz: 2a1b448d1d0d601301a82efc26af4ccc82f9bbcda85eed5db3c300b21f107f1d
4
+ data.tar.gz: 35ec0eaea939d9a8356457fcc61d526fdcb1a05f9d619c4f870f061a2c4b1bfc
5
5
  SHA512:
6
- metadata.gz: d5664e2a8069a580f86110ab38cf6ca270525fd44b2ced720aa779ddac36cd0dfe23277e02f1665a5264615af76702641f982ca9ffdf65b29869616a79420cb1
7
- data.tar.gz: 7221b387c95c696c3ca46e30d8958b5608547b816e9f3b2a537f2c56d8a16fe3edf448f963bab03d4d33b753d961137ba0a888ddbb0bd42067cf1d67d0fee637
6
+ metadata.gz: e9596f84dce018376f96c436c416fea1deeffdddae598b7baa7e4c8cf5158ae188ff73e41b84bea5471f5f5112be593981532571b008051f46b2db263c77d2a9
7
+ data.tar.gz: 6c2eb705c13be68c57eb26bacaca0446d8ed85c54017e61ee09d9bf155b0dfb1aa94fee675176a6066d2e8b4517f8855b52988f38ab5db62d6cab969c43fbfc2
@@ -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 get_latest
9
- uri = URI(BASE_URL + 'latest')
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 + 'locations')
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=false)
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
 
@@ -1,3 +1,3 @@
1
1
  module Covid19DataRuby
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
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.1
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-03-19 00:00:00.000000000 Z
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: