GithubHelp home page GithubHelp logo

frc1418 / tbarb Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 22 KB

:chart_with_upwards_trend: Ruby library for fetching data from The Blue Alliance API (v3).

Home Page: https://rubygems.org/gems/tbarb

License: MIT License

Ruby 100.00%
frc the-blue-alliance tba-api

tbarb's Introduction

tbarb Gem Version

1418 TBA Libraries // Python // Go // Ruby

Ruby library for interfacing with The Blue Alliance API (v3).

NOTE: tba vs tbarb, v3, and breaking changes

On January 1st, 2018, v2 of The Blue Alliance's API was folded in favor of the new v3. The API supports numerous new and helpful features, however it uses endpoints which are incompatible with libraries designed for v2.

A related note on naming: Prior to the v3 update, this package was known as tba.rb on git and tba in RubyGems. As part of the rewrite required for the new API, the name of this package was changed to tbarb, both on git and RubyGems. The old package is still available through RubyGems as tba, however using it is not recommended as the package is not functional after 2017.

For potentially breaking function name changes, see tbapy's README.

Installation

Add tbarb to your Gemfile.

gem 'tbarb'

and then run

bundle install

in the same directory as the Gemfile.

Or install directly from RubyGems:

gem install tbarb

Setup

To use these functions, you must require the tba gem:

require 'tbarb'

Before using the API, you must instantiate the class, providing a valid TBA auth key. You can obtain one here.

tba = TBA.new('key')

Retrieval Functions

You may specify simple as true to get only vital data on some models or lists of models, or you may specify keys as true to get a list of the keys for a list rather than full data on each model. It is recommended to use these options if you do not need full data.

Some requests support year and other optional parameters, which are recommended to use to narrow down your results.

  • tba.status() - Get TBA's status.
  • tba.teams(page, [year], [simple/keys]) - Get a list of of valid teams, where page * 500 is the starting team number.
  • tba.team(team, [simple]) - Get a team's data. team can be an integer team number of a string-form 'frc####' identifier.
  • tba.team_events(team, [year], [simple/keys]) - Get a list of events a team has been to.
  • tba.team_awards(team, [event/year]) - Get a list of the team's awards.
  • tba.team_matches(team, [event/year], [simple/keys]) - Get a list of a team's matches at an event.
  • tba.team_years(team) - Get a list of years the team was active in FRC.
  • tba.team_media(team, [year], [tag]) - Get team media. Specify a year to get media from or a tag or both.
  • tba.team_robots(team) - Get data about a team's robots.
  • tba.team_districts(team) - Get the districts that a team has been part of over the years.
  • tba.team_profiles(team) - Get data on a team's media profiles.
  • tba.team_status(team, event) - Get a team's status at an event.
  • tba.events([year], [simple/keys]) - Get a list of all events.
  • tba.event(event, [simple]) - Get data about an event.
  • tba.event_rankings(event) - Gets a list of team rankings at a given event.
  • tba.event_alliances(event) - Get sophisticated data on alliances at a given event.
  • tba.event_district_points(event) - Get sophisticated data on district points at a given event.
  • tba.event_insights(event) - Get insight data on a given event.
  • tba.event_oprs(event) - Get sophisticated data on alliances at a given event.
  • tba.event_predictions(event) - Get predicted scores for a given event.
  • tba.event_teams(event, [simple/keys]) - Get a list of teams at an event.
  • tba.event_awards(event) - Get the awards from an event.
  • tba.event_matches(event, [simple/keys]) - Get a match list of an event.
  • tba.match([key], [year], [event], [type], [number], [round], [simple]) - Get data about a match. You may either pass the match's key directly, or pass year, event, type, match (the match number), and round if applicable (playoffs only). The event year may be specified as part of the event key or specified in the year parameter.
  • tba.districts(year) - Get a list of all districts that exist(ed) in a given year.
  • tba.district_events(district, [simple/keys]) - Get list of events in a district.
  • tba.district_rankings(district) - Get the rankings in a district.
  • tba.district_teams(district, [simple/keys]) - Get a list of the teams in a district.

See example.rb for several usage examples.

Documentation for The Blue Alliance's API can be found here.

Authors

This software was created and is maintained by Erik Boesen with Team 1418.

License

This software is protected under the MIT License.

tbarb's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

frc-862 frc900

tbarb's Issues

Use TBA API v3

v2 of TBA's API will be shut off on January 1st, 2018, and this library has not been updated for v3.

I updated tbapy (the Python equivalent of this library) several months ago; the process should be quite similar for Ruby. I made these changes: https://github.com/frc1418/tbapy/pull/4/files

TBA App ID

Might not want to include your own TBA App ID if you are making this public. I would suggest making a function to set the ID

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.