cvs: pear /Services_Ebay Ebay.php /Services_Ebay/Ebay Exception.php /Services_Ebay/Ebay/Call AddItem.php /Services_Ebay/Ebay/Model Item.php
/Services_Ebay/docs todo.txt /Services_Ebay/examples example_AddItem.php example_AddToItemDescription.php example_EndItem.php example_RelistItem.php
example_ReviseItem.php

From: Date: Sun, 07 Nov 2004 12:48:53 +0000
Subject: cvs: pear /Services_Ebay Ebay.php /Services_Ebay/Ebay Exception.php /Services_Ebay/Ebay/Call AddItem.php /Services_Ebay/Ebay/Model Item.php
/Services_Ebay/docs todo.txt /Services_Ebay/examples example_AddItem.php example_AddToItemDescription.php example_EndItem.php example_RelistItem.php
example_ReviseItem.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-25730@lists.php.net to get a copy of this message
schst Sun Nov 7 07:48:53 2004 EDT Modified files: /pear/Services_Ebay Ebay.php /pear/Services_Ebay/Ebay/Call AddItem.php /pear/Services_Ebay/Ebay Exception.php /pear/Services_Ebay/Ebay/Model Item.php /pear/Services_Ebay/docs todo.txt /pear/Services_Ebay/examples example_AddItem.php example_AddToItemDescription.php example_EndItem.php example_RelistItem.php example_ReviseItem.php Log: Caution: BC BREAK! Added Services_Ebay_API_Exception, added Services_Ebay_Model_Item::Add(), renamed some methods in Services_Ebay_Model_Item

http://cvs.php.net/diff.php/pear/Services_Ebay/Ebay.php?r1=1.3&r2=1.4&ty=u Index: pear/Services_Ebay/Ebay.php diff -u pear/Services_Ebay/Ebay.php:1.3 pear/Services_Ebay/Ebay.php:1.4 --- pear/Services_Ebay/Ebay.php:1.3 Fri Oct 29 17:23:05 2004 +++ pear/Services_Ebay/Ebay.php Sun Nov 7 07:48:51 2004 @@ -16,7 +16,7 @@ // | Authors: Stephan Schmidt <schst@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Ebay.php,v 1.3 2004/10/29 21:23:05 schst Exp $ +// $Id: Ebay.php,v 1.4 2004/11/07 12:48:51 schst Exp $ /** * Services/Ebay.php @@ -298,7 +298,7 @@ include_once $filename; } if (!class_exists($classname)) { - throw new Services_Ebay_Exception('API-Call \''.$method.'\' could not be found, please check the spelling'); + throw new Services_Ebay_API_Exception('API-Call \''.$method.'\' could not be found, please check the spelling, remember that method calls are case-sensitive.'); } $call = new $classname($args); return $call; http://cvs.php.net/diff.php/pear/Services_Ebay/Ebay/Call/AddItem.php?r1=1.2&r2=1.3&ty=u Index: pear/Services_Ebay/Ebay/Call/AddItem.php diff -u pear/Services_Ebay/Ebay/Call/AddItem.php:1.2 pear/Services_Ebay/Ebay/Call/AddItem.php:1.3 --- pear/Services_Ebay/Ebay/Call/AddItem.php:1.2 Fri Oct 29 17:16:50 2004 +++ pear/Services_Ebay/Ebay/Call/AddItem.php Sun Nov 7 07:48:52 2004 @@ -2,7 +2,7 @@ /** * Add an item to Ebay * - * $Id: AddItem.php,v 1.2 2004/10/29 21:16:50 schst Exp $ + * $Id: AddItem.php,v 1.3 2004/11/07 12:48:52 schst Exp $ * * @package Services_Ebay * @author Stephan Schmidt <schst@php.net> @@ -59,8 +59,22 @@ if (!$item instanceof Services_Ebay_Model_Item) { throw new Services_Ebay_Exception( 'No item passed.' ); } + + $this->setItem($item); + } + + /** + * set the item that should be added + * + * @param Services_Ebay_Model_Item + * @return boolean + */ + public function setItem(Services_Ebay_Model_Item $item) + { $this->item = $item; $this->args = array_merge( $this->args, $item->toArray() ); + + return true; } /** http://cvs.php.net/diff.php/pear/Services_Ebay/Ebay/Exception.php?r1=1.2&r2=1.3&ty=u Index: pear/Services_Ebay/Ebay/Exception.php diff -u pear/Services_Ebay/Ebay/Exception.php:1.2 pear/Services_Ebay/Ebay/Exception.php:1.3 --- pear/Services_Ebay/Ebay/Exception.php:1.2 Fri Oct 29 17:23:05 2004 +++ pear/Services_Ebay/Ebay/Exception.php Sun Nov 7 07:48:52 2004 @@ -16,7 +16,7 @@ // | Authors: Stephan Schmidt <schst@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Exception.php,v 1.2 2004/10/29 21:23:05 schst Exp $ +// $Id: Exception.php,v 1.3 2004/11/07 12:48:52 schst Exp $ /** * Services/Ebay/Exception.php @@ -62,4 +62,16 @@ class Services_Ebay_Transport_Exception extends Services_Ebay_Exception { } + +/** + * Services_Ebay_API_Exception + * + * API Failure + * + * @package Services_Ebay + * @author Stephan Schmidt <schst@php.net> + */ +class Services_Ebay_API_Exception extends Services_Ebay_Exception +{ +} ?> \ No newline at end of file http://cvs.php.net/diff.php/pear/Services_Ebay/Ebay/Model/Item.php?r1=1.1&r2=1.2&ty=u Index: pear/Services_Ebay/Ebay/Model/Item.php diff -u pear/Services_Ebay/Ebay/Model/Item.php:1.1 pear/Services_Ebay/Ebay/Model/Item.php:1.2 --- pear/Services_Ebay/Ebay/Model/Item.php:1.1 Thu Oct 28 13:14:53 2004 +++ pear/Services_Ebay/Ebay/Model/Item.php Sun Nov 7 07:48:52 2004 @@ -2,7 +2,7 @@ /** * Model for an eBay item * - * $Id: Item.php,v 1.1 2004/10/28 17:14:53 schst Exp $ + * $Id: Item.php,v 1.2 2004/11/07 12:48:52 schst Exp $ * * @package Services_Ebay * @author Stephan Schmidt <schst@php.net> @@ -109,7 +109,7 @@ * @return boolean * @see Services_Ebay_Call_AddToItemDescription */ - public function AddToItemDescription($Description) + public function AddToDescription($Description) { $args = array( 'ItemId' => $this->properties['Id'], @@ -128,7 +128,7 @@ * @return array * @see Services_Ebay_Call_EndItem */ - public function EndItem($EndCode) + public function End($EndCode) { $args = array( 'ItemId' => $this->properties['Id'], @@ -141,6 +141,23 @@ } /** + * Add the item to eBay + * + * This starts a new auction + * + * @see Services_Ebay_Call_RelistItem + */ + public function Add() + { + if (isset($this->properties['ItemId']) && !is_null($this->properties['ItemId'])) { + throw new Services_Ebay_Exception('This item already has an ItemId and thus cannot be added.'); + } + $call = Services_Ebay::loadAPICall('AddItem', array($this)); + + return $call->call($this->session); + } + + /** * Re-list the item * * This adds a new auction with exactly the same item data @@ -148,7 +165,7 @@ * @todo check return value * @see Services_Ebay_Call_RelistItem */ - public function RelistItem() + public function Relist() { $args = array( 'ItemId' => $this->properties['Id'] @@ -165,7 +182,7 @@ * @return boolean * @see Services_Ebay_Call_ReviseItem */ - public function ReviseItem() + public function Revise() { $call = Services_Ebay::loadAPICall('ReviseItem', array($this)); return $call->call($this->session); http://cvs.php.net/diff.php/pear/Services_Ebay/docs/todo.txt?r1=1.1&r2=1.2&ty=u Index: pear/Services_Ebay/docs/todo.txt diff -u pear/Services_Ebay/docs/todo.txt:1.1 pear/Services_Ebay/docs/todo.txt:1.2 --- pear/Services_Ebay/docs/todo.txt:1.1 Thu Oct 28 13:14:53 2004 +++ pear/Services_Ebay/docs/todo.txt Sun Nov 7 07:48:52 2004 @@ -1,6 +1,6 @@ Todo: ----- -$Id: todo.txt,v 1.1 2004/10/28 17:14:53 schst Exp $ +$Id: todo.txt,v 1.2 2004/11/07 12:48:52 schst Exp $ Methods to implement: - AddMemberMessage - AddOrder @@ -38,12 +38,9 @@ Refine these methods: -- GetAccount +- GetAccount() Methods on Models: Transaction: - - AddDispute() - -Item: - - Add() \ No newline at end of file + - AddDispute() \ No newline at end of file http://cvs.php.net/diff.php/pear/Services_Ebay/examples/example_AddItem.php?r1=1.1&r2=1.2&ty=u Index: pear/Services_Ebay/examples/example_AddItem.php diff -u pear/Services_Ebay/examples/example_AddItem.php:1.1 pear/Services_Ebay/examples/example_AddItem.php:1.2 --- pear/Services_Ebay/examples/example_AddItem.php:1.1 Thu Oct 28 13:14:53 2004 +++ pear/Services_Ebay/examples/example_AddItem.php Sun Nov 7 07:48:52 2004 @@ -2,7 +2,7 @@ /** * example that fetches an item * - * $Id: example_AddItem.php,v 1.1 2004/10/28 17:14:53 schst Exp $ + * $Id: example_AddItem.php,v 1.2 2004/11/07 12:48:52 schst Exp $ * * @package Services_Ebay * @subpackage Examples @@ -27,6 +27,10 @@ $result = $ebay->AddItem($item); +// You could as well call the Add() method on the item directly +//$result = $item->Add(); + + if ($result === true) { echo 'Item has been added with ItemId: '.$item->Id.' and ends on '.$item->EndTime.'<br />'; } else { http://cvs.php.net/diff.php/pear/Services_Ebay/examples/example_AddToItemDescription.php?r1=1.1&r2=1.2&ty=u Index: pear/Services_Ebay/examples/example_AddToItemDescription.php diff -u pear/Services_Ebay/examples/example_AddToItemDescription.php:1.1 pear/Services_Ebay/examples/example_AddToItemDescription.php:1.2 --- pear/Services_Ebay/examples/example_AddToItemDescription.php:1.1 Thu Oct 28 13:14:53 2004 +++ pear/Services_Ebay/examples/example_AddToItemDescription.php Sun Nov 7 07:48:52 2004 @@ -2,7 +2,7 @@ /** * example that adds information to the item description * - * $Id: example_AddToItemDescription.php,v 1.1 2004/10/28 17:14:53 schst Exp $ + * $Id: example_AddToItemDescription.php,v 1.2 2004/11/07 12:48:52 schst Exp $ * * @package Services_Ebay * @subpackage Examples @@ -17,7 +17,7 @@ $ebay = new Services_Ebay($session); $item = $ebay->GetItem(4501333179); -$result = $item->AddToItemDescription('He rarely ever used it.'); +$result = $item->AddToDescription('He rarely ever used it.'); if ($result === true) { echo 'Sucessfully added to item description'; http://cvs.php.net/diff.php/pear/Services_Ebay/examples/example_EndItem.php?r1=1.1&r2=1.2&ty=u Index: pear/Services_Ebay/examples/example_EndItem.php diff -u pear/Services_Ebay/examples/example_EndItem.php:1.1 pear/Services_Ebay/examples/example_EndItem.php:1.2 --- pear/Services_Ebay/examples/example_EndItem.php:1.1 Thu Oct 28 13:14:53 2004 +++ pear/Services_Ebay/examples/example_EndItem.php Sun Nov 7 07:48:52 2004 @@ -2,7 +2,7 @@ /** * example that adds information to the item description * - * $Id: example_EndItem.php,v 1.1 2004/10/28 17:14:53 schst Exp $ + * $Id: example_EndItem.php,v 1.2 2004/11/07 12:48:52 schst Exp $ * * @package Services_Ebay * @subpackage Examples @@ -17,7 +17,7 @@ $ebay = new Services_Ebay($session); $item = $ebay->GetItem(4501336808); -$result = $item->EndItem(1); +$result = $item->End(1); echo '<pre>'; print_r($result); http://cvs.php.net/diff.php/pear/Services_Ebay/examples/example_RelistItem.php?r1=1.1&r2=1.2&ty=u Index: pear/Services_Ebay/examples/example_RelistItem.php diff -u pear/Services_Ebay/examples/example_RelistItem.php:1.1 pear/Services_Ebay/examples/example_RelistItem.php:1.2 --- pear/Services_Ebay/examples/example_RelistItem.php:1.1 Thu Oct 28 13:14:53 2004 +++ pear/Services_Ebay/examples/example_RelistItem.php Sun Nov 7 07:48:52 2004 @@ -2,7 +2,7 @@ /** * example that fetches an item * - * $Id: example_RelistItem.php,v 1.1 2004/10/28 17:14:53 schst Exp $ + * $Id: example_RelistItem.php,v 1.2 2004/11/07 12:48:52 schst Exp $ * * @package Services_Ebay * @subpackage Examples @@ -19,7 +19,7 @@ $ebay = new Services_Ebay($session); $item = $ebay->GetItem(4501333179); -$relist = $item->RelistItem(); +$relist = $item->Relist(); echo "<pre>"; print_r($relist); http://cvs.php.net/diff.php/pear/Services_Ebay/examples/example_ReviseItem.php?r1=1.1&r2=1.2&ty=u Index: pear/Services_Ebay/examples/example_ReviseItem.php diff -u pear/Services_Ebay/examples/example_ReviseItem.php:1.1 pear/Services_Ebay/examples/example_ReviseItem.php:1.2 --- pear/Services_Ebay/examples/example_ReviseItem.php:1.1 Thu Oct 28 13:14:53 2004 +++ pear/Services_Ebay/examples/example_ReviseItem.php Sun Nov 7 07:48:52 2004 @@ -2,7 +2,7 @@ /** * example that fetches an item * - * $Id: example_ReviseItem.php,v 1.1 2004/10/28 17:14:53 schst Exp $ + * $Id: example_ReviseItem.php,v 1.2 2004/11/07 12:48:52 schst Exp $ * * @package Services_Ebay * @subpackage Examples @@ -23,9 +23,9 @@ $ebay->ReviseItem($item); /* -You may also use the ReviseItem() method +You may also use the Revise() method directly on the Item object -$item->ReviseItem(); +$item->Revise(); */ ?> \ No newline at end of file
« previous php.pear.cvs (#25730) next »