From ce12dcb2800b3b87fda0b61877eaa88d79822a65 Mon Sep 17 00:00:00 2001 From: Vincent Casse Date: Tue, 15 Dec 2015 17:10:08 +0100 Subject: [PATCH 1/3] Delete "createToken" link for Runabove Issue #11 --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ef6dcdf..d024cea 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,6 @@ Supported APIs * Community support: https://community.runabove.com * Console: https://api.runabove.com/console/ * Create application credentials: https://api.runabove.com/createApp/ - * Create script credentials (all keys at once): https://api.runabove.com/createToken/ ## Related links From 3f9aec3547e13e4767e72a91600fc0a2b3fe7095 Mon Sep 17 00:00:00 2001 From: Vincent Casse Date: Tue, 15 Dec 2015 17:25:42 +0100 Subject: [PATCH 2/3] Add default timeout on http client Issue #18 --- src/Api.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Api.php b/src/Api.php index ba28784..6b8d067 100644 --- a/src/Api.php +++ b/src/Api.php @@ -128,6 +128,8 @@ public function __construct( if (!isset($http_client)) { $http_client = new GClient(); + $http_client->setDefaultOption('timeout', 30); + $http_client->setDefaultOption('connect_timeout', 5); } $this->application_key = $application_key; From d99c758c72f215414b629c3f6577e28eb4b4c72d Mon Sep 17 00:00:00 2001 From: Vincent Casse Date: Tue, 15 Dec 2015 18:16:11 +0100 Subject: [PATCH 3/3] Add documentation about HTTP client library injection Signed-off-by: Vincent Casse --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index d024cea..76bf865 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,40 @@ foreach ($servers as $server) { ?> ``` +How to customize HTTP client configuration? +------------------------------------------- + +You can inject your own HTTP client with your specific configuration. For instance, you can edit user-agent and timeout for all your requests + +```php +setDefaultOption('timeout', 1); +$client->setDefaultOption('headers', array('User-Agent' => 'api_client') ); + +// Get servers list +$conn = new Api( $applicationKey, + $applicationSecret, + $endpoint, + $consumer_key, + $client); +$webHosting = $conn->get('/hosting/web/'); + +foreach ($webHosting as $webHosting) { + echo "One of our web hosting: " . $webHosting . "\n"; +``` How to build the documentation? -------------------------------