covid19_data_ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ee2d8bc102232e841985b142165365c27415095ae57424d7eee3e9cb50373d99
4
+ data.tar.gz: 452907cd143de3d6c7b844d3af9e87cc6751cc4d6f067f9e8fc347a87ab2e1b4
5
+ SHA512:
6
+ metadata.gz: d5664e2a8069a580f86110ab38cf6ca270525fd44b2ced720aa779ddac36cd0dfe23277e02f1665a5264615af76702641f982ca9ffdf65b29869616a79420cb1
7
+ data.tar.gz: 7221b387c95c696c3ca46e30d8958b5608547b816e9f3b2a537f2c56d8a16fe3edf448f963bab03d4d33b753d961137ba0a888ddbb0bd42067cf1d67d0fee637
@@ -0,0 +1,3 @@
1
+ module Covid19DataRuby
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,36 @@
1
+ require 'json'
2
+ require 'net/http'
3
+
4
+ class Covid19Data
5
+ BASE_URL = 'https://coronavirus-tracker-api.herokuapp.com/v2/'
6
+
7
+ class << self
8
+ def get_latest
9
+ uri = URI(BASE_URL + 'latest')
10
+ get_json_data(uri)
11
+ end
12
+
13
+ def get_all_locations
14
+ uri = URI(BASE_URL + 'locations')
15
+ get_json_data(uri)
16
+ end
17
+
18
+ def find_by_country_code(country_code, with_timelines=false)
19
+ timelines = with_timelines ? '&timelines=true' : ''
20
+ uri = URI("#{BASE_URL}locations?country_code=#{country_code.upcase}#{timelines}")
21
+ get_json_data(uri)
22
+ end
23
+
24
+ def find_by_location(id)
25
+ uri = URI("#{BASE_URL}locations/#{id}")
26
+ get_json_data(uri)
27
+ end
28
+
29
+ private
30
+
31
+ def get_json_data(uri)
32
+ response = Net::HTTP.get(uri)
33
+ JSON.parse(response)
34
+ end
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: covid19_data_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jillian Somera
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A Ruby wrapper for the coronavirus API at https://github.com/ExpDev07/coronavirus-tracker-api
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/covid19_data_ruby.rb
20
+ - lib/covid19_data_ruby/version.rb
21
+ homepage: https://github.com/jaerodyne/covid19-data-ruby
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.1.2
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: This is Covid19Data
44
+ test_files: []