== Challonge-API

Utilize the CHALLONGE! API with preconfigured ActiveResource classes.

== Install and Configure

Get it from

  sudo gem install challonge-api

Add challonge-api as a dependency for your project and set your username and API key on startup.

  Challonge::API.username = 'username'
  Challonge::API.key = '123keyayaonge'

== Basic Usage

Get all your tournaments:


Get a filtered set of tournaments:

  Challonge::Tournament.find(:all, :params => {:state => 'in_progress'})

Run a basic tournament from start to finish:

  t = = 'Basic Single Elim Tournament'
  t.url = 'unique_url_123'
  t.tournament_type = 'single eliination'
  # if save returns false, view validation errors with t.errors.full_messages

  # add some participants
  Challonge::Participant.create(:name => 'Joe', :tournament => t)
  Challonge::Participant.create(:name => 'Bob', :tournament => t)

  # at this point, t.live_image_url and t.full_challonge_url are available (t.reload to refetch)


  m = t.matches(:first)
  m.scores_csv = '3-1,3-2'
  m.winner_id = m.player1_id
  # congratulations, Joe