diff --git a/README.md b/README.md index c5662a9a..e4c38280 100644 --- a/README.md +++ b/README.md @@ -73,11 +73,16 @@ composer require jhut89/mailchimp3php Alternatively you may add a require line to your projects `composer.json` for the package `jhut89/mailchimp3php`. -Then run `composer update` and add composer autoloader to your project with: +Then run `composer update` and add the composer autoloader to your project with: ```php require "vendor/autoload.php"; ``` + +You can then use a use statement to pull in the Mailchimp class: +```php +use MailchimpAPI\Mailchimp; +``` ## Instantiation ```php @@ -101,7 +106,7 @@ Mailchimp::getAuthUrl($client_id, $redirect_url); From there the user will input their username and password to approve your application and will be redirected to the `redirect_uri` you set along with a `code`. -With that `code` you can now request an access token from mailchimp. You will need to call the `Mailchimp::oauthExchange()` method statically like this: +With that `code` you can now request an access token from mailchimp. For this you will need to call the `Mailchimp::oauthExchange()` method statically like this: ```php $code = 'abc123abc123abc123abc123'; @@ -241,7 +246,6 @@ There are a number of getters we can use to interact with pieces our `MailchimpR ```php $response->deserialize(); // returns a deserialized (to php object) resource returned by API -$response->getRaw(); // return the raw text response $response->getHttpCode(); // returns an integer representation of the HTTP response code $response->getHeaders(); // returns response headers as an array of key => value pairs $response->getBody(); // return the raw text body of the response @@ -259,7 +263,7 @@ $contact_email = $account ->deserialize() ->email -print $email; // outputs something like "example@domain.com" +print $contact_email; // outputs something like "example@domain.com" ``` ## Method Chart (\*excluding verbs) diff --git a/tests/UtilityTests/MailchimpConnectionTest.php b/tests/UtilityTests/MailchimpConnectionTest.php index 0aa4b34a..5a5b9ba5 100644 --- a/tests/UtilityTests/MailchimpConnectionTest.php +++ b/tests/UtilityTests/MailchimpConnectionTest.php @@ -7,13 +7,29 @@ use MailchimpAPI\Utilities\MailchimpSettings; use MailchimpTests\MailChimpTestCase; +/** + * Class MailchimpConnectionTest + * @package MailchimpTests\UtilityTests + */ final class MailchimpConnectionTest extends MailChimpTestCase { + /** + * @var MailchimpSettings + */ protected $settings; + /** + * @var MailchimpRequest + */ protected $request; + /** + * testable header string + */ const HEADER_STRING = "Foo: Bar"; + /** + * @var array + */ private static $post_params = [ "email_address" => "example@domain.com", "merge_fields" => [ @@ -21,6 +37,13 @@ final class MailchimpConnectionTest extends MailChimpTestCase ] ]; + /** + * MailchimpConnectionTest constructor. + * @param null $name + * @param array $data + * @param string $dataName + * @throws \MailchimpAPI\MailchimpException + */ public function __construct($name = null, array $data = [], $dataName = '') { parent::__construct($name, $data, $dataName); @@ -60,6 +83,9 @@ public function testGetConnection() ); } + /** + * @throws \MailchimpAPI\MailchimpException + */ public function testPostConnection() { $request = $this->request; @@ -78,6 +104,9 @@ public function testPostConnection() ); } + /** + * @throws \MailchimpAPI\MailchimpException + */ public function testPatchConnection() { $request = $this->request; @@ -100,6 +129,9 @@ public function testPatchConnection() ); } + /** + * @throws \MailchimpAPI\MailchimpException + */ public function testPutConnection() { $request = $this->request; @@ -122,6 +154,9 @@ public function testPutConnection() ); } + /** + * @throws \MailchimpAPI\MailchimpException + */ public function testDeleteConnection() { $request = $this->request;