folding_at_home_client
Ruby client for the Folding@home API
Need more historical data? Try out extreme_overclocking_client
Getting Started
Install and add to Gemfile:
bundle add folding_at_home_client
Install without bundler:
gem install folding_at_home_client
Usage
Users
FoldingAtHomeClient::Users.count
FoldingAtHomeClient::Users.top
FoldingAtHomeClient::Users.top(month: 1, year: 2018)
FoldingAtHomeClient::Users.daily
FoldingAtHomeClient::Users.daily(sort_by: :name, order: :desc)
FoldingAtHomeClient::Users.daily(limit: 5)
FoldingAtHomeClient::Users.daily(page: 1, per_page: 5)
FoldingAtHomeClient::Users.daily(name: 'Anonymous')
FoldingAtHomeClient::Users.daily(team_id: 0)
FoldingAtHomeClient::Users.daily(name: 'Anonymous', team_id: 0)
FoldingAtHomeClient::Users.daily(position: 10)
FoldingAtHomeClient::Users.daily(filepath: 'my_daily_user_summary.txt')
User
id = 2
name = "name"
passkey = "passkey"
team_id = 0
user = FoldingAtHomeClient::User.new(id: id)
user = FoldingAtHomeClient::User.new(name: name)
user = FoldingAtHomeClient::User.new(id: id, name: name)
user = user.find_by(id: id)
user = user.find_by(name: name)
user = user.find_by(id: id, name: name)
user = user.find_by(id: id, passkey: passkey)
user = user.find_by(id: id, team_id: team_id)
user = user.find_by(id: id, passkey: passkey, team_id: team_id)
teams = user.teams_lookup
teams = user.teams_lookup(passkey: passkey)
projects = user.projects
bonuses = user.bonuses
bonuses = user.bonuses(passkey: passkey)
Teams
FoldingAtHomeClient::Teams.count
FoldingAtHomeClient::Teams.top(month: 1, year: 2018)
Team
id = 1
team = FoldingAtHomeClient::Team.find_by(id: id)
members = FoldingAtHomeClient::Team.new(id: id).members
Projects
FoldingAtHomeClient::Projects.all
Project
id = 2968
project = FoldingAtHomeClient::Project.new(id: id)
project = project.lookup
contributors = project.contributors
description = project.description
Descriptions
descriptions = FoldingAtHomeClient::Descriptions.all
Description
id = 195
description = FoldingAtHomeClient::Description.new(id: id).lookup
Managers
managers = FoldingAtHomeClient::Managers.all
Manager
id = 326
manager = FoldingAtHomeClient::Manager.new(id: id).lookup
Causes
causes = FoldingAtHomeClient::Causes.all
GPUs
gpus = FoldingAtHomeClient::GPUs.all
GPU
vendor = 4318
device = 5
gpu = FoldingAtHomeClient::GPU.find_by(vendor: vendor, device: device)
Notes
Currently only GET
endpoints are supported. It's not exhaustive because some endpoints aren't particularly useful in terms of what they return compared to other endpoints.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports, feature requests, and pull requests are welcome.
Links