Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Challonge
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Challonge
Commits
b8d75723
Commit
b8d75723
authored
Nov 25, 2013
by
Aaron Tidwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
workaround for node bug
parent
2086a8da
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
lib/api/participants.js
lib/api/participants.js
+20
-6
test/test.js
test/test.js
+3
-2
No files found.
lib/api/participants.js
View file @
b8d75723
...
...
@@ -8,6 +8,11 @@
var
util
=
require
(
'
util
'
);
var
Client
=
require
(
'
./client
'
).
Client
;
//used for the randomize workaround
var
sys
=
require
(
'
sys
'
)
var
exec
=
require
(
'
child_process
'
).
exec
;
var
Participants
=
exports
.
Participants
=
function
(
options
)
{
Client
.
call
(
this
,
options
);
// call parent constructor
};
...
...
@@ -53,11 +58,20 @@ Participants.prototype.destroy = function(obj) {
this
.
makeRequest
(
obj
);
};
/***********BUSTED*********/
// [Error: Parse Error] bytesParsed: 0, code: 'HPE_INVALID_CONSTANT'
Participants
.
prototype
.
randomize
=
function
(
obj
)
{
obj
.
path
=
'
v1/tournaments/
'
+
obj
.
id
+
'
/participants/randomize
'
;
delete
obj
.
id
;
obj
.
method
=
'
PUT
'
;
this
.
makeRequest
(
obj
);
//workaround to exec CURL, not the best
var
cmd
=
'
curl -d "" https://
'
+
this
.
options
.
get
(
'
username
'
)
+
'
:
'
+
this
.
options
.
get
(
'
apiKey
'
)
+
'
@api.challonge.com/v1/tournaments/
'
+
obj
.
id
+
'
/participants/randomize.
'
+
this
.
options
.
get
(
'
format
'
);
function
process
(
error
,
stdout
,
stderr
)
{
var
data
=
JSON
.
parse
(
stdout
);
obj
.
callback
(
null
,
data
);
}
exec
(
cmd
,
process
);
/***********BUSTED*********/
// [Error: Parse Error] bytesParsed: 0, code: 'HPE_INVALID_CONSTANT'
// obj.path = 'v1/tournaments/'+obj.id+'/participants/randomize';
// delete obj.id;
// obj.method = 'PUT';
// this.makeRequest(obj);
}
\ No newline at end of file
test/test.js
View file @
b8d75723
var
challonge
=
require
(
'
./../
'
);
var
client
=
challonge
.
createClient
({
username
:
'
tidwell
'
,
apiKey
:
require
(
'
./../key.js
'
),
format
:
'
json
'
});
...
...
@@ -202,7 +203,7 @@ function mupdate() {
index
();
//
index();
//create();
//show();
//update();
...
...
@@ -216,7 +217,7 @@ index();
//pshow();
//pupdate();
//pdestroy();
//
prandomize();
prandomize
();
//mindex();
//mshow();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment