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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dcc1371156fdb28a3cfbbf68094ac8b4234f158
4
- data.tar.gz: 1aaf45aec2a61f9146842411e1ffaa9c1c29f1d0
3
+ metadata.gz: 1ba1ddcea8f491e08e5e1b830e213368990fd4de
4
+ data.tar.gz: a14247dffbb10069c5b1aaaa28a11dfe2b33c07f
5
5
  SHA512:
6
- metadata.gz: e796dc7315ec723f6d631b0890a1014d6ddf6aac37b9733416a5b4849d9b0606d6f2b90cdec0ff65d56d5e4582d114c0de5ac11f0739ca1ece6a947504a474a4
7
- data.tar.gz: 5b2787d29bf15756c8b6044c937bf33d1cf6fd117370c2d68e7b6ee65824c9efe12f48386de9a3a0cfa11907456b49427bef4aa4757930d39447f689b2969013
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
@@ -1,5 +1,8 @@
1
1
  module Biostars
2
2
  module API
3
+
4
+ # General info about a post.
5
+ # @author Arian Amador <arian@arianamador.com>
3
6
  class Post
4
7
 
5
8
  # @return [Fixnum] number of answers.
@@ -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 date [Date] Date object for specific date.
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 date passed is not a valid Date.
96
- def find_by_date(date=Date.today-1)
97
- raise Biostars::StatsError unless date.is_a? Date
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
- date.year,
101
- sprintf('%02d', date.month),
102
- sprintf('%02d', date.day),
106
+ year,
107
+ sprintf('%02d', month),
108
+ sprintf('%02d', day),
103
109
  ]
104
110
 
105
111
  find url
@@ -1,5 +1,8 @@
1
1
  module Biostars
2
2
  module API
3
+
4
+ # Number of post views over the last 60 min filtered by unique IPs.
5
+ # @author Arian Amador <arian@arianamador.com>
3
6
  class Traffic
4
7
 
5
8
  # @return [String] the current date, ISO 8601 format.
@@ -1,6 +1,10 @@
1
1
  module Biostars
2
2
  module API
3
+
4
+ # General info about a user.
5
+ # @author Arian Amador <arian@arianamador.com>
3
6
  class User
7
+
4
8
  # @return [String] the date the user joined the website, as the number of days ago
5
9
  attr_reader :date_joined
6
10
 
@@ -1,6 +1,6 @@
1
1
  module Biostars
2
2
  module API
3
3
  # Biostars::API Version
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
6
6
  end
@@ -1,5 +1,8 @@
1
1
  module Biostars
2
2
  module API
3
+
4
+ # General info about a vote.
5
+ # @author Arian Amador <arian@arianamador.com>
3
6
  class Vote
4
7
 
5
8
  # @return [String] author name.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biostars-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arian Amador