PHP Class WebDriver\SauceLabs\SauceRest

Show file Open project: instaclick/php-webdriver Class Usage Examples

Public Methods

Method Description
__construct ( string $userId, string $accessKey ) Constructor
createSubAccount ( array $accountInfo ) : array Create new sub-account: /rest/v1/users/:userId (POST)
deleteJob ( string $jobId ) : array Delete job: /rest/v1/:userId/jobs/:jobId (DELETE)
getAccountDetails ( string $userId ) : array Get account details: /rest/v1/users/:userId (GET)
getAccountLimits ( ) : array Check account limits: /rest/v1/limits (GET)
getActivity ( ) : array Get current account activity: /rest/v1/:userId/activity (GET)
getBrowsers ( string $termination = false ) : array Get currently supported browsers: /rest/v1/info/browsers (GET)
getCounter ( ) : array Get number of tests executed so far on Sauce Labs: /rest/v1/info/counter (GET)
getJob ( string $jobId ) : array Get full information for job: /rest/v1/:userId/jobs/:jobId (GET)
getJobs ( boolean $full = null ) : array Get jobs: /rest/v1/:userId/jobs (GET)
getStatus ( ) : array Get current status of Sauce Labs' services: /rest/v1/info/status (GET)
getTunnel ( string $tunnelId ) : array Get full information for a tunnel: /rest/v1/:userId/tunnels/:tunnelId (GET)
getTunnels ( ) : array Get running tunnels for a given user: /rest/v1/:userId/tunnels (GET)
getUsage ( string $start = null, string $end = null ) : array Get historical account usage: /rest/v1/:userId/usage (GET)
shutdownTunnel ( string $tunnelId ) : array Shut down a tunnel: /rest/v1/:userId/tunnels/:tunnelId (DELETE)
stopJob ( string $jobId ) : array Stop job: /rest/v1/:userId/jobs/:jobId/stop (PUT)
unsubscribeSubAccount ( string $userId ) : array Unsubscribe a sub-account: /rest/v1/users/:userId/subscription (DELETE)
updateJob ( string $jobId, array $jobInfo ) : array Update existing job: /rest/v1/:userId/jobs/:jobId (PUT)
updateSubAccount ( string $userId, string $plan ) : array Update sub-account service plan: /rest/v1/users/:userId/subscription (POST)

Protected Methods

Method Description
execute ( string $requestMethod, string $url, mixed $parameters = null ) : mixed Execute Sauce Labs REST API command

Method Details

__construct() public method

Constructor
public __construct ( string $userId, string $accessKey )
$userId string Your Sauce user name
$accessKey string Your Sauce API key

createSubAccount() public method

For "partners", $accountInfo also contains 'plan' => (one of 'free', 'small', 'team', 'com', or 'complus')
public createSubAccount ( array $accountInfo ) : array
$accountInfo array array('username' => ..., 'password' => ..., 'name' => ..., 'email' => ...)
return array array('access_key' => ..., 'minutes' => ..., 'id' => ...)

deleteJob() public method

Delete job: /rest/v1/:userId/jobs/:jobId (DELETE)
public deleteJob ( string $jobId ) : array
$jobId string
return array

execute() protected method

Execute Sauce Labs REST API command
See also: http://saucelabs.com/docs/saucerest
protected execute ( string $requestMethod, string $url, mixed $parameters = null ) : mixed
$requestMethod string HTTP request method
$url string URL
$parameters mixed Parameters
return mixed

getAccountDetails() public method

Get account details: /rest/v1/users/:userId (GET)
public getAccountDetails ( string $userId ) : array
$userId string
return array

getAccountLimits() public method

Check account limits: /rest/v1/limits (GET)
public getAccountLimits ( ) : array
return array

getActivity() public method

Get current account activity: /rest/v1/:userId/activity (GET)
public getActivity ( ) : array
return array

getBrowsers() public method

Get currently supported browsers: /rest/v1/info/browsers (GET)
public getBrowsers ( string $termination = false ) : array
$termination string Optional termination (one of "all", "selenium-rc", or "webdriver')
return array

getCounter() public method

Get number of tests executed so far on Sauce Labs: /rest/v1/info/counter (GET)
public getCounter ( ) : array
return array

getJob() public method

Get full information for job: /rest/v1/:userId/jobs/:jobId (GET)
public getJob ( string $jobId ) : array
$jobId string
return array

getJobs() public method

Get jobs: /rest/v1/:userId/jobs (GET)
public getJobs ( boolean $full = null ) : array
$full boolean
return array

getStatus() public method

Get current status of Sauce Labs' services: /rest/v1/info/status (GET)
public getStatus ( ) : array
return array array('wait_time' => ..., 'service_operational' => ..., 'status_message' => ...)

getTunnel() public method

Get full information for a tunnel: /rest/v1/:userId/tunnels/:tunnelId (GET)
public getTunnel ( string $tunnelId ) : array
$tunnelId string
return array

getTunnels() public method

Get running tunnels for a given user: /rest/v1/:userId/tunnels (GET)
public getTunnels ( ) : array
return array

getUsage() public method

Get historical account usage: /rest/v1/:userId/usage (GET)
public getUsage ( string $start = null, string $end = null ) : array
$start string Optional start date YYYY-MM-DD
$end string Optional end date YYYY-MM-DD
return array

shutdownTunnel() public method

Shut down a tunnel: /rest/v1/:userId/tunnels/:tunnelId (DELETE)
public shutdownTunnel ( string $tunnelId ) : array
$tunnelId string
return array

stopJob() public method

Stop job: /rest/v1/:userId/jobs/:jobId/stop (PUT)
public stopJob ( string $jobId ) : array
$jobId string
return array

unsubscribeSubAccount() public method

Unsubscribe a sub-account: /rest/v1/users/:userId/subscription (DELETE)
public unsubscribeSubAccount ( string $userId ) : array
$userId string User ID
return array

updateJob() public method

Update existing job: /rest/v1/:userId/jobs/:jobId (PUT)
public updateJob ( string $jobId, array $jobInfo ) : array
$jobId string Job ID
$jobInfo array Job information
return array

updateSubAccount() public method

Update sub-account service plan: /rest/v1/users/:userId/subscription (POST)
public updateSubAccount ( string $userId, string $plan ) : array
$userId string User ID
$plan string Plan
return array