From 2d2a6a28e7b0fe193e35a04184ed5611da35287c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Str=C3=BCbing?= Date: Mon, 8 Oct 2018 06:30:02 +0200 Subject: [PATCH] Remove goo.gl service closes #11 --- README.md | 13 ---------- docs/index.md | 13 ---------- src/serviceBundle/Services/Google.php | 26 -------------------- tests/serviceBundle/GoogleTest.php | 34 --------------------------- 4 files changed, 86 deletions(-) delete mode 100644 src/serviceBundle/Services/Google.php delete mode 100644 tests/serviceBundle/GoogleTest.php diff --git a/README.md b/README.md index 5f06b43..f724ef1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ It's based on [Guzzle](https://github.com/guzzle/guzzle),HTTP client. | [Imgur](http://imgur.com/) | Yes | uploading images service | | [Imageshack](https://www.imageshack.us) | Yes | uploading images service | | [bit.ly](https://bitly.com/) | Yes | shorten url service | -| [goo.gl](https://goo.gl/) | Yes | shorten url service | |[McAf.ee](https://community.mcafee.com/docs/DOC-1991)| Yes | shorten url service | ## Usage @@ -128,18 +127,6 @@ It's based on [Guzzle](https://github.com/guzzle/guzzle),HTTP client. //return json format (McAf standard api response via cURL) var_dump($bundle->sendReq()); ``` - Google shorten url service: a shorten url service - ```php - require 'vendor/autoload.php'; - $config = [ - 'service-name' => 'Google', - 'apiKey' => 'your-api-key', - 'longUrl' => 'your-long-url' - ]; - $bundle = new \peter\components\serviceBundle\ServiceBundle($config); - //return json format (goo.gl standard api response via cURL) - var_dump($bundle->sendReq()); - ``` Bitly: a shorten url service ```php require 'vendor/autoload.php'; diff --git a/docs/index.md b/docs/index.md index f19f216..1d79c0d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,7 +18,6 @@ It's based on [Guzzle](https://github.com/guzzle/guzzle),HTTP client. | [Imgur](http://imgur.com/) | Yes | uploading images service | | [Imageshack](https://www.imageshack.us) | Yes | uploading images service | | [bit.ly](https://bitly.com/) | Yes | shorten url service | -| [goo.gl](https://goo.gl/) | Yes | shorten url service | |[McAf.ee](https://community.mcafee.com/docs/DOC-1991)| Yes | shorten url service | ## Usage @@ -93,18 +92,6 @@ It's based on [Guzzle](https://github.com/guzzle/guzzle),HTTP client. //return json format (McAf standard api response via cURL) var_dump($bundle->sendReq()); ``` - Google shorten url service: a shorten url service - ```php - require 'vendor/autoload.php'; - $config = [ - 'service-name' => 'Google', - 'apiKey' => 'your-api-key', - 'longUrl' => 'your-long-url' - ]; - $bundle = new \peter\components\serviceBundle\ServiceBundle($config); - //return json format (goo.gl standard api response via cURL) - var_dump($bundle->sendReq()); - ``` Bitly: a shorten url service ```php require 'vendor/autoload.php'; diff --git a/src/serviceBundle/Services/Google.php b/src/serviceBundle/Services/Google.php deleted file mode 100644 index 1566812..0000000 --- a/src/serviceBundle/Services/Google.php +++ /dev/null @@ -1,26 +0,0 @@ -config['apiKey']; - $client = new Client([ - 'defaults' => [ - 'headers' => ['Content-Type', 'application/json'], - ], - ]); - $res = $client->post($apiURL, [ - 'json' => [ - 'longUrl' => $this->config['longUrl'] - ], - ]); - - return json_decode($res->getBody(), true); - } -} diff --git a/tests/serviceBundle/GoogleTest.php b/tests/serviceBundle/GoogleTest.php deleted file mode 100644 index 9f8b89b..0000000 --- a/tests/serviceBundle/GoogleTest.php +++ /dev/null @@ -1,34 +0,0 @@ -create('Google'); - $this->assertInstanceOf(Google::class, $googleService); - } - - public function testShouldSendReq() - { - $googleService = $this->getMockBuilder('peter\components\serviceBundle\Services\Google')->getMock(); - $googleService->method('sendReq')->willReturn([ - 'id' => 'http://goo.gl/short_url_name', - ]); - - $config = [ - 'apiKey' => 'google_api_key', - 'longUrl' => 'https://google.com.tw', - ]; - - $googleService->setConfig($config); - $response = $googleService->sendReq(); - - $this->assertSame(0, (int) strpos($response['id'], 'http://goo.gl/')); - } -}