biostars-api 0.1.3 → 0.1.4

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: 1ba1ddcea8f491e08e5e1b830e213368990fd4de
4
- data.tar.gz: a14247dffbb10069c5b1aaaa28a11dfe2b33c07f
3
+ metadata.gz: 96fd9ae3ed4771bfcb5a241ca3d5c0b028bcdc88
4
+ data.tar.gz: fe29a2a1668be06a183b5e699c14a02c975d8028
5
5
  SHA512:
6
- metadata.gz: 586ac77c6f9aca06b141e7615c1da4db24d23276ade04b4f2d1289cb3fa789f0db6383b1ffceea8b079f1e4076bac9e3ad25fabf96b45bcfefa934933dc8256e
7
- data.tar.gz: eac00ed50f23bdee27aabe090d3bcc2d917df9ef6bb3df4193bb5328d951b11cc9eddecb2d649e9a9711a77374ea8c022b5e2e9a5bb551657a8584aa285867d4
6
+ metadata.gz: 0955537219b6efa2c53d736e5caffc5e961103b55ddcc464554de57ea7aa966930f32b1cfb591dc8eb4785e550b7ca06e742c80a86fa0272ec050e99d931854b
7
+ data.tar.gz: a699bfd2619354db49871556e1eaf6855c8848839d4238661101ef6ed28f28847b120ae60a7a9474f7f3a464c6632d7a7b9b627cd0d400a875ec173f21468d76
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
- # Biostars::Api [![Gem Version](https://badge.fury.io/rb/biostars-api.svg)](http://badge.fury.io/rb/biostars-api) [![Build Status](https://travis-ci.org/arian-amador/biostars-api.svg?style=flat)](https://travis-ci.org/arian-amador/biostars-api) [![Inline docs ](https://inch-ci.org/github/arian-amador/biostars-api.svg?branch=master)](https://inch-ci.org/github/arian-amador/biostars-api)
1
+ # biostars-api
2
2
 
3
- A wrapper for the [Biostars.org](https://www.biostars.org/) public API.
3
+ [![Gem Version](https://badge.fury.io/rb/biostars-api.svg)](http://badge.fury.io/rb/biostars-api) [![Build Status](https://travis-ci.org/arian-amador/biostars-api.svg?style=flat)](https://travis-ci.org/arian-amador/biostars-api) [![Inline docs ](https://inch-ci.org/github/arian-amador/biostars-api.svg?branch=master)](https://inch-ci.org/github/arian-amador/biostars-api)
4
+
5
+ A wrapper for the [biostars.org](https://www.biostars.org/) public API.
6
+
7
+ Biostars focuses on bioinformatics, computational genomics and biological data analysis.
4
8
 
5
9
  ## Requirements
6
10
  * httparty
@@ -50,7 +54,7 @@ latest_votes = latest_info.all_votes
50
54
  ## Documentation
51
55
 
52
56
  * API - https://www.biostars.org/info/api/
53
- * Rubydoc - http://www.rubydoc.info/github/arian-amador/biostars-api/API
57
+ * Rubydoc - http://www.rubydoc.info/github/arian-amador/biostars-api/master
54
58
 
55
59
  ## Contributing
56
60
 
@@ -1,30 +1,20 @@
1
1
  # coding: utf-8
2
- $:.unshift File.expand_path('../lib', __FILE__)
3
- require 'biostars/api/version'
2
+ require File.expand_path('../lib/biostars/api/version', __FILE__)
4
3
 
5
4
  Gem::Specification.new do |spec|
6
5
  spec.name = "biostars-api"
7
6
  spec.version = Biostars::API::VERSION
8
7
  spec.authors = ["Arian Amador"]
9
8
  spec.email = ["arian@arianamador.com"]
10
-
11
- if spec.respond_to?(:metadata)
12
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
13
- end
14
-
15
9
  spec.summary = %q{Gem wrapping biostars.org public API}
16
- spec.description = %q{Gem wrapping biostars.org public API}
10
+ spec.description = spec.description
17
11
  spec.homepage = "https://www.github.com/arian-amador/biostars-api"
18
12
  spec.license = "MIT"
19
-
20
13
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- spec.bindir = "exe"
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
14
  spec.require_paths = ["lib"]
24
15
 
25
16
  spec.add_development_dependency 'bundler', '~> 1.7', '>= 1.7.9'
26
17
  spec.add_development_dependency "rake", "~> 10.0"
27
-
28
18
  spec.add_development_dependency 'minitest', '~> 5.5', '>= 5.5.1'
29
19
  spec.add_development_dependency 'minitest-reporters', '~> 1.0', '>= 1.0.11'
30
20
  spec.add_development_dependency "shoulda-context", '~> 1.2', '>= 1.2.1'
@@ -82,6 +82,8 @@ module Biostars
82
82
 
83
83
  # @return [String] content.
84
84
  attr_reader :xhtml
85
+
86
+ # Instantiate the Biostars::API::Post.
85
87
  def initialize(attributes)
86
88
  attributes.each do |k,v|
87
89
  instance_variable_set("@#{k}", v) unless v.nil?
@@ -39,6 +39,7 @@ module Biostars
39
39
  # @return [Fixnum] total number of votes as of the given day/date.
40
40
  attr_reader :votes
41
41
 
42
+ # Instantiate the Biostars::API::Stats.
42
43
  def initialize(attributes)
43
44
  attributes.each do |k,v|
44
45
  instance_variable_set "@#{k}", v unless v.nil?
@@ -72,54 +73,51 @@ module Biostars
72
73
  end
73
74
  end
74
75
 
75
- class << self
76
-
77
- # Helper method to look up stats for the prior date.
78
- #
79
- # @return [Stats] returns a Stats object.
80
- def latest
81
- find_by_date
82
- end
76
+ # Helper method to look up stats for the prior date.
77
+ #
78
+ # @return [Stats] returns a Stats object.
79
+ def self.latest
80
+ find_by_date
81
+ end
83
82
 
84
- # Statistics as of the Nth day after day-0 (the day of the first ever post).
85
- #
86
- # @param day [Date] number of days after day-0, a number.
87
- # @return [Stats] returns a Stats object.
88
- # @raise [Biostars::StatsError] if the day passed is not a valid Fixnum.
89
- def find_by_day(day=Date.today.day)
90
- raise Biostars::StatsError, "Expecting a Date Object" unless day.is_a? Fixnum
83
+ # Statistics as of the Nth day after day-0 (the day of the first ever post).
84
+ #
85
+ # @param day [Date] number of days after day-0, a number.
86
+ # @return [Stats] returns a Stats object.
87
+ # @raise [Biostars::StatsError] if the day passed is not a valid Fixnum.
88
+ def self.find_by_day(day=Date.today.day)
89
+ raise Biostars::StatsError, "Expecting a Date Object" unless day.is_a? Fixnum
91
90
 
92
- find "stats/day/#{day}"
93
- end
91
+ find "stats/day/#{day}"
92
+ end
94
93
 
95
- # Statistics as of the given date.
96
- #
97
- # @param year [Fixnum] year to search for
98
- # @param month [Fixnum] month to search for
99
- # @param day [Fixnum] day to search for
100
- # @return [Stats] returns a Stats object.
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)
104
-
105
- url = "stats/date/%s/%s/%s" % [
106
- year,
107
- sprintf('%02d', month),
108
- sprintf('%02d', day),
109
- ]
110
-
111
- find url
112
- end
94
+ # Statistics as of the given date.
95
+ #
96
+ # @param year [Fixnum] year to search for
97
+ # @param month [Fixnum] month to search for
98
+ # @param day [Fixnum] day to search for
99
+ # @return [Stats] returns a Stats object.
100
+ # @raise [Biostars::StatsError] if the variables passed are not valid Fixnum
101
+ def self.find_by_date(year=Date.today.year, month=Date.today.month, day=(Date.today.day-1))
102
+ raise Biostars::StatsError unless year.is_a?(Fixnum) || month.is_a?(Fixnum) || day.is_a?(Fixnum)
103
+
104
+ url = "stats/date/%s/%s/%s" % [
105
+ year,
106
+ sprintf('%02d', month),
107
+ sprintf('%02d', day),
108
+ ]
109
+
110
+ find url
111
+ end
113
112
 
114
- private
113
+ private
115
114
 
116
- # Used to call the main HTTParty get but we also don't want anyone
117
- # other that the class methods to call it.
118
- def find(url)
119
- attributes = Biostars::API.get(url)
120
- attributes ? new(attributes) : raise(Biostars::StatsError)
121
- end
122
- end
115
+ # Used to call the main HTTParty get but we also don't want anyone
116
+ # other that the class methods to call it.
117
+ def self.find(url)
118
+ attributes = Biostars::API.get(url)
119
+ attributes ? new(attributes) : raise(Biostars::StatsError)
120
+ end
123
121
  end
124
122
  end
125
123
  end
@@ -14,6 +14,7 @@ module Biostars
14
14
  # @return [Fixnum] current date unix epoch time format.
15
15
  attr_reader :timestamp
16
16
 
17
+ # Instantiate the Biostars::API::Traffic.
17
18
  def initialize(attributes)
18
19
  attributes.each do |k,v|
19
20
  instance_variable_set "@#{k}", v unless v.nil?
@@ -23,6 +23,7 @@ module Biostars
23
23
  # @return [Fixnum] the number of votes given by the user.
24
24
  attr_reader :vote_count
25
25
 
26
+ # Instantiate the Biostars::API::User.
26
27
  def initialize(attributes)
27
28
  attributes.each do |k,v|
28
29
  instance_variable_set "@#{k}", v unless v.nil?
@@ -1,6 +1,6 @@
1
1
  module Biostars
2
2
  module API
3
- # Biostars::API Version
4
- VERSION = "0.1.3"
3
+ # Biostars::API Gem version.
4
+ VERSION = "0.1.4"
5
5
  end
6
6
  end
@@ -26,6 +26,7 @@ module Biostars
26
26
  # @return [Fixnum] type's identifier for this vote.
27
27
  attr_reader :type_id
28
28
 
29
+ # Instantiate the Biostars::API::Vote.
29
30
  def initialize(attributes)
30
31
  attributes.each do |k,v|
31
32
  instance_variable_set "@#{k}", v unless v.nil?
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biostars-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arian Amador
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-02-28 00:00:00.000000000 Z
12
12
  dependencies:
@@ -218,7 +218,7 @@ dependencies:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
220
  version: 1.8.2
221
- description: Gem wrapping biostars.org public API
221
+ description: ''
222
222
  email:
223
223
  - arian@arianamador.com
224
224
  executables: []