Services_Ebay
[ class tree: Services_Ebay ] [ index: Services_Ebay ] [ all elements ]

Source for file AddItem.php

Documentation is available at AddItem.php

  1. <?PHP
  2. /**
  3.  * Add an item to Ebay
  4.  *
  5.  * $Id: AddItem.php,v 1.5 2004/12/14 19:08:25 schst Exp $
  6.  *
  7.  * @package Services_Ebay
  8.  * @author  Stephan Schmidt <schst@php.net>
  9.  * @link    http://developer.ebay.com/DevZone/docs/API_Doc/Functions/AddItem/AddItemLogic.htm
  10.  */
  11. {
  12.    /**
  13.     * verb of the API call
  14.     *
  15.     * @var  string 
  16.     */
  17.     protected $verb = 'AddItem';
  18.  
  19.    /**
  20.     * parameter map that is used, when scalar parameters are passed
  21.     *
  22.     * @var  array 
  23.     */
  24.     protected $paramMap = array();
  25.  
  26.    /**
  27.     * options that will be passed to the serializer
  28.     *
  29.     * @var  array 
  30.     */
  31.     protected $serializerOptions = array(
  32.                                             'mode' => 'simplexml'
  33.                                         );
  34.    /**
  35.     * default parameters that will be used when
  36.     * adding an item
  37.     *
  38.     * @var  array 
  39.     */
  40.     protected $args = array(
  41.                             'CheckoutDetailsSpecified' => 0,
  42.                             'Country'                  => 'us',
  43.                             'Currency'                 => '1',
  44.                             'Duration'                 => '7',
  45.                             'MinimumBid'               => '1.0',
  46.                             'Quantity'                 => '1',
  47.                             'Region'                   => '0',
  48.                             'Version'                  => '2'
  49.                             );
  50.  
  51.    /**
  52.     * item that should be added
  53.     *
  54.     * @var  object Services_Ebay_Model_Item 
  55.     */
  56.     protected $item;
  57.  
  58.    /**
  59.     * constructor
  60.     *
  61.     * @param    array 
  62.     */
  63.     public function __construct($args)
  64.     {
  65.         $item $args[0];
  66.         
  67.         if (!$item instanceof Services_Ebay_Model_Item{
  68.             throw new Services_Ebay_Exception'No item passed.' );
  69.         }
  70.         
  71.         $this->setItem($item);
  72.     }
  73.  
  74.    /**
  75.     * set the item that should be added
  76.     *
  77.     * @param    Services_Ebay_Model_Item 
  78.     * @return   boolean 
  79.     */
  80.     public function setItem(Services_Ebay_Model_Item $item)
  81.     {
  82.         $this->item = $item;
  83.         $this->args = array_merge$this->args$item->toArray() );
  84.         
  85.         return true;
  86.     }
  87.     
  88.    /**
  89.     * make the API call
  90.     *
  91.     * @param    object Services_Ebay_Session 
  92.     * @return   string 
  93.     */
  94.     public function call(Services_Ebay_Session $session)
  95.     {
  96.         $return = parent::call($session);
  97.  
  98.         if (isset($return['Item'])) {
  99.             $returnItem $return['Item'];
  100.  
  101.             $this->item->Id $returnItem['Id'];
  102.             $this->item->StartTime $returnItem['StartTime'];
  103.             $this->item->EndTime $returnItem['EndTime'];
  104.             $this->item->Fees $returnItem['Fees'];
  105.         
  106.             return true;
  107.         }
  108.         return false;
  109.     }
  110. }
  111. ?>

Documentation generated on Mon, 11 Mar 2019 14:19:23 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.