function testLabelParamKeysLabelsKeysNotAlreadyWrapped() { $testArray = array("message" => "Hi this is a test message", "post[subject_id]" => 45, "post[subject_type]" => "Post"); $apiObj = new MavenlinkApi(null, null); $this->assertEqual($apiObj->labelParamKeys(Post, $testArray), array("post[message]" => "Hi this is a test message", "post[subject_id]" => 45, "post[subject_type]" => "Post")); $testArray = array("date_performed" => '01/01/2012', "time_entry[time_in_minutes]" => '200'); $this->assertEqual($apiObj->labelParamKeys(TimeEntry, $testArray), array("time_entry[date_performed]" => '01/01/2012', "time_entry[time_in_minutes]" => '200')); }
function __construct($oauthToken, $production = true) { $this->loginInfo = $oauthToken; if ($production) { self::$devMode = false; } }
<?php require '../lib/mavenlink_api.php'; $mavenlinkApi = new MavenlinkApi('<oauthTokenHere>'); $workspacesJson = $mavenlinkApi->getWorkspaces(); $workspacesDecodedJson = json_decode($workspacesJson, true); echo '<h1> Your workspaces: </h1>'; echo '<ul>'; $totalBudget = 0; foreach ($workspacesDecodedJson[results] as $dataItem) { $workspace = $workspacesDecodedJson[$dataItem[key]][$dataItem[id]]; echo '<li>' . $workspace[title] . '<br /> Budget: ' . $workspace[price] . '<br /><br /></li>'; $totalBudget = $totalBudget + $workspace[price_in_cents]; } echo '</ul>'; setlocale(LC_MONETARY, 'en_US'); echo '<br /><br /><h3> Total Project Budgets: ' . money_format('%i', $totalBudget / 100) . '</h3>';
public static function getWorkspaceResourcesPath($workspaceId) { return MavenlinkApi::getBaseUri() . "workspaces/{$workspaceId}/" . self::path() . ".json"; }