Permalink
Browse files

- Cleaned the PEAR package information. Ignored some random repositor…

…y files, udated the package.xml to be installable now.
  • Loading branch information...
1 parent 57b7fb2 commit 8075d439929d1ccb791d0a170455cc7d379b8d8c David Coallier committed Aug 18, 2010
@@ -0,0 +1,10 @@
+<?php
+/**
+ * Various configuration required to work with the
+ * package examples.
+ */
+$config = array();
+$config['partyId'] = 1933303;
+$config['appName'] = 'echolibre';
+$config['token'] = '9df0c1dfd1857caf29d83dbef021fbcb';
+$config['opportunityId'] = 28937;
@@ -0,0 +1,69 @@
+<?php
+set_include_path(
+ get_include_path() . PATH_SEPARATOR .
+ dirname(dirname(dirname(__FILE__))));
+
+require_once 'Services/Capsule.php';
+include dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.php';
+
+$appName = $config['appName'];
+$token = $config['token']; // Get that from the website
+$oppId = $config['opportunityId'];
+
+// 1. Let's create a new person in our service
+// 2. Fetch this user using party search
+// 3. Update this user
+// 4. Add him to an opportunity
+// 5. Get a drink.
+
+try {
+ $capsule = new Services_Capsule($appName, $token);
+
+ // #1: Let's create a new person in our service
+ $personInfo = array(
+ 'contacts' => array(
+ 'email' => array(
+ 'type' => 'Work',
+ 'emailAddress' => 'david@echolibre.com',
+ ),
+ ),
+ 'title' => 'Mr',
+ 'firstName' => 'David',
+ 'lastName' => 'Gallchobair'
+ );
+
+ $personAdded = $capsule->person->add($personInfo);
+
+ if ($personAdded !== true) {
+ die('Oh noes could not create person');
+ }
+
+ // #2: Fetch this user using party search
+ $search = $capsule->party->getAny(array(
+ 'email' => 'david@echolibre.com'
+ ));
+
+ if (!isset($search->person->id)) {
+ die('Oh noes could not find the person');
+ }
+
+ // #3: Update this user
+ $personUpdate = array('lastName' => 'Coallier');
+ $personUpdated = $capsule->person->update(
+ $search->person->id, $personUpdate
+ );
+
+ if ($personUpdated !== true) {
+ //die('Oh noes could not update the person');
+ }
+
+ // #4: Add him to an opportunity
+ $added = $capsule->opportunity->party->add(
+ $oppId, $search->person->id
+ );
+
+ // #5: Get a drink.
+
+} catch (Services_Capsule_Exception $e) {
+ print_r($e); die();
+}
@@ -0,0 +1,35 @@
+<?php
+set_include_path(
+ get_include_path() . PATH_SEPARATOR .
+ dirname(dirname(dirname(__FILE__))));
+
+
+require_once 'Services/Capsule.php';
+include dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.php';
+
+// Fetch "Any" by tag
+$getAnyParameters = array(
+ 'tag' => 'sales',
+);
+
+try {
+ $capsule = new Services_Capsule($config['appName'], $config['token']);
+ $res = $capsule->party->getAny($getAnyParameters);
+} catch (Services_Capsule_Exception $e) {
+}
+
+
+$salespeople = array();
+
+if (isset($res->parties) && isset($res->parties->person)) {
+ foreach ($res->parties->person as $person => $details) {
+ $salespeople[$details->id]['info'] = $details;
+
+ $salespeople[$details->id]['opportunities'] =
+ $capsule->opportunity->getAny(
+ array('owner' => $details->firstname . $details->lastname)
+ );
+ }
+}
+
+print_r($salespeople);
@@ -5,8 +5,7 @@
require_once 'Services/Capsule.php';
-
-include '../config.php';
+include dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.php';
// Fetch "Any" by tag
$getAnyParameters = array(
@@ -5,11 +5,11 @@
require_once 'Services/Capsule.php';
-include '../config.php';
+include dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.php';
// Fetch "Any" by email
$getAnyParameters = array(
- 'email' => 'david@echolibre.com',
+ 'tag' => 'sales',
);
try {
View
@@ -6,7 +6,13 @@
$packagexml = new PEAR_PackageFileManager2();
$packagexml->setOptions(array('filelistgenerator' => 'file',
'packagedirectory' => dirname(__FILE__),
- 'baseinstalldir' => 'Services',
+ 'baseinstalldir' => '/',
+ 'dir_roles' => array(
+ 'examples' => 'doc',
+ 'docs' => 'doc',
+ 'tests' => 'test'
+ ),
+ 'ignore' => array('package.php', 'package.xml', 'Services_Capsule.tmprj'),
'simpleoutput' => true));
$packagexml->setPackageType('php');
$packagexml->addRelease();
View
@@ -13,8 +13,8 @@
<email>davidc@php.net</email>
<active>yes</active>
</lead>
- <date>2010-03-31</date>
- <time>22:55:32</time>
+ <date>2010-08-18</date>
+ <time>17:46:33</time>
<version>
<release>0.1.0</release>
<api>0.1.0</api>
@@ -28,83 +28,70 @@
Initial release
</notes>
<contents>
- <dir baseinstalldir="Services" name="/">
- <dir name="cache">
- <file name="2ebcc04e99cbc7cc1ca787d74122d82drest.cachefile" role="data">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="2ebcc04e99cbc7cc1ca787d74122d82drest.cacheid" role="data">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="5e63b049f241d5255445c2faac3adda1rest.cachefile" role="data">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="5e63b049f241d5255445c2faac3adda1rest.cacheid" role="data">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="64b72a98695fccb8c027351f85bbab87rest.cachefile" role="data">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="64b72a98695fccb8c027351f85bbab87rest.cacheid" role="data">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="d632d5e80720c4b591910367acd714d4rest.cachefile" role="data">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="d632d5e80720c4b591910367acd714d4rest.cacheid" role="data">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- </dir> <!-- /cache -->
- <dir name="examples">
- <dir name="live">
- <file name="testopportunityupdate.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- </dir> <!-- /examples/live -->
- <dir name="opportunity">
- <file name="addopportunityhistorynote.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="addopportunitytag.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="deleteopportunitytag.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="getanyopportunity.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="getopportunity.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="getopportunitytags.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="listopportunities.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- </dir> <!-- /examples/opportunity -->
- <dir name="party">
- <file name="getanyparty.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="getparty.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="getpartypeople.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="listparties.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- <file name="searchparties.php" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- </dir> <!-- /examples/party -->
- <file name="config.php.tpl" role="doc">
- <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
- </file>
- </dir> <!-- /examples -->
+ <dir baseinstalldir="/" name="/">
+ <dir name="docs">
+ <dir name="examples">
+ <dir name="Services_Capsule">
+ <dir name="live">
+ <file name="blogexample.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="getoppbysalesperson.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="testopportunityupdate.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ </dir> <!-- /docs/examples/Services_Capsule/live -->
+ <dir name="opportunity">
+ <file name="addopportunityhistorynote.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="addopportunitytag.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="deleteopportunitytag.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="getanyopportunity.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="getopportunity.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="getopportunitytags.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="listopportunities.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ </dir> <!-- /docs/examples/Services_Capsule/opportunity -->
+ <dir name="party">
+ <file name="getanyparty.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="getparty.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="getpartypeople.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="listparties.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="searchparties.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ </dir> <!-- /docs/examples/Services_Capsule/party -->
+ <file name="config.php" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="config.php.tpl" role="doc">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ </dir> <!-- /docs/examples/Services_Capsule -->
+ </dir> <!-- /docs/examples -->
+ </dir> <!-- /docs -->
<dir name="Services">
<dir name="Capsule">
<dir name="Kase">
@@ -123,6 +110,9 @@ Initial release
<file name="Tag.php" role="php">
<tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
</file>
+ <file name="Task.php" role="php">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
</dir> <!-- /Services/Capsule/Kase -->
<dir name="Opportunity">
<file name="Customfield.php" role="php">
@@ -140,6 +130,9 @@ Initial release
<file name="Tag.php" role="php">
<tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
</file>
+ <file name="Task.php" role="php">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
</dir> <!-- /Services/Capsule/Opportunity -->
<dir name="Party">
<file name="Cases.php" role="php">
@@ -160,6 +153,9 @@ Initial release
<file name="Tag.php" role="php">
<tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
</file>
+ <file name="Task.php" role="php">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
</dir> <!-- /Services/Capsule/Party -->
<file name="Common.php" role="php">
<tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
@@ -185,12 +181,35 @@ Initial release
<file name="Resource.php" role="php">
<tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
</file>
+ <file name="Task.php" role="php">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
</dir> <!-- /Services/Capsule -->
<file name="Capsule.php" role="php">
<tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
</file>
</dir> <!-- /Services -->
- <file name="package.php" role="php">
+ <dir name="tests">
+ <file name="AllTests.php" role="test">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="CapsuleOpportunityTestCase.php" role="test">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="CapsulePartyTestCase.php" role="test">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="CapsuleTestCase.php" role="test">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="config.ini" role="test">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ <file name="config.ini-dist" role="test">
+ <tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
+ </file>
+ </dir> <!-- /tests -->
+ <file name="package.xml.old" role="data">
<tasks:replace from="@PEAR-VER@" to="version" type="package-info" />
</file>
<file name="README.md" role="data">
@@ -227,7 +246,7 @@ Initial release
<release>alpha</release>
<api>alpha</api>
</stability>
- <date>2010-03-31</date>
+ <date>2010-08-18</date>
<license uri="http://www.opensource.org/licenses/bsd-license.html">BSD License</license>
<notes>
Initial release

0 comments on commit 8075d43

Please sign in to comment.