compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (96)

View Page History
0.3 - 13 July 2008: Ready for Review
0.4 - 29 July 2008: Ready for Recommendation
0.5 - 21 May 2009: Sync with new REST API
{zone-data}

{zone-data:overview}
Zend_Service_37Signals_Basecamp is a an implementation of the Basecamp REST API. All methods return an instance of Zend_Rest_Client_Result.
{zone-data}


{zone-data:dependencies}
* Zend_Http_Client Zend_Rest_Client
* Zend_Http_Client_Exception
* Zend_Service_Abstract
* Zend_Service_Exception
{zone-data}
* Zend_Service_37Signals_Basecamp_Exception
* Zend_Service_37Signals_Basecamp
* Zend_Service_37Signals_Basecamp_AbbreviatedPost
* Zend_Service_37Signals_Basecamp_Comment
* Zend_Service_37Signals_Basecamp_Company
* Zend_Service_37Signals_Basecamp_FileCategory
* Zend_Service_37Signals_Basecamp_MessageCategory
* Zend_Service_37Signals_Basecamp_Milestone
* Zend_Service_37Signals_Basecamp_Person
* Zend_Service_37Signals_Basecamp_Post
* Zend_Service_37Signals_Basecamp_Project
* Zend_Service_37Signals_Basecamp_TimeEntry
* Zend_Service_37Signals_Basecamp_TodoItem
* Zend_Service_37Signals_Basecamp_TodoList
{zone-data}

{code:php}
$options = array(
'urli' => 'http://example.com/',
'login' => 'test',
'password' => 'test',
{code}
||UC-02||
h3. Get summary title for each message in project:
{code:php}
// uses $basecamp from UC-01

foreach ($messages as $messages) {
echo $message->getTitle() . "\n";
echo $message->title . "\n";
}
{code}
||UC-03||
h3. Create new message milestone in project:
{code:php}
// uses $basecamp from UC-01

$projectId = 123;
$categoryId = 456;
$companyId = 'c' . 456;

$data = array(
'title' => 'Some milestone title',
'body' => 'Some body',
'category-id' => $categoryId,
'deadline' => '20090613',
'responsible-party' => $companyId,
'notify' => true,
);

$message = $basecamp->createMessage($data, $projectId);
$milestone = $basecamp->createMilestone($projectId, $data);

echo $message->getId() $milestone->id . "\n";

{code}
class Zend_Service_37Signals_Basecamp_Exception extends Zend_Service_Exception {}

class Zend_Service_37Signals_Basecamp_AbbreviatedPost {}
class Zend_Service_37Signals_Basecamp extends Zend_Rest_Client {

class Zend_Service_37Signals_Basecamp_Comment {}

class Zend_Service_37Signals_Basecamp_Company {}

class Zend_Service_37Signals_Basecamp_FileCategory {}

class Zend_Service_37Signals_Basecamp_MessageCategory {}

class Zend_Service_37Signals_Basecamp_Milestone {}

class Zend_Service_37Signals_Basecamp_Person {}

class Zend_Service_37Signals_Basecamp_Post {

protected $_id;

protected $_title;

// [...]

public function __construct($sxe) { }

public function getId() { }

public function getTitle() { }

// [...]
}

class Zend_Service_37Signals_Basecamp_Project {}

class Zend_Service_37Signals_Basecamp_TimeEntry {}

class Zend_Service_37Signals_Basecamp_TodoItem {}

class Zend_Service_37Signals_Basecamp_TodoList {}

class Zend_Service_37Signals_Basecamp extends Zend_Service_Abstract {

const PATH_FILE_CATEGORY_LIST = '/projects/#{project-id}/attachment_categories';
const PATH_MESSAGE_CATEGORY_LIST = '/projects/#{project-id}/post_categories';
const PATH_PROJECT_LIST = '/project/list';

const PATH_COMMENT = '/msg/comment/#{comment_id}';
const PATH_COMMENT_LIST = '/msg/comments/#{message_id}';
const PATH_COMMENT_CREATE = '/msg/create_comment';
const PATH_COMMENT_DELETE = '/msg/delete_comment/#{comment_id}';
const PATH_COMMENT_UPDATE = '/msg/update_comment';

const PATH_MESSAGE = '/msg/get/#{message_ids}';
const PATH_MESSAGE_LIST = '/projects/#{project_id}/msg/archive';
const PATH_MESSAGE_LIST_CAT = '/projects/#{project_id}/msg/cat/#{category_id}/archive';
const PATH_MESSAGE_CREATE = '/projects/#{project_id}/msg/create';
const PATH_MESSAGE_DELETE = '/msg/delete/#{message_id}';
const PATH_MESSAGE_UPDATE = '/msg/update/#{message_id}';

const PATH_TODO_LIST = '/todos/list/#{id}';
const PATH_TODO_LIST_LIST = '/projects/#{project_id}/todos/lists';
const PATH_TODO_LIST_CREATE = '/projects/#{project_id}/todos/create_list';
const PATH_TODO_LIST_UPDATE = '/todos/update_list/#{id}';
const PATH_TODO_LIST_DELETE = '/todos/delete_list/#{id}';
const PATH_TODO_LIST_MOVE = '/todos/move_list/#{id}';

const PATH_TODO_ITEM_COMPLETE = '/todos/complete_item/#{id}';
const PATH_TODO_ITEM_UNCOMPLETE = '/todos/uncomplete_item/#{id}';
const PATH_TODO_ITEM_CREATE = '/todos/create_item/#{list_id}';
const PATH_TODO_ITEM_UPDATE = '/todos/update_item/#{id}';
const PATH_TODO_ITEM_DELETE = '/todos/delete_item/#{id}';
const PATH_TODO_ITEM_MOVE = '/todos/move_item/#{id}';

const PATH_MILESTONE_LIST = '/projects/#{project_id}/milestones/list';
const PATH_MILESTONE_COMPLETE = '/milestones/complete/#{id}';
const PATH_MILESTONE_UNCOMPLETE = '/milestones/uncomplete/#{id}';
const PATH_MILESTONE_CREATE = '/projects/#{project_id}/milestones/create';
const PATH_MILESTONE_CREATE_BATCH = '/projects/#{project_id}/milestones/create';
const PATH_MILESTONE_UPDATE = 'milestones/update/#{id}';
const PATH_MILESTONE_DELETE = '/milestones/delete/#{id}';

const PATH_TIME_CREATE = '/time/save_entry';
const PATH_TIME_DELETE = '/projects/#{project_id}/time/delete_entry/#{id}';
const PATH_TIME_REPORT = '/time/report/#{person-id}/#{from}/#{to}/#{filter}';
const PATH_TIME_UPDATE = '/time/save_entry/#{id}';

const PATH_COMPANY = '/contacts/company/#{company_id}';
const PATH_COMPANY_LIST = '/contacts/companies';
const PATH_PEOPLE_LIST = '/contacts/people/#{company_id}';
const PATH_PROJECT_PEOPLE_LIST = '/projects/#{project_id}/contacts/people/#{company_id}';
const PATH_PERSON = '/contacts/person/#{person_id}';

protected $_options = array(
'urli' => null,
'login' => null,
'password' => null,

/**
* Initialize HTTP authentication
*
* @return void
*/
protected function _init() { }

/**
* Set options
*
public function getOptions() { }


/**
* General People
*/

public function currentPerson() { }

public function getFileCategories($projectId) getPeople() { }

public function getMessageCategories($projectId) getProjectPeople($projectId) { }

public function getAllProjects() getCompanyPeople($companyId) { }

public function getPerson($personId) { }

/**
* Companies
*/

public function getCompanies() { }

public function getProjectCompanies($projectId) { }

public function getCompany($companyId) { }

/**
* Categories
*/

public function getCategories($projectId, $type) { }

public function getCategory($categoryId) { }

public function createCategory($projectId, $data) { }

public function updateCategory($categoryId, $data) { }

public function destroyCategory($categoryId) { }

/**
* Messages
*/

public function getMessages($projectId) { }

public function getFullMessages($messageIds) getMessage($messageId) { }

public function getMessagesByCategory($projectId, $categoryId) { }

public function getMessages($projectId, $categoryId) getArchivedMessages($projectId) { }

public function getAllMessages($projectId) getArchivedMessagesByCategory($projectId, $categoryId) { }

public function newMessage($projectId)

public function createMessage($projectId, $data) { }

public function createMessage($data, $projectId) editMessage($messageId) { }

public function updateMessage($messageId, $data) { }

public function deleteMessage($messageId) destroyMessage($messageId) { }

public function updateMessage($data) { }

/**
* Comments
*/

public function getAllComments($resource, $resourceId) { }

public function getComment($commentId) { }

public function getComments($messageId) newComment($resource, $resourceId) { }

public function createComment($resource, $resourceId, $data) { }

public function createComment($data) editComment($commentId) { }

public function deleteComment($commentId) updateComment($commentId, $data) { }

public function updateComment($data) destroyComment($commentId) { }

/**
* To-do Lists
*/
public function getAllLists($responsibleParty) { }

public function getAllListsByProject($projectId, $filter) { }

public function getTodoList($todoListId) getList($listId) { }

public function editList($listId) { }

public function getTodoLists($projectId, $complete) updateList($listId, $data) { }

public function createTodoList($data, $projectId) newList($projectId) { }

public function deleteTodoList($todoListId) createList($projectId, $data) { }

public function updateTodoList($data) destroyList($listId) { }

public function moveTodoList($data, $todoListId) reorderList($projectId, $data) { }

/**
* To-do Items
*/

public function completeTodoItem($todoItemId) getAllItems($todoListId) { }

public function uncompleteTodoItem($todoItemId) getItem($todoItemId) { }

public function createTodoItem($data, $todoListId) completeItem($todoItemId) { }

public function deleteTodoItem($todoItemId) uncompleteItem($todoItemId) { }

public function updateTodoItem($data) newItem($todoListId) { }

public function moveTodoItem($data, $todoItemId) createItem($todoListId, $data) { }

public function updateItem($todoItemId, $data) { }

public function editItem($todoItemId) { }

public function destroyItem($todoItemId) { }

public function reorderItems($todoListId, $data) { }

/**
* Milestones
*/
public function getAllMilestones($projectId, $find) { }

public function getMilestones($projectId, $find = 'all') { }

public function completeMilestone($milestoneId) { }

public function uncompleteMilestone($milestoneId) { }

public function createMilestone($data, $projectId, $data) { }

public function createMilestones($data, $projectId) createMultipleMilestones($projectId, $data) { }

public function updateMilestone($milestoneId, $data) { }

public function deleteMilestone($milestoneId) { }

public function updateMilestone($data) { }

/**
* Time Tracking
*/

public function createTime($data) getAllEntriesByProject($projectId, $page = 1) { }

public function deleteTime($timeId, $projectId) getAllEntriesByTodoItem($todoItemId) { }

public function createEntry($resourceType, $resourceId, $data) { }

public function updateTime($data) newEntry($projectId) { }

public function reportTime($personId, $from, $to, $filter) getEntry($entryId) { }

/**
* Contact management public function editEntry($entryId) { }
*/

public function updateEntry($entryId, $data) { }

public function getCompany($companyId) destroyEntry($entryId) { }

public function getCompanies() { }
public function reportEntries($from, $to, $subjectId, $todoItemId, $filterProjectId, $filterCompanyId) { }
public function getPeople($companyId) { }

public function getProjectPeople($companyId, $projectId) { }

public function getPerson($personId) { }

/**
* Utility methods Files
*/
public function uploadFile($contentType, $contentLength, $body) { }

protected function _parseResponse($response) { }
}
{code}