#ping #pong #leaderboard

startuppong

startuppong.com API client

4 releases

Uses old Rust 2015

0.2.2 Dec 6, 2015
0.2.1 Jul 23, 2015
0.2.0 Jun 9, 2015
0.1.0 May 31, 2015

#12 in #ping

33 downloads per month
Used in chatbot

MIT license

16KB
322 lines

startuppong-client-rs

startuppong.com API wrapper

Circle CI

About

The following methods of the startuppong.com API are supported:

  • /api/v1/get_players
  • /api/v1/get_recent_matches_for_company
  • /api/v1/add_match

Each endpoint has a corresponding function published in the API. Data returned from the API is strongly typed. Each resource type has a struct associated with it.

Check out the docs for more info.

Cargo

Add the following to your Cargo.toml

[dependencies]
startuppong = "~0.1"

lib.rs:

An API wrapper for startuppong.com

The wrapper is implemented as a few module level functions for accessing the endpoints. All of the JSON responses are represented with structs. The rustc_serialize crate is heavily relied on to handle decoding of JSON responses.

Sign up for an account at startuppong.com.

Examples

use startuppong::Account;
use startuppong::get_players;

// Get the current leaderboard
let account = Account::new("account_id".to_owned(), "account_key".to_owned());

// Make request to startuppong.com
let players_response = get_players(&account).unwrap();

// Consume the response and get the list of players
let players = players_response.players();

// Print out the leaderboard
for player in &players {
    println!("{} ({}) - {}", player.rank, player.rating, player.name);
}

Dependencies

~5MB
~113K SLoC