diff --git a/README.md b/README.md index 2bd23ca..5bf57e7 100755 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Composer is a dependency management tool for PHP that allows you to declare the ```javascript { "require": { - "constantcontact/constantcontact": "1.1.*" + "constantcontact/constantcontact": "1.3.*" } } ``` diff --git a/examples/addOrUpdateContact.php b/examples/addOrUpdateContact.php index c74a103..6398756 100644 --- a/examples/addOrUpdateContact.php +++ b/examples/addOrUpdateContact.php @@ -62,7 +62,7 @@ * * See: http://developer.constantcontact.com/docs/contacts-api/contacts-index.html#opt_in */ - $returnContact = $cc->addContact(ACCESS_TOKEN, $contact, false); + $returnContact = $cc->addContact(ACCESS_TOKEN, $contact, true); // update the existing contact if address already existed } else { @@ -80,7 +80,7 @@ * * See: http://developer.constantcontact.com/docs/contacts-api/contacts-index.html#opt_in */ - $returnContact = $cc->updateContact(ACCESS_TOKEN, $contact, false); + $returnContact = $cc->updateContact(ACCESS_TOKEN, $contact, true); } // catch any exceptions thrown during the process and print the errors to screen @@ -150,4 +150,4 @@ } ?> - \ No newline at end of file + diff --git a/src/Ctct/Auth/CtctOAuth2.php b/src/Ctct/Auth/CtctOAuth2.php index 870e051..0c5e1b9 100755 --- a/src/Ctct/Auth/CtctOAuth2.php +++ b/src/Ctct/Auth/CtctOAuth2.php @@ -47,7 +47,7 @@ public function getAuthorizationUrl($server = true, $state = null) } $url = Config::get('auth.base_url') . Config::get('auth.authorization_endpoint'); - return $url . '?' . http_build_query($params); + return $url . '?' . http_build_query($params, '', '&'); } /** @@ -66,7 +66,7 @@ public function getAccessToken($code) 'redirect_uri' => $this->redirectUri ); - $url = Config::get('auth.base_url') . Config::get('auth.token_endpoint') . '?' . http_build_query($params); + $url = Config::get('auth.base_url') . Config::get('auth.token_endpoint') . '?' . http_build_query($params, '', '&'); $response = $this->restClient->post($url); $responseBody = json_decode($response->body, true); diff --git a/src/Ctct/Components/Account/AccountInfo.php b/src/Ctct/Components/Account/AccountInfo.php index 2937bc3..6aae3dd 100644 --- a/src/Ctct/Components/Account/AccountInfo.php +++ b/src/Ctct/Components/Account/AccountInfo.php @@ -45,9 +45,8 @@ class AccountInfo extends Component /** * Email address associated with the account * @var string - * NOTE: the API returns 'email' field instead of 'email_address', but 'email_address' is used elsewhere */ - public $email_address; + public $email; /** * Phone number associated with the account @@ -55,6 +54,12 @@ class AccountInfo extends Component */ public $phone; + /** + * URL of the company logo associated with the account + * @var string + */ + public $company_logo; + /** * Country code associated with the account * @var string @@ -86,12 +91,17 @@ public static function create(array $props) $accountInfo->time_zone = parent::getValue($props, "time_zone"); $accountInfo->first_name = parent::getValue($props, "first_name"); $accountInfo->last_name = parent::getValue($props, "last_name"); - $accountInfo->email_address = parent::getValue($props, "email"); + $accountInfo->email = parent::getValue($props, "email"); $accountInfo->phone = parent::getValue($props, "phone"); + $accountInfo->company_logo = parent::getValue($props, "company_logo"); $accountInfo->country_code = parent::getValue($props, "country_code"); $accountInfo->state_code = parent::getValue($props, "state_code"); $accountInfo->organization_addresses = parent::getValue($props, "organization_addresses"); return $accountInfo; } + + public function toJson() { + return json_encode($this); + } } diff --git a/src/Ctct/Components/Account/VerifiedEmailAddress.php b/src/Ctct/Components/Account/VerifiedEmailAddress.php index cfcbce1..1898f35 100644 --- a/src/Ctct/Components/Account/VerifiedEmailAddress.php +++ b/src/Ctct/Components/Account/VerifiedEmailAddress.php @@ -36,4 +36,8 @@ public static function create(array $props) $verifiedAddress->status = parent::getValue($props, "status"); return $verifiedAddress; } + + public function toJson() { + return json_encode($this); + } } diff --git a/src/Ctct/Components/Activities/AddContacts.php b/src/Ctct/Components/Activities/AddContacts.php index 9ae7604..8cd432f 100644 --- a/src/Ctct/Components/Activities/AddContacts.php +++ b/src/Ctct/Components/Activities/AddContacts.php @@ -99,6 +99,8 @@ public function __construct(Array $contacts, Array $lists, Array $columnNames = } } $this->column_names = $usedColumns; + } else { + $this->column_names = $columnNames; } } diff --git a/src/Ctct/Components/Contacts/Address.php b/src/Ctct/Components/Contacts/Address.php index 7a5931c..268b2a9 100755 --- a/src/Ctct/Components/Contacts/Address.php +++ b/src/Ctct/Components/Contacts/Address.php @@ -81,7 +81,7 @@ class Address extends Component /** * Factory method to create an Address object from an array - * @array $props - Associative array of initial properties to set + * @param array $props - Associative array of initial properties to set * @return Address */ public static function create(array $props) diff --git a/src/Ctct/Components/Library/File.php b/src/Ctct/Components/Library/File.php new file mode 100644 index 0000000..dc70978 --- /dev/null +++ b/src/Ctct/Components/Library/File.php @@ -0,0 +1,145 @@ +id = parent::getValue($props, "id"); + $file->name = parent::getValue($props, "name"); + $file->description = parent::getValue($props, "description"); + $file->folder = parent::getValue($props, "folder"); + $file->folder_id = parent::getValue($props, "folder_id"); + $file->is_image = parent::getValue($props, "is_image"); + $file->type = parent::getValue($props, "file_type"); + $file->height = parent::getValue($props, "height"); + $file->width = parent::getValue($props, "width"); + $file->size = parent::getValue($props, "size"); + $file->url = parent::getValue($props, "url"); + $file->source = parent::getValue($props, "source"); + $file->status = parent::getValue($props, "status"); + if (array_key_exists("thumbnail", $props)) { + $file->thumbnail = Thumbnail::create($props['thumbnail']); + } + $file->created_date = parent::getValue($props, "created_date"); + $file->modified_date = parent::getValue($props, "modified_date"); + + return $file; + } + + /** + * Create json used for a POST/PUT request, also handles removing attributes that will cause errors if sent + * @return String + */ + public function toJson() { + unset($this->created_date); + unset($this->modified_date); + unset($this->status); + return json_encode($this); + } +} \ No newline at end of file diff --git a/src/Ctct/Components/Library/Folder.php b/src/Ctct/Components/Library/Folder.php new file mode 100644 index 0000000..f7f9ff9 --- /dev/null +++ b/src/Ctct/Components/Library/Folder.php @@ -0,0 +1,61 @@ +id = parent::getValue($props, "id"); + $folder->name = parent::getValue($props, "name"); + foreach ($props['children'] as $child) { + $folder->children[] = Folder::create($child); + } + $folder->item_count = parent::getValue($props, "item_count"); + $folder->parent_id = parent::getValue($props, "parent_id"); + $folder->level = parent::getValue($props, "level"); + + return $folder; + } + + public function toJson() { + return json_encode($this); + } +} \ No newline at end of file diff --git a/src/Ctct/Components/Library/Thumbnail.php b/src/Ctct/Components/Library/Thumbnail.php new file mode 100644 index 0000000..4160e96 --- /dev/null +++ b/src/Ctct/Components/Library/Thumbnail.php @@ -0,0 +1,41 @@ +url = parent::getValue($props, "url"); + $thumbnail->width = parent::getValue($props, "width"); + $thumbnail->height = parent::getValue($props, "height"); + + return $thumbnail; + } +} \ No newline at end of file diff --git a/src/Ctct/ConstantContact.php b/src/Ctct/ConstantContact.php index 9ed9eed..19b4e31 100755 --- a/src/Ctct/ConstantContact.php +++ b/src/Ctct/ConstantContact.php @@ -3,12 +3,14 @@ use Ctct\Services\AccountService; use Ctct\Services\ContactService; +use Ctct\Services\LibraryService; use Ctct\Services\ListService; use Ctct\Services\EmailMarketingService; use Ctct\Services\CampaignScheduleService; use Ctct\Services\CampaignTrackingService; use Ctct\Services\ContactTrackingService; use Ctct\Services\ActivityService; +use Ctct\Components\Account\AccountInfo; use Ctct\Components\Activities\Activity; use Ctct\Components\Contacts\Contact; use Ctct\Components\Contacts\ContactList; @@ -86,6 +88,12 @@ class ConstantContact */ protected $accountService; + /** + * Handles interaction with Library management + * @var LibraryService + */ + protected $libraryService; + /** * Class constructor * Registers the API key with the ConstantContact class that will be used for all API calls. @@ -102,6 +110,7 @@ public function __construct($apiKey) $this->campaignScheduleService = new CampaignScheduleService($apiKey); $this->listService = new ListService($apiKey); $this->accountService = new AccountService($apiKey); + $this->libraryService = new LibraryService($apiKey); } /** @@ -683,14 +692,82 @@ public function getVerifiedEmailAddresses($accessToken, $status = null) return $this->accountService->getVerifiedEmailAddresses($accessToken, $params); } + /** + * Create new verified email addresses. This will also prompt the account to send + * a verification email to the address. + * @param string $accessToken - Constant Contact OAuth2 Access Token + * @param string $emailAddress - email address to create + * @return array - array of VerifiedEmailAddress created + */ + public function createVerifiedEmailAddress($accessToken, $emailAddress) + { + return $this->accountService->createVerifiedEmailAddress($accessToken, $emailAddress); + } + /** * Get details for account associated with an access token * @param string $accessToken - Constant Contact OAuth2 access token - * @return AccountInfo object + * @return AccountInfo + */ + public function getAccountInfo($accessToken) + { + return $this->accountService->getAccountInfo($accessToken); + } + + /** + * Update information of the account. + * @param string $accessToken - Constant Contact OAuth2 Access Token + * @param AccountInfo $accountInfo - Updated AccountInfo + * @return AccountInfo + */ + public function updateAccountInfo($accessToken, $accountInfo) + { + return $this->accountService->updateAccountInfo($accessToken, $accountInfo); + } + + /** + * @param string $accessToken - Constant Contact OAuth2 access token + * @param string $fileId - File Id + * @return File + */ + public function getLibraryFile($accessToken, $fileId) + { + return $this->libraryService->getLibraryFile($accessToken, $fileId); + } + + /** + * @param string $accessToken - Constant Contact OAuth2 access token + * @param string $folderId - Optionally search for files in a specified folder + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 1000, default = 50. + * sort_by - Specifies how the list of files is sorted; valid sort options are: + * CREATED_DATE, CREATED_DATE_DESC, MODIFIED_DATE, MODIFIED_DATE_DESC, NAME, NAME_DESC, SIZE, SIZE_DESC DIMENSION, DIMENSION_DESC + * source - Specifies to retrieve files from a particular source: + * ALL, MyComputer, Facebook, Instagram, Shutterstock, Mobile + * next - the next link returned from a previous paginated call. May only be used by itself. + * @return ResultSet - Containing a results array of {@link Ctct\Components\Library\File} + */ + public function getLibraryFiles($accessToken, $folderId = null, array $params = array()) + { + if ($folderId) { + return $this->libraryService->getLibraryFilesByFolder($accessToken, $folderId, $params); + } + return $this->libraryService->getLibraryFiles($accessToken, $params); + } + + /** + * @param string $accessToken - Constant Contact OAuth2 access token + * @param mixed $params - associative array of query parameters and values to append to the request. + * Allowed parameters include: + * limit - Specifies the number of results displayed per page of output, from 1 - 1000, default = 50. + * sort_by - Specifies how the list of files is sorted; valid sort options are: + * CREATED_DATE, CREATED_DATE_DESC, MODIFIED_DATE, MODIFIED_DATE_DESC, NAME, NAME_DESC + * @return ResultSet */ - public function getAccountInfo($accessToken, array $params = array()) + public function getLibraryFolders($accessToken, array $params = array()) { - return $this->accountService->getAccountInfo($accessToken, $params); + return $this->libraryService->getLibraryFolders($accessToken, $params); } /** diff --git a/src/Ctct/Services/AccountService.php b/src/Ctct/Services/AccountService.php index d387684..f6c4a08 100644 --- a/src/Ctct/Services/AccountService.php +++ b/src/Ctct/Services/AccountService.php @@ -21,8 +21,7 @@ class AccountService extends BaseService */ public function getVerifiedEmailAddresses($accessToken, Array $params) { - $baseUrl = Config::get('endpoints.base_url') - . sprintf(Config::get('endpoints.account_verified_addresses')); + $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.account_verified_addresses'); $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); @@ -35,19 +34,55 @@ public function getVerifiedEmailAddresses($accessToken, Array $params) return $verifiedAddresses; } + /** + * Create a new verified email address. This will also prompt the account to send + * a verification email to the address. + * @param string $accessToken - Constant Contact OAuth2 Access Token + * @param string $emailAddress - email address to create + * @return array - array of VerifiedEmailAddress created + */ + public function createVerifiedEmailAddress($accessToken, $emailAddress) + { + $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.account_verified_addresses'); + $request = array(array("email_address" => $emailAddress)); + + $url = $this->buildUrl($baseUrl); + $response = parent::getRestClient()->post($url, parent::getHeaders($accessToken), json_encode($request)); + $verifiedAddresses = array(); + + foreach (json_decode($response->body, true) as $verifiedAddress) { + $verifiedAddresses[] = VerifiedEmailAddress::create($verifiedAddress); + } + + return $verifiedAddresses; + } + /** * Get account info associated with an access token * @param string $accessToken - Constant Contact OAuth2 Access Token - * @param array $params - array of query parameters/values to append to the request * @return AccountInfo */ - public function getAccountInfo($accessToken, Array $params) + public function getAccountInfo($accessToken) { - $baseUrl = Config::get('endpoints.base_url') - . sprintf(Config::get('endpoints.account_info')); + $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.account_info'); - $url = $this->buildUrl($baseUrl, $params); + $url = $this->buildUrl($baseUrl); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); return AccountInfo::create(json_decode($response->body, true)); } + + /** + * Update information of the account. + * @param string $accessToken - Constant Contact OAuth2 Access Token + * @param AccountInfo $accountInfo - Updated AccountInfo + * @return AccountInfo + */ + public function updateAccountInfo($accessToken, AccountInfo $accountInfo) + { + $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.account_info'); + + $url = $this->buildUrl($baseUrl); + $response = parent::getRestClient()->put($url, parent::getHeaders($accessToken), $accountInfo->toJson()); + return AccountInfo::create(json_decode($response->body, true)); + } } diff --git a/src/Ctct/Services/LibraryService.php b/src/Ctct/Services/LibraryService.php new file mode 100644 index 0000000..3caa34c --- /dev/null +++ b/src/Ctct/Services/LibraryService.php @@ -0,0 +1,87 @@ +buildUrl($baseUrl, $params); + $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); + $body = json_decode($response->body, true); + $libraryFiles = array(); + + foreach ($body['results'] as $file) { + $libraryFiles[] = File::create($file); + } + return new ResultSet($libraryFiles, $body['meta']); + } + + /** + * Get files from the Library in a specific Folder + * @param string $accessToken - Constant Contact OAuth2 Access Token + * @param string $folderId - Specified Folder Id + * @param array $params - array of query parameters/values to append to the request + * @return ResultSet + */ + public function getLibraryFilesByFolder($accessToken, $folderId, Array $params) + { + $baseUrl = Config::get('endpoints.base_url') + . sprintf(Config::get('endpoints.library_files_by_folder'), $folderId); + $url = $this->buildUrl($baseUrl, $params); + $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); + $body = json_decode($response->body, true); + $libraryFiles = array(); + + foreach ($body['results'] as $file) { + $libraryFiles[] = File::create($file); + } + return new ResultSet($libraryFiles, $body['meta']); + } + + /** + * Get File by Id + * @param string $accessToken - Constant Contact OAuth2 Access Token + * @param string $fileId - Specified File Id + * @return File + */ + public function getLibraryFile($accessToken, $fileId) + { + $baseUrl = Config::get('endpoints.base_url') + . sprintf(Config::get('endpoints.library_file'), $fileId); + $url = $this->buildUrl($baseUrl); + $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); + return File::create(json_decode($response->body, true)); + } + + /** + * Get folders from the Library + * @param string $accessToken - Constant Contact OAuth2 Access Token + * @param array $params - array of query parameters/values to append to the request + * @return ResultSet + */ + public function getLibraryFolders($accessToken, Array $params) + { + $baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.library_folders'); + $url = $this->buildUrl($baseUrl, $params); + $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); + $body = json_decode($response->body, true); + $libraryFolders = array(); + + foreach ($body['results'] as $folder) { + $libraryFolders[] = Folder::create($folder); + } + return new ResultSet($libraryFolders, $body['meta']); + } +} \ No newline at end of file diff --git a/src/Ctct/Util/Config.php b/src/Ctct/Util/Config.php index b3b65d4..b8ffac9 100755 --- a/src/Ctct/Util/Config.php +++ b/src/Ctct/Util/Config.php @@ -55,7 +55,12 @@ class Config 'contact_tracking_opens' => 'contacts/%s/tracking/opens', 'contact_tracking_sends' => 'contacts/%s/tracking/sends', 'contact_tracking_unsubscribes' => 'contacts/%s/tracking/unsubscribes', - 'contact_tracking_link' => 'contacts/%s/tracking/clicks/%s' + 'contact_tracking_link' => 'contacts/%s/tracking/clicks/%s', + 'library_files' => 'library/files', + 'library_file' => 'library/files/%s', + 'library_folders' => 'library/folders', + 'library_folder' => 'library/folders/%s', + 'library_files_by_folder' => 'library/folders/%s/files' ), /** @@ -118,7 +123,7 @@ class Config * Setting the version fo the application used in Rest Calls when setting the version header */ 'settings' => array( - 'version' => '1.2.0' + 'version' => '1.3.0' ), ); diff --git a/test/Json/Account/get_account_info.json b/test/Json/Account/get_account_info.json new file mode 100644 index 0000000..4aa3805 --- /dev/null +++ b/test/Json/Account/get_account_info.json @@ -0,0 +1,21 @@ +{ + "website":"http://www.example.com", + "organization_name":"My Company", + "time_zone":"US/Eastern", + "first_name":"Mary Jane", + "last_name":"Doe", + "email":"mjdoe@example.com", + "phone":"5555555555", + "company_logo":"https://ih.constantcontact.com/fs137/1100371573368/img/90.jpg", + "country_code":"US", + "state_code":"MA", + "organization_addresses":[ + { + "city": "Anytown", + "line1":"123 Maple Street", + "postal_code":"11111", + "country_code":"US", + "state_code":"MA" + } + ] +} \ No newline at end of file diff --git a/test/Json/JsonLoader.php b/test/Json/JsonLoader.php index ce8dd12..39d6d7d 100755 --- a/test/Json/JsonLoader.php +++ b/test/Json/JsonLoader.php @@ -10,6 +10,7 @@ class JsonLoader const ACTIVITES_FOLDER = "/Activities"; const ACCCOUNT_FOLDER = "/Account"; const AUTH_FOLDER = "/Auth"; + const LIBRARY_FOLDER = "/Library"; public static function getContactsTextContents() { @@ -36,6 +37,16 @@ public static function getVerifiedAddressesJson() return file_get_contents(__DIR__ . self::ACCCOUNT_FOLDER . "/get_verified_email_addresses.json"); } + public static function getAccountInfoJson() + { + return file_get_contents(__DIR__ . self::ACCCOUNT_FOLDER . "/get_account_info.json"); + } + + public static function getLibraryFileJson() + { + return file_get_contents(__DIR__ . self::LIBRARY_FOLDER . "/get_library_file.json"); + } + public static function getContactJson() { return file_get_contents(__DIR__ . self::CONTACTS_FOLDER . "/get_contact.json"); diff --git a/test/Json/Library/get_library_file.json b/test/Json/Library/get_library_file.json new file mode 100644 index 0000000..b71f531 --- /dev/null +++ b/test/Json/Library/get_library_file.json @@ -0,0 +1,22 @@ +{ + "name": "IMG_0261.JPG", + "id": "4", + "description": "chocolates", + "folder": "Images", + "height": 600, + "width": 800, + "size": 68825, + "url": "https://origin.ih.l1.constantcontact.com/fs115/1100310339939/img/4.jpg", + "source": "MyComputer", + "status": "Active", + "thumbnail": { + "url": "https://origin.ih.l1.constantcontact.com/fs115/1100310339939/img/4.jpg", + "height": 150, + "width": 200 + }, + "created_date": "2013-06-19T11:36:43.000-04:00", + "modified_date": "2013-08-23T12:54:17.000-04:00", + "folder_id": null, + "is_image": true, + "file_type": "JPG" +} \ No newline at end of file diff --git a/test/Services/AccountServiceUnitTest.php b/test/Services/AccountServiceUnitTest.php index 8fb108a..6dbd1ac 100644 --- a/test/Services/AccountServiceUnitTest.php +++ b/test/Services/AccountServiceUnitTest.php @@ -29,4 +29,29 @@ public function testGetVerifiedAddresses() $this->assertEquals("test123@roving.com", $response[0]->email_address); $this->assertEquals("CONFIRMED", $response[0]->status); } + + public function testGetAccountInfo() + { + $curlResponse = CurlResponse::create(JsonLoader::getAccountInfoJson(), array('http_code' => 200)); + $this->restClient->expects($this->once()) + ->method('get') + ->with() + ->will($this->returnValue($curlResponse)); + + $response = $this->accountService->getAccountInfo("accessToken"); + + $this->assertInstanceOf('Ctct\Components\Account\AccountInfo', $response); + $this->assertEquals("http://www.example.com", $response->website); + $this->assertEquals("My Company", $response->organization_name); + $this->assertEquals("http://www.example.com", $response->website); + $this->assertEquals("My Company", $response->organization_name); + $this->assertEquals("US/Eastern", $response->time_zone); + $this->assertEquals("Mary Jane", $response->first_name); + $this->assertEquals("Doe", $response->last_name); + $this->assertEquals("mjdoe@example.com", $response->email); + $this->assertEquals("5555555555", $response->phone); + $this->assertEquals("https://ih.constantcontact.com/fs137/1100371573368/img/90.jpg", $response->company_logo); + $this->assertEquals("US", $response->country_code); + $this->assertEquals("MA", $response->state_code); + } } diff --git a/test/Services/LibraryServiceUnitTest.php b/test/Services/LibraryServiceUnitTest.php new file mode 100644 index 0000000..901750e --- /dev/null +++ b/test/Services/LibraryServiceUnitTest.php @@ -0,0 +1,50 @@ +restClient = $this->getMock('Ctct\Util\RestClientInterface'); + $this->libraryService = new LibraryService("apikey", $this->restClient); + } + + public function testGetLibraryFile() + { + $curlResponse = CurlResponse::create(JsonLoader::getLibraryFileJson(), array('http_code' => 200)); + $this->restClient->expects($this->once()) + ->method('get') + ->with() + ->will($this->returnValue($curlResponse)); + + $response = $this->libraryService->getLibraryFile("accessToken", "4"); + + $this->assertInstanceOf('Ctct\Components\Library\File', $response); + $this->assertEquals("IMG_0261.JPG", $response->name); + $this->assertEquals("4", $response->id); + $this->assertEquals("chocolates", $response->description); + $this->assertEquals("Images", $response->folder); + $this->assertEquals(600, $response->height); + $this->assertEquals(800, $response->width); + $this->assertEquals(68825, $response->size); + $this->assertEquals("https://origin.ih.l1.constantcontact.com/fs115/1100310339939/img/4.jpg", $response->url); + $this->assertEquals("MyComputer", $response->source); + $this->assertEquals("Active", $response->status); + + $this->assertInstanceOf('Ctct\Components\Library\Thumbnail', $response->thumbnail); + $this->assertEquals("https://origin.ih.l1.constantcontact.com/fs115/1100310339939/img/4.jpg", $response->thumbnail->url); + $this->assertEquals(200, $response->thumbnail->width); + $this->assertEquals(150, $response->thumbnail->height); + + $this->assertEquals("2013-06-19T11:36:43.000-04:00", $response->created_date); + $this->assertEquals("2013-08-23T12:54:17.000-04:00", $response->modified_date); + $this->assertEquals(null, $response->folder_id); + $this->assertEquals(true, $response->is_image); + $this->assertEquals("JPG", $response->type); + } +} \ No newline at end of file