newsarchives 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/newsarchives.rb +34 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7f72d5451c589b8202ac179e3e583351b7c0c909
4
+ data.tar.gz: a35e87361362e352f0252d495f6dea0c3446eaee
5
+ SHA512:
6
+ metadata.gz: 571fd1282128068126a8a809d8afa3e2774c53c55165dafec8c2dc97fff5e4924c187778a088a715fbbbfe753c3a79219aa47a4a8ae64becf2a5a054f2121f33
7
+ data.tar.gz: 51bd1d4cca962ef44688b11b6bcd9ef788c8c91b56df57445a68737325a11548130253edc9625dc44926a88eb8dbb7fdb5d09938e35cd30e26d6305c137c58e2
@@ -0,0 +1,34 @@
1
+ '
2
+ newsarchives
3
+ The official ruby client library for the News Archives API.
4
+ By Aarav Borthakur
5
+
6
+ Docs: https://gadhagod.github.io/News-Archives
7
+ Github: https://github.com/gadhagod/News-Archives
8
+ '
9
+
10
+ require 'net/http'
11
+ require 'json'
12
+
13
+ class NewsArchives
14
+ def req(endpoint)
15
+ response = Net::HTTP.get_response(URI.parse('https://newsarchives.herokuapp.com/' + endpoint))
16
+ return JSON.parse(response.body)
17
+ end
18
+
19
+ class Time
20
+ def day(day)
21
+ return req('/day/' + day)
22
+ end
23
+ def month(month)
24
+ return req('/month/' + month)
25
+ end
26
+ def year(year)
27
+ return req('/year/' + year)
28
+ end
29
+ end
30
+
31
+ def keyword(keyword)
32
+ return req('/keyword/' + keyword)
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: newsarchives
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Aarav Borthakur
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-11-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'Documentation: https://gadhagod.github.io/News-Archives'
14
+ email: gadhaguy13@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - newsarchives.rb
20
+ homepage: https://gadhagod.github.io/News-Archives
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.2.3
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: The official ruby client library for the News Archives API.
44
+ test_files: []