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

Documentation generated on Mon, 11 Mar 2019 13:58:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.