Permalink
Browse files

adding a developer test action, cleanup of output to match camelcase …

…rules
  • Loading branch information...
1 parent 7417bee commit 947e3275983d983b7182691eb97d416f028e9440 @evantahler committed Apr 26, 2011
View
@@ -10,10 +10,11 @@
$ACTIONS = array();
// default actions
-$ACTIONS[] = array('DescribeActions', 'Actions/examples/DescribeActions.php', 'Private');
+$ACTIONS[] = array('DescribeActions', 'Actions/examples/DescribeActions.php', 'Public');
$ACTIONS[] = array('DescribeTables', 'Actions/examples/DescribeTables.php', 'Public');
// some basic actions
+$ACTIONS[] = array('PrivateAction', 'Actions/examples/PrivateAction.php', 'Private');
$ACTIONS[] = array('CacheTest', 'Actions/examples/CacheTest.php', 'Public');
$ACTIONS[] = array('ObjectTest', 'Actions/examples/ObjectTest.php', 'Public');
$ACTIONS[] = array('CookieTest', 'Actions/examples/CookieTest.php', 'Public');
@@ -1,5 +1,4 @@
<?php
-
/***********************************************
DAVE PHP API
https://github.com/evantahler/PHP-DAVE-API
@@ -1,5 +1,4 @@
<?php
-
/***********************************************
DAVE PHP API
https://github.com/evantahler/PHP-DAVE-API
@@ -0,0 +1,15 @@
+<?php
+/***********************************************
+DAVE PHP API
+https://github.com/evantahler/PHP-DAVE-API
+Evan Tahler | 2011
+
+I am an action that only Developers can use to test the APIKey/Developer System
+***********************************************/
+// I'll use HASH as the variable to log by IP address;
+if ($ERROR == 100)
+{
+ $OUTPUT["ProvateAction"] = "Hooray! You are an authenticated Developer!";
+}
+
+?>
@@ -1,5 +1,4 @@
<?php
-
/***********************************************
DAVE PHP API
https://github.com/evantahler/PHP-DAVE-API
View
@@ -58,4 +58,14 @@
}
}
+if ($ERROR == 100)
+{
+ $OUTPUT["DeveloperAuthentication"] = "TRUE";
+}
+else
+{
+ $OUTPUT["DeveloperAuthentication"] = "FALSE";
+}
+
+
?>
View
@@ -51,8 +51,8 @@
{
$_api_requests_so_far = GetAPIRequestsCount();
if (!is_int($_api_requests_so_far)){ $OUTPUT['ERROR'] = $_api_requests_so_far; require('Output.php'); exit;}
- $OUTPUT['api_requests_remaining'] = $CONFIG['RequestLimitPerHour'] - $_api_requests_so_far;
- if ($OUTPUT['api_requests_remaining'] <= 0)
+ $OUTPUT['APIRequestsRemaining'] = $CONFIG['RequestLimitPerHour'] - $_api_requests_so_far;
+ if ($OUTPUT['APIRequestsRemaining'] <= 0)
{
$DBOBJ->close();
$OUTPUT['ERROR'] = "You have exceeded your allotted ".$CONFIG['RequestLimitPerHour']." requests this hour.";
@@ -87,13 +87,13 @@
{
if (0 == strcmp($PARAMS["Action"],$ACTIONS[$_ActionCounter][0]))
{
+ $Action = $ACTIONS[$_ActionCounter][0];
if ($ACTIONS[$_ActionCounter][2] != "Public")
{
require("CheckAPIKey.php");
}
if ($ERROR == 100)
{
- $Action = $ACTIONS[$_ActionCounter][0];
require($ACTIONS[$_ActionCounter][1]);
}
$ActionPreformed = 1;
View
@@ -9,13 +9,13 @@
require_once("../spec_helper.php");
$T = new DaveTest("General API Tests");
-$T->context("api_requests_remaining should decrement on subsequent loads");
+$T->context("APIRequestsRemaining should decrement on subsequent loads");
$PostArray = array("OutputType" => "PHP");
$APIDATA = $T->api_request($PostArray);
- $first = $APIDATA["api_requests_remaining"];
+ $first = $APIDATA["APIRequestsRemaining"];
$T->assert(">",$first,0);
$APIDATA = $T->api_request($PostArray);
- $second = $APIDATA["api_requests_remaining"];
+ $second = $APIDATA["APIRequestsRemaining"];
$T->assert(">",$second,0);
$T->assert("<",$second,$first);

0 comments on commit 947e327

Please sign in to comment.