Permalink
Browse files

change references to 'api key' and make it 'access key'

  • Loading branch information...
1 parent 504aa96 commit 500c097714a177c22402bc422ab5b04ebce83da2 @jlipps committed Oct 3, 2012
View
@@ -59,11 +59,11 @@ you didn't already have the `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment
variables set, you'll now need to configure Sausage for use with your Sauce
account:
- vendor/bin/sauce_config YOUR_SAUCE_USERNAME YOUR_SAUCE_API_KEY
+ vendor/bin/sauce_config YOUR_SAUCE_USERNAME YOUR_SAUCE_ACCESS_KEY
(Or for Windows):
- vendor\bin\sauce_config.bat YOUR_SAUCE_USERNAME YOUR_SAUCE_API_KEY
+ vendor\bin\sauce_config.bat YOUR_SAUCE_USERNAME YOUR_SAUCE_ACCESS_KEY
(It's a Composer convention for package binaries to be located in `vendor/bin`;
you can always symlink things elsewhere if it's more convenient).
@@ -171,7 +171,7 @@ Sausage comes bundled with a nice PHP interface to the [Sauce Labs API](https://
```php
<?php
-$s = new Sauce\Sausage\SauceAPI('myusername', 'myapikey');
+$s = new Sauce\Sausage\SauceAPI('myusername', 'myaccesskey');
$my_details = $s->getAccountDetails();
View
@@ -1,11 +1,11 @@
-#!/usr/bin/env php
+#!/usr/bin/env php
<?php
require_once dirname(__FILE__).'/../src/Sauce/Sausage/SauceConfig.php';
use Sauce\Sausage\SauceConfig;
-$USAGE = "USAGE: sauce_config USERNAME API_KEY";
+$USAGE = "USAGE: sauce_config USERNAME ACCESS_KEY";
if (!isset($argv[1]) || !isset($argv[2])) {
echo $USAGE;
View
@@ -4,9 +4,9 @@
use Sauce\Sausage\SauceConfig;
-list($username, $api_key) = SauceConfig::GetConfig();
+list($username, $access_key) = SauceConfig::GetConfig();
-$s = new Sauce\Sausage\SauceAPI($username, $api_key);
+$s = new Sauce\Sausage\SauceAPI($username, $access_key);
$res = $s->updateJob('0e2ae11933664d0ba26948d379fc67a6', array('passed'=>TRUE));
print_r($res);
@@ -7,16 +7,16 @@ class SauceAPI
{
protected $username;
- protected $api_key;
+ protected $access_key;
- public function __construct($username, $api_key)
+ public function __construct($username, $access_key)
{
if (!$username)
throw new \Exception("Username is required for SauceAPI");
- if (!$api_key)
- throw new \Exception("api_key is required for SauceAPI");
+ if (!$access_key)
+ throw new \Exception("Access key is required for SauceAPI");
$this->username = $username;
- $this->api_key = $api_key;
+ $this->access_key = $access_key;
$this->methods = new SauceMethods($this->username);
}
@@ -34,7 +34,7 @@ protected function makeRequest($url, $type="GET", $params=false)
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_USERPWD, $this->username.":".$this->api_key);
+ curl_setopt($ch, CURLOPT_USERPWD, $this->username.":".$this->access_key);
if ($type == "POST")
curl_setopt($ch, CURLOPT_POST, 1);
@@ -9,44 +9,44 @@ class SauceConfig
public static function LoadConfig($fail_if_no_config = true)
{
- if (!defined('SAUCE_USERNAME') && !defined('SAUCE_API_KEY')) {
+ if (!defined('SAUCE_USERNAME') && !defined('SAUCE_ACCESS_KEY')) {
if (is_file(CONFIG_PATH)) {
$config = file_get_contents(CONFIG_PATH);
- list($username, $api_key) = explode(',', $config);
+ list($username, $access_key) = explode(',', $config);
$username = trim($username);
- $api_key = trim($api_key);
+ $access_key = trim($access_key);
} elseif (getenv('SAUCE_USERNAME') && getenv('SAUCE_ACCESS_KEY')) {
$username = getenv('SAUCE_USERNAME');
- $api_key = getenv('SAUCE_API_KEY');
+ $access_key = getenv('SAUCE_ACCESS_KEY');
} elseif ($fail_if_no_config) {
$msg = <<<EOF
We could not find your Sauce username or API key (which you can get from
https://saucelabs.com/account). You have two options for setting them:
-1) run vendor/bin/sauce_config USERNAME API_KEY
+1) run vendor/bin/sauce_config USERNAME access_kEY
2) export environment variables SAUCE_USERNAME and SAUCE_ACCESS_KEY
Please take one of these two steps and try again!
EOF;
echo $msg;
exit(1);
} else {
- $username = $api_key = NULL;
+ $username = $access_key = NULL;
}
define('SAUCE_USERNAME', $username);
- define('SAUCE_API_KEY', $api_key);
+ define('SAUCE_ACCESS_KEY', $access_key);
}
}
public static function GetConfig($fail_if_no_config = true)
{
self::LoadConfig($fail_if_no_config);
- return array(SAUCE_USERNAME, SAUCE_API_KEY);
+ return array(SAUCE_USERNAME, SAUCE_ACCESS_KEY);
}
- public static function WriteConfig($username, $api_key) {
- file_put_contents(CONFIG_PATH, "{$username},{$api_key}");
+ public static function WriteConfig($username, $access_key) {
+ file_put_contents(CONFIG_PATH, "{$username},{$access_key}");
}
}
@@ -13,7 +13,7 @@ public static function RequireSauceConfig()
public static function ReportStatus($session_id, $passed)
{
self::RequireSauceConfig();
- $api = new SauceAPI(SAUCE_USERNAME, SAUCE_API_KEY);
+ $api = new SauceAPI(SAUCE_USERNAME, SAUCE_ACCESS_KEY);
$api->updateJob($session_id, array('passed'=>$passed));
}
@@ -77,7 +77,7 @@ protected function getDriver(array $browser)
$driver = new SeleniumRCDriver();
if (!$local) {
$driver->setUsername(SAUCE_USERNAME);
- $driver->setAccessKey(SAUCE_API_KEY);
+ $driver->setAccessKey(SAUCE_ACCESS_KEY);
$driver->setOs($browser['os']);
$driver->setBrowserVersion($browser['browserVersion']);
}
@@ -40,7 +40,7 @@ public function setupSpecificBrowser($params)
// Set up host
- $sauce_host = SAUCE_USERNAME.':'.SAUCE_API_KEY.'@ondemand.saucelabs.com';
+ $sauce_host = SAUCE_USERNAME.':'.SAUCE_ACCESS_KEY.'@ondemand.saucelabs.com';
$host = isset($params['host']) ? $params['host'] : false;
$this->setHost($host ? $host : ($local ? 'localhost' : $sauce_host));

0 comments on commit 500c097

Please sign in to comment.