Skip to content
This repository was archived by the owner on Dec 16, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a520078
Add Library objects File, Folder, and Thumbnail
Oct 31, 2014
8eb14d1
Add PHPDoc for Folder object
Oct 31, 2014
d802e30
Merge remote-tracking branch 'ctct/development' into development
Nov 5, 2014
b1d3ae3
Fix OAuth2 when custom arg_separator.output is defined
jcoby Nov 18, 2014
dcc1424
Merge remote-tracking branch 'ctct/development' into development
Nov 18, 2014
634b778
Update version number in Readme file
Nov 20, 2014
5117e78
Update version number in Readme file
Nov 20, 2014
114c107
Merge pull request #79 from WoogieNoogie/development-ctct
WoogieNoogie Nov 20, 2014
463c554
Triggering welcome & update profile emails
shannon7wallace Nov 24, 2014
08d687d
Merge pull request #74 from jcoby/patch-1
WoogieNoogie Dec 3, 2014
22c7776
Added AccountService and LibraryService methods
Dec 14, 2014
7ac9304
Fixed a typo
Dec 14, 2014
24e71cb
Name fixes
Dec 14, 2014
9b58cfd
Name fixes
Dec 14, 2014
993b401
Name fixes
Dec 14, 2014
e05126d
One last shot at fixing unitTests
Dec 14, 2014
e19e46f
Decided to call the actual strings from Config, cause it works
Dec 15, 2014
cabc1dd
Cleanup
Dec 15, 2014
e9cccab
camelCase ftw
Dec 15, 2014
8725954
Fixing yet another type
Dec 15, 2014
356fc16
Adding methods to top class
Dec 22, 2014
a247b49
Update readme with soon-to-be updated composer info
Dec 22, 2014
23a5ee8
Merge remote-tracking branch 'ctct/development' into development
Dec 23, 2014
d759a28
Fix bad object type
Jan 5, 2015
153d70f
Fix config version number
Jan 5, 2015
da1d2e6
Fix #37 - Column names passed into AddContacts
Jan 13, 2015
679a44a
Fix code review
Jan 14, 2015
135bf03
Correctly Json encode the array of the array because array
Jan 14, 2015
e1471e7
Changing the name of this variable caused issues - reverting
Jan 14, 2015
25dfbd3
Fixed serialization values of other components
Jan 14, 2015
3ad30f4
Refactoring variable names didn't include unit tests
Jan 14, 2015
98fb72f
Merge pull request #83 from WoogieNoogie/development
egaiter Jan 14, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.*"
}
}
```
Expand Down
6 changes: 3 additions & 3 deletions examples/addOrUpdateContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -150,4 +150,4 @@
} ?>

</body>
</html>
</html>
4 changes: 2 additions & 2 deletions src/Ctct/Auth/CtctOAuth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '', '&');
}

/**
Expand All @@ -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);
Expand Down
16 changes: 13 additions & 3 deletions src/Ctct/Components/Account/AccountInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,21 @@ 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
* @var string
*/
public $phone;

/**
* URL of the company logo associated with the account
* @var string
*/
public $company_logo;

/**
* Country code associated with the account
* @var string
Expand Down Expand Up @@ -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);
}
}
4 changes: 4 additions & 0 deletions src/Ctct/Components/Account/VerifiedEmailAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
2 changes: 2 additions & 0 deletions src/Ctct/Components/Activities/AddContacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public function __construct(Array $contacts, Array $lists, Array $columnNames =
}
}
$this->column_names = $usedColumns;
} else {
$this->column_names = $columnNames;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Ctct/Components/Contacts/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
145 changes: 145 additions & 0 deletions src/Ctct/Components/Library/File.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?php
namespace Ctct\Components\Library;

use Ctct\Components\Component;

/**
* Represents a single File in a Constant Contact Library
*
* @package Components
* @subpackage Library
* @author Constant Contact
*/
class File extends Component {
/**
* The ID of the file
* @var String
*/
public $id;

/**
* The name of the file
* @var String
*/
public $name;

/**
* The file's description
* @var String
*/
public $description;

/**
* The name of the folder that the file is in
* @var String
*/
public $folder;

/**
* The ID of the folder that the file is in
* @var String
*/
public $folder_id;

/**
* Is this file an image?
* @var Boolean
*/
public $is_image;

/**
* Type of the file, must be one of "JPG", "GIF", "PDF", "PNG", "DOC", "XLS", "PPT", "DOCX", "XLSX", "PPTX"
* @var String
*/
public $type;

/**
* File's height in pixels, if File is an image
* @var int
*/
public $height;

/**
* File's width in pixels, if File is an image
* @var int
*/
public $width;

/**
* File's size in bytes
* @var int
*/
public $size;

/**
* URL of the image hosted by Constant Contact
* @var String
*/
public $url;

/**
* Source of the image, must be one of "ALL", "MY_COMPUTER", "STOCK_IMAGE", "FACEBOOK", "INSTAGRAM", "SHUTTERSTOCK", "MOBILE"
* @var String
*/
public $source;

/**
* Status of the file, must be one of "ACTIVE", "PROCESSING", "UPLOADED", "VIRUS_FOUND", "FAILED", "DELETED"
* @var String
*/
public $status;

/**
* Thumbnail of the file, if File is an image
* @var Thumbnail
*/
public $thumbnail;

/**
* Date the file was created, in ISO-8601 format
* @var String
*/
public $created_date;

/**
* Date the file was last modified, in ISO-8601 format
* @var String
*/
public $modified_date;

public static function create(array $props) {
$file = new File();

$file->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);
}
}
61 changes: 61 additions & 0 deletions src/Ctct/Components/Library/Folder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
namespace Ctct\Components\Library;

use Ctct\Components\Component;

class Folder extends Component {
/**
* ID of the Folder
* @var String
*/
public $id;

/**
* Name of the Folder
* @var String
*/
public $name;

/**
* Array of Folders that are children of this folder
* @var Folder[]
*/
public $children;

/**
* Number of items in this folder
* @var int
*/
public $item_count;

/**
* ID of this folder's parent, if there is one
* @var String
*/
public $parent_id;

/**
* Depth that this folder is in the hierarchy, must be 1, 2, or 3
* @var int
*/
public $level;

public static function create(array $props) {
$folder = new Folder();

$folder->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);
}
}
41 changes: 41 additions & 0 deletions src/Ctct/Components/Library/Thumbnail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
namespace Ctct\Components\Library;

use Ctct\Components\Component;

/**
* Represents a Thumbnail of a File
*
* @package Components
* @subpackage Library
* @author Constant Contact
*/
class Thumbnail extends Component {
/**
* URL to the thumbnail hosted by Constant Contact
* @var String
*/
public $url;

/**
* Width of the thumbnail, in pixels
* @var int
*/
public $width;

/**
* Height of the thumbnail, in pixels
* @var int
*/
public $height;

public static function create(array $props) {
$thumbnail = new Thumbnail();

$thumbnail->url = parent::getValue($props, "url");
$thumbnail->width = parent::getValue($props, "width");
$thumbnail->height = parent::getValue($props, "height");

return $thumbnail;
}
}
Loading