newsarchives 0.0.0 → 0.0.1
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/newsarchives.rb +16 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17bf08f74555396d6c74c9f26d70f6129dd81569
|
4
|
+
data.tar.gz: ed128d51ba4ed98dde12ae06e82040c4ff7effdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32c0a2120611b46ff893c1b585feef0d942b7bbb359b8c0e9d5776055743acf5087ba7ed63b109fb2f46a911d3e3310d6fa2d2fc8197e8df439c4e33a70fdd07
|
7
|
+
data.tar.gz: 2623b39d23289118a1931d2e7e1bbd562c79872fac6c986f931c2bf9d881963a9db0914e1bbc14ffaedf01d50cdc59bb25817e4c1eac4cbc4bafd767438cd4c6
|
data/newsarchives.rb
CHANGED
@@ -10,25 +10,23 @@ Github: https://github.com/gadhagod/News-Archives
|
|
10
10
|
require 'net/http'
|
11
11
|
require 'json'
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
13
|
+
def req(endpoint)
|
14
|
+
response = Net::HTTP.get_response(URI.parse('https://newsarchives.herokuapp.com/' + endpoint))
|
15
|
+
return JSON.parse(response.body)
|
16
|
+
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
def month(month)
|
24
|
-
return req('/month/' + month)
|
25
|
-
end
|
26
|
-
def year(year)
|
27
|
-
return req('/year/' + year)
|
28
|
-
end
|
18
|
+
class Time
|
19
|
+
def day(day)
|
20
|
+
return req('/day/' + day)
|
29
21
|
end
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
def month(month)
|
23
|
+
return req('/month/' + month)
|
24
|
+
end
|
25
|
+
def year(year)
|
26
|
+
return req('/year/' + year)
|
33
27
|
end
|
34
28
|
end
|
29
|
+
|
30
|
+
def keyword(keyword)
|
31
|
+
return req('/keyword/' + keyword)
|
32
|
+
end
|