Git Product home page Git Product logo

vainglory-api-ruby's Introduction

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

vainglory-api-ruby's People

Contributors

cbortz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.