This repository has been archived by the owner on Dec 16, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from constantcontact/development
Promote dev to master
- Loading branch information
Showing
19 changed files
with
618 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.