An easier API wrapper for the lolesports.com API.
Add this line to your application's Gemfile:
gem 'lolesports-api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install lolesports-api
Remember, anywhere you'd like to use it:
require 'lolesports-api'
A common rule throughout the API to keep in mind, is that no single command does multiple API calls.
Any given LolesportsApi
class(apart from LolesportsApi::Play
) has the find method. It returns a new instance of that class, with all related properties and objects.
hai = LolesportsApi::Player.find(330)
# => #<LolesportsApi::Player:0x007f9fb3509998 @name="Hai"...>
From any given API object with an @id
attribute, you can use reload to either update the object or load it with all of its endpoint data.
hai.reload
# => #<LolesportsApi::Player:0x007f9fb3509998 @name="Hai"...>
This only exists for Leagues and Series. Returns an array of all instances of the object.
leagues = LolesportsApi::League.all
# => [#<LolesportsApi::League:0x007fd152dfe7f8>, #<LolesportsApi::League:0x00...]
LolesportsApi::Tournament.all
, since the API doesn't currently actually return all tournaments. API LinkLolesportsApi::Team
list of games. API Link- Other less useful API objects.
- Fork it ( https://github.com/[my-github-username]/lolesports-api/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Write tests.
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request