0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby libary wrapper for the Vainglory API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Travis CI Code Climate Test Coverage Gem Version Inline docs MIT License

vainglory-api

A Ruby libary wrapper for the Vainglory API

See also: YARD Documentation, Official Vainglory API Documentation


Getting Started

VaingloryAPI works with Ruby 2.0 onwards. Please refer to the YARD Documentation for a better understanding of how everything works.

Installation

You can add it to your Gemfile with:

gem 'vainglory-api'

Then run bundle install

You can also install it manually with:

gem install vainglory-api

Usage

You can create an instance of the API client by initializing with your API key and specified region (na is the default):

client = VaingloryAPI.new('YOUR_API_KEY', 'na')

Region Errors

A valid region short name is required when instantiating a client. Providing an invalid region short name will raise VaingloryAPI::RegionNameError.

Helper Attributes

All client methods return an OpenStruct object containing the response attributes with some additional helper attributes.

response = client.samples

response.code     # The HTTP response code
response.success? # Returns true if the response code is less than 300
response.raw      # The complete HTTP response

Rate Limits

Each request will return data about your rate limits.

response.rate_limit     # Request limit per day / per minute
response.rate_remaining # The number of requests left for the time window
response.rate_reset     # The remaining window before the rate limit is refilled in UTC epoch nanoseconds.

More information: https://developer.vainglorygame.com/docs#rate-limits

Filtering

Currently, filters are supported by these client methods:

  • VaingloryAPI::Client#matches
  • VaingloryAPI::Client#samples

You can pass filters in as a hash using the exact Query Parameter key names outlined in the Vainglory API Documentation.

# Example matches request with filter
client.matches('filter[playerNames]' => 'boombastic04,IHaveNoIdea')

Methods

To get multiple matches:

client.matches

To get single match data, you must provide the ID of a match:

client.match('37f94e56-1360-11e7-a250-062445d3d668')

You can search for data of one or more players by passing their in-game names (IGNs):

client.players('boombastic04', 'IHaveNoIdea')

To get data about a single player, you must provide the ID of the player:

client.player('6abb30de-7cb8-11e4-8bd3-06eb725f8a76')

To get Telemetry data, you must provide the data URL:

client.telemetry('https://gl-prod-us-east-1.s3.amazonaws.com/assets/semc-vainglory/na/2017/03/28/03/07/b0bb7faf-1363-11e7-b11e-0242ac110006-telemetry.json')

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cbortz/vainglory-api-ruby.

License

MIT License. Copyright 2017 Chet Bortz