biostars-api 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/biostars/api.rb +7 -0
- data/lib/biostars/api/post.rb +3 -0
- data/lib/biostars/api/stats.rb +13 -7
- data/lib/biostars/api/traffic.rb +3 -0
- data/lib/biostars/api/user.rb +4 -0
- data/lib/biostars/api/version.rb +1 -1
- data/lib/biostars/api/vote.rb +3 -0
- 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: 1ba1ddcea8f491e08e5e1b830e213368990fd4de
|
4
|
+
data.tar.gz: a14247dffbb10069c5b1aaaa28a11dfe2b33c07f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 586ac77c6f9aca06b141e7615c1da4db24d23276ade04b4f2d1289cb3fa789f0db6383b1ffceea8b079f1e4076bac9e3ad25fabf96b45bcfefa934933dc8256e
|
7
|
+
data.tar.gz: eac00ed50f23bdee27aabe090d3bcc2d917df9ef6bb3df4193bb5328d951b11cc9eddecb2d649e9a9711a77374ea8c022b5e2e9a5bb551657a8584aa285867d4
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ latest_votes = latest_info.all_votes
|
|
50
50
|
## Documentation
|
51
51
|
|
52
52
|
* API - https://www.biostars.org/info/api/
|
53
|
-
* Rubydoc - http://www.rubydoc.info/github/arian-amador/biostars-api
|
53
|
+
* Rubydoc - http://www.rubydoc.info/github/arian-amador/biostars-api/API
|
54
54
|
|
55
55
|
## Contributing
|
56
56
|
|
data/lib/biostars/api.rb
CHANGED
@@ -12,7 +12,14 @@ require "api/user"
|
|
12
12
|
require "api/post"
|
13
13
|
require "api/vote"
|
14
14
|
|
15
|
+
# API wrapper for https://www.biostars.org public API
|
16
|
+
# @see https://www.biostars.org/info/api/
|
17
|
+
# @author Arian Amador <arian@arianamador.com>
|
15
18
|
module Biostars
|
19
|
+
|
20
|
+
# API wrapper for https://www.biostars.org public API
|
21
|
+
# @see https://www.biostars.org/info/api/
|
22
|
+
# @author Arian Amador <arian@arianamador.com>
|
16
23
|
module API
|
17
24
|
|
18
25
|
# Used for API requests
|
data/lib/biostars/api/post.rb
CHANGED
data/lib/biostars/api/stats.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
module Biostars
|
2
2
|
module API
|
3
|
+
|
4
|
+
# Statistics as of the Nth day after day-0 (the day of the first ever post) or
|
5
|
+
# statistics as of the given date.
|
6
|
+
# @author Arian Amador <arian@arianamador.com>
|
3
7
|
class Stats
|
4
8
|
|
5
9
|
# @return [Fixnum] total number of answers as of the given day/date.
|
@@ -90,16 +94,18 @@ module Biostars
|
|
90
94
|
|
91
95
|
# Statistics as of the given date.
|
92
96
|
#
|
93
|
-
# @param
|
97
|
+
# @param year [Fixnum] year to search for
|
98
|
+
# @param month [Fixnum] month to search for
|
99
|
+
# @param day [Fixnum] day to search for
|
94
100
|
# @return [Stats] returns a Stats object.
|
95
|
-
# @raise [Biostars::StatsError] if the
|
96
|
-
def find_by_date(
|
97
|
-
raise Biostars::StatsError unless
|
101
|
+
# @raise [Biostars::StatsError] if the variables passed are not valid Fixnum
|
102
|
+
def find_by_date(year=Date.today.year, month=Date.today.month, day=(Date.today.day-1))
|
103
|
+
raise Biostars::StatsError unless year.is_a?(Fixnum) || month.is_a?(Fixnum) || day.is_a?(Fixnum)
|
98
104
|
|
99
105
|
url = "stats/date/%s/%s/%s" % [
|
100
|
-
|
101
|
-
sprintf('%02d',
|
102
|
-
sprintf('%02d',
|
106
|
+
year,
|
107
|
+
sprintf('%02d', month),
|
108
|
+
sprintf('%02d', day),
|
103
109
|
]
|
104
110
|
|
105
111
|
find url
|
data/lib/biostars/api/traffic.rb
CHANGED
data/lib/biostars/api/user.rb
CHANGED
data/lib/biostars/api/version.rb
CHANGED
data/lib/biostars/api/vote.rb
CHANGED