Strife
Strife is a ruby wrapper for the Riot Games League of Legends APIs.
I will be attempting to maintain compatibility with ONLY the latest version of each API that Riot releases. According to Riot's documentation, they will only support previous versions of an API for up to 60 days, allowing clients time to upgrade existing calls.
Installation
Add this line to your application's Gemfile:
gem 'strife'
And then execute:
$ bundle
Or install it yourself as:
$ gem install strife
Usage
Strife was designed to be similar to GitHub's Octokit.rb.
Strife provides methods for each of Riot's existing API calls (for the most recent version of each call). To use Strife, you'll need to get an API key for the Riot API. That can be obtained from the Riot Developer Website.
Strife can be configured through either environment variables or
the Strife::Configurable
module.
Configuring via Environment Variables
The following environment variables are used by Strife for configuration (see Strife::Default
for a full list of default configuration options):
STRIFE_API_KEY
STRIFE_API_KEY
sets the API key used by Strife for API calls.
STRIFE_API_ENDPOINT
STRIFE_API_ENDPOINT
defines the end point of the Riot API. This defaults to http://prod.api.pvp.net/api/lol/
.
STRIFE_USER_AGENT
STRIFE_USER_AGENT
defines the user agent that is sent in the user agent header when making API requests. This defaults to Strife Riot API GEM v0.0.2
(v0.0.2
will vary depending on the current version of the Strife library).
STRIFE_DEFAULT_MEDIA_TYPE
STRIFE_DEFAULT_MEDIA_TYPE
is used in the accept
header, and defaults to application/json
.
STRIFE_REGION
STRIFE_REGION
determines the League of Legends game region to query against. It defaults to na
. Other options include euw
and eune
.
Configuring with Strife::Configurable
The Strife::Configurable
module can also be used to configure the Strife library at run-time. It can be used as follows:
Strife.configure do |config|
config.api_key = "An API Key"
config.region = "na"
end
See lib/strife/default.rb for a list of default options, and lib/strife/configurable.rb for a list of configuration keys (see Strife::Configurable.keys).
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request