$account = $gen->getAccount($_GET["accountId"]);
	$account = json_decode($account, true);
	
	$profiles = $gen->getProfiles($_GET["accountId"]);
	$profiles = json_decode($profiles, true);
} elseif ($_GET['providerAccountId']) {
	$account = $gen->getAccount(NULL, $_GET['providerAccountId']);
	$account = json_decode($account, true);

	$profiles = $gen->getProfiles(NULL, $_GET['providerAccountId']);
	$profiles = json_decode($profiles, true);
} elseif ($_GET["profileId"]) {
	$profile = $gen->getProfile($_GET);
	$profile = json_decode($profile, true);
} else if ($_POST['search']) {
	$accounts = $gen->getAccounts(array('search' => $_POST['search']));
	$accounts = json_decode($accounts, true);

	$profiles = $gen->getProfiles();
	$profiles = json_decode($profiles, true);
} else {
	$accounts = $gen->getAccounts();
	$accounts = json_decode($accounts, true);

	$profiles = $gen->getProfiles();
	$profiles = json_decode($profiles, true);
}
?>

<!DOCTYPE html>
<html>
$gen = new genability(array(
  'app_id'  => 'your-app-id-here',    // Your Unique Genability Application ID <https://developer.genability.com/admin/applications>
  'app_key' => 'your-app-key-here',   // Your Unique Genability Application Key <https://developer.genability.com/admin/applications>
  'debug'   => false,                // Debug mode echos API Url & POST data if set to true (Optional)
));

// make the getTariff call
$output = $gen->getTariff(array(
  'masterTariffId'=> $TARIFF_ID,	// Unique Genability ID (primary key) for this tariff
  'populateRates' => true,		// Populates the rate details for this Tariff (Boolean). The PHP Library defaults to false if not set
  'territoryId'   => $TERRITORY_ID,     // When specified, rate changes returned will be for the specified Territory. (Optional)
  'accountId'     => $ACCOUNT_ID,
));

// check to see if this account has accounts
$accounts = $gen->getAccounts();
$accounts = json_decode($accounts);

// helper method to display text easier (lowercase and without _s)
function formatText($input) {
	return strtolower(str_replace("_", " ", $input));
}
?>


<!DOCTYPE html>
<html>
<head>
	<title>Genability API PHP Library :: Examples :: tariff.php</title>
	<link rel="stylesheet" href="../static/genability_php_library.css">
	<link rel="stylesheet" href="../static/cupertino/jquery-ui-1.8.15.custom.css">