Webservice => WebService
This commit is contained in:
parent
06cb4df177
commit
58673466c0
10
README.md
10
README.md
|
@ -9,7 +9,7 @@ In the future, this distribution will also provide the same API for the
|
|||
GeoIP2 downloadable databases. These databases have not yet been
|
||||
released as a downloadable product.
|
||||
|
||||
See GeoIP2\Webservice\Client for details on the web service client
|
||||
See GeoIP2\WebService\Client for details on the web service client
|
||||
API.
|
||||
|
||||
## Installation ##
|
||||
|
@ -52,7 +52,7 @@ require 'vendor/autoload.php';
|
|||
|
||||
## Usage ##
|
||||
|
||||
To use this API, you must create a new ``\GeoIP2\Webservice\Client``
|
||||
To use this API, you must create a new ``\GeoIP2\WebService\Client``
|
||||
object with your ``$userId`` and ``$licenseKey``, then you call the method
|
||||
corresponding to a specific end point, passing it the IP address you want to
|
||||
look up.
|
||||
|
@ -68,7 +68,7 @@ See the API documentation for more details.
|
|||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
use \GeoIP2\Webservice\Client;
|
||||
use \GeoIP2\WebService\Client;
|
||||
|
||||
$client = new Client(42, 'abcdef123456');
|
||||
$omni = $client->omni('24.24.24.24');
|
||||
|
@ -82,9 +82,9 @@ http://dev.maxmind.com/geoip2/geoip/web-services for the GeoIP2 web service
|
|||
docs.
|
||||
|
||||
If the web service returns an explicit error document, this is thrown as a
|
||||
```\GeoIP2\Exception\WebserviceException```. If some other sort of transport
|
||||
```\GeoIP2\Exception\WebServiceException```. If some other sort of transport
|
||||
error occurs, this is thrown as a ```\GeoIP2\Exception\HttpException```.
|
||||
The difference is that the webservice error includes an error message and
|
||||
The difference is that the web service error includes an error message and
|
||||
error code delivered by the web service. The latter is thrown when some sort
|
||||
of unanticipated error occurs, such as the web service returning a 500 or an
|
||||
invalid error document.
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace GeoIP2\Exception;
|
|||
* This class represents an error returned by MaxMind's GeoIP2 Precision
|
||||
* web service.
|
||||
*/
|
||||
class WebserviceException extends HttpException
|
||||
class WebServiceException extends HttpException
|
||||
{
|
||||
/**
|
||||
* The code returned by the MaxMind web service
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace GeoIP2\Webservice;
|
||||
namespace GeoIP2\WebService;
|
||||
|
||||
use GeoIP2\Exception\GenericException;
|
||||
use GeoIP2\Exception\HttpException;
|
||||
use GeoIP2\Exception\WebserviceException;
|
||||
use GeoIP2\Exception\WebServiceException;
|
||||
use GeoIP2\Model\City;
|
||||
use GeoIP2\Model\CityIspOrg;
|
||||
use GeoIP2\Model\Country;
|
||||
|
@ -52,9 +52,9 @@ use Guzzle\Http\Exception\ServerErrorResponseException;
|
|||
* service docs}.
|
||||
*
|
||||
* If the web service returns an explicit error document, this is thrown as a
|
||||
* {@link \GeoIP2\Exception\WebserviceException}. If some other sort of
|
||||
* {@link \GeoIP2\Exception\WebServiceException}. If some other sort of
|
||||
* transport error occurs, this is thrown as a {@link
|
||||
* \GeoIP2\Exception\HttpException}. The difference is that the webservice
|
||||
* \GeoIP2\Exception\HttpException}. The difference is that the web service
|
||||
* error includes an error message and error code delivered by the web
|
||||
* service. The latter is thrown when some sort of unanticipated error occurs,
|
||||
* such as the web service returning a 500 or an invalid error document.
|
||||
|
@ -112,7 +112,7 @@ class Client
|
|||
* error processing your request.
|
||||
* @throws \GeoIP2\Exception\HttpException if there was an HTTP transport
|
||||
* error.
|
||||
* @throws \GeoIP2\Exception\WebserviceException if an error was returned
|
||||
* @throws \GeoIP2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIP2 web service.
|
||||
*/
|
||||
public function city($ipAddress = 'me')
|
||||
|
@ -133,7 +133,7 @@ class Client
|
|||
* error processing your request.
|
||||
* @throws \GeoIP2\Exception\HttpException if there was an HTTP transport
|
||||
* error.
|
||||
* @throws \GeoIP2\Exception\WebserviceException if an error was returned
|
||||
* @throws \GeoIP2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIP2 web service.
|
||||
*/
|
||||
public function country($ipAddress = 'me')
|
||||
|
@ -154,7 +154,7 @@ class Client
|
|||
* error processing your request.
|
||||
* @throws \GeoIP2\Exception\HttpException if there was an HTTP transport
|
||||
* error.
|
||||
* @throws \GeoIP2\Exception\WebserviceException if an error was returned
|
||||
* @throws \GeoIP2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIP2 web service.
|
||||
*/
|
||||
public function cityIspOrg($ipAddress = 'me')
|
||||
|
@ -175,7 +175,7 @@ class Client
|
|||
* error processing your request.
|
||||
* @throws \GeoIP2\Exception\HttpException if there was an HTTP transport
|
||||
* error.
|
||||
* @throws \GeoIP2\Exception\WebserviceException if an error was returned
|
||||
* @throws \GeoIP2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIP2 web service.
|
||||
*/
|
||||
public function omni($ipAddress = 'me')
|
||||
|
@ -274,7 +274,7 @@ class Client
|
|||
);
|
||||
}
|
||||
|
||||
throw new WebserviceException(
|
||||
throw new WebServiceException(
|
||||
$body['error'],
|
||||
$body['code'],
|
||||
$status,
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace GeoIP2\Test\Webservice;
|
||||
namespace GeoIP2\Test\WebService;
|
||||
|
||||
use GeoIP2\Webservice\Client;
|
||||
use GeoIP2\WebService\Client;
|
||||
use Guzzle\Http\Client as GuzzleClient;
|
||||
use Guzzle\Http\Message\Response;
|
||||
use Guzzle\Plugin\Mock\MockPlugin;
|
||||
|
@ -176,7 +176,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\WebserviceException
|
||||
* @expectedException GeoIP2\Exception\WebServiceException
|
||||
* @expectedExceptionCode 400
|
||||
* @expectedExceptionMessage The value "1.2.3" is not a valid ip address
|
||||
*/
|
Loading…
Reference in New Issue
Block a user