Altmetric Badger
Badger turns data into badges!
A small gem which can generate an Altmetric badge URI from a hash of post types and a score.
NOTE: ALTMETRIC BADGER IS NO LONGER UNDER ACTIVE DEVELOPMENT.
If you're interested in maintaining Altmetric Badger, please get in touch via GitHub.
Usage
gem install altmetric_badger
AltmetricBadger.new(
score: 123,
data: {
'twitter' => 100,
'facebook' => 100
}
).to_donut_uri(svg: true)
# => #<URI::HTTPS:0x007f8641ea75f8 URL:https://altmetric-badges.a.ssl.fastly.net/?style=donut&score=123&types=ttttffff&size=640&svg>Pretty simple. Available methods are:
#to_donut_uri
#to_bar_uri
#to_pie_uri
#to_helix_uri
And available parameters:
size: (Integer)
svg: (Boolean)
show_score: (Boolean)
ssl: (Boolean)
Note that all flags may not work with all badge types
Requirements
Tested with Ruby 2.1.3+ and nothing lower. Luck may vary with other versions.
Testing
bundle exec rake spec