module Biostars::API

API wrapper for www.biostars.org public API @see www.biostars.org/info/api/ @author Arian Amador <arian@arianamador.com>

Constants

API_URL

Used for API requests

VERSION

Biostars::API Gem version.

Public Class Methods

get(url) click to toggle source

Used for general GET http requests to the API

@param url [String] API request endpoint. @return [Hash] returns API response

# File lib/biostars/api.rb, line 41
def self.get(url)
  response = HTTParty.get "#{API_URL}/#{url}"
  response.success? ? JSON.parse(response.body) : false
end
traffic() click to toggle source

Number of post views over the last 60 min filtered by unique IPs.

@return [Traffic] returns a Traffic object. @raise [Biostars::Error] if API is not responding

# File lib/biostars/api.rb, line 32
  def self.traffic
          attributes = Biostars::API.get "traffic"
attributes ? Biostars::API::Traffic.new(attributes) : raise(Biostars::Error)
  end