Skip to content

bravely/lolesports-api

Repository files navigation

Lolesports::Api

An easier API wrapper for the lolesports.com API.

Installation

Add this line to your application's Gemfile:

gem 'lolesports-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lolesports-api

Usage

Remember, anywhere you'd like to use it:

require 'lolesports-api'

Base Methods

A common rule throughout the API to keep in mind, is that no single command does multiple API calls.

.find(id)

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"...>

#reload

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"...>

Object Specific Methods

.all

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...]

TODO

  • LolesportsApi::Tournament.all, since the API doesn't currently actually return all tournaments. API Link
  • LolesportsApi::Team list of games. API Link
  • Other less useful API objects.

Special Thanks

  • Thanks @levi for this documentation.
  • And obviously, thanks Riot. <3

Contributing

  1. Fork it ( https://github.com/[my-github-username]/lolesports-api/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write tests.
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

About

A ruby gem for the (unofficial) http://www.lolesports.com/ API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages