Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
require 'rubygems'
# http://github.com/archiloque/rest-client
require 'rest_client'
# STARTED
# set game with hash_code 'game_hash123' as started
RestClient.post "http://localhost:3000/games/game_hash123/started", { '_method' => 'put', 'user_credentials' => 'xH31MpM8xSff3em8LwGJ' }, :content_type => :json, :accept => :json
# INTERRUPTED
# set game with hash_code 'game_hash123' as interrupted with one player as interruptee
# use string with player hash
RestClient.post "http://localhost:3000/games/game_hash123/interrupted", { '_method' => 'put', 'user_credentials' => 'xH31MpM8xSff3em8LwGJ', 'game[users]' => 'user111' }, :content_type => :json, :accept => :json
# use array with string with player hash
RestClient.post "http://localhost:3000/games/game_hash123/interrupted", { '_method' => 'put', 'user_credentials' => 'xH31MpM8xSff3em8LwGJ', 'game[users]' => ['user111'] }, :content_type => :json, :accept => :json
# set game with hash_code 'game_hash123' as interrupted with both players as interruptee
response = RestClient.post "http://localhost:3000/games/game_hash123/interrupted", { '_method' => 'put', 'user_credentials' => 'xH31MpM8xSff3em8LwGJ', 'game[users]' => ['user111', 'user222'] }, :content_type => :json, :accept => :json
# FINISHED
# set game with hash_code 'game_hash123' as finished
# use string or array of strings for winners, loosers, draws
response = RestClient.post "http://localhost:3000/games/game_hash123/finished", { '_method' => 'put', 'user_credentials' => 'xH31MpM8xSff3em8LwGJ', 'game[winners]' => ['admin'], 'game[loosers]' => ['tester'] }, :content_type => :json, :accept => :json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.