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$
  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.     * compatibility level this method was introduced
  21.     *
  22.     * @var integer 
  23.     */
  24.     protected $since = 465;
  25.  
  26.    /**
  27.     * parameter map that is used, when scalar parameters are passed
  28.     *
  29.     * @var  array 
  30.     */
  31.     protected $paramMap = array();
  32.  
  33.    /**
  34.     * options that will be passed to the serializer
  35.     *
  36.     * @var  array 
  37.     */
  38.     protected $serializerOptions = array(
  39.                                             'mode' => 'simplexml'
  40.                                         );
  41.    /**
  42.     * default parameters that will be used when
  43.     * adding an item
  44.     *
  45.     * @var  array 
  46.     */
  47.     protected $args = array(
  48.                             'Item' => array(
  49.                                             'ShippingDetails'   => array(
  50.                                                                             'InsuranceFee' => 0
  51.                                                                         ),
  52.                                             'Country'           => 'US',
  53.                                             'Currency'          => 'USD',
  54.                                             'StartPrice'        => '1.0',
  55.                                             'Quantity'          => '1'
  56.                                            ),
  57.                            );
  58.  
  59.    /**
  60.     * item that should be added
  61.     *
  62.     * @var  object Services_Ebay_Model_Item 
  63.     */
  64.     protected $item;
  65.  
  66.    /**
  67.     * constructor
  68.     *
  69.     * @param    array 
  70.     */
  71.     public function __construct($args)
  72.     {
  73.         $item $args[0];
  74.         
  75.         if (!$item instanceof Services_Ebay_Model_Item{
  76.             throw new Services_Ebay_Exception'No item passed.' );
  77.         }
  78.         
  79.         $this->setItem($item);
  80.     }
  81.  
  82.    /**
  83.     * set the item that should be added
  84.     *
  85.     * @param    Services_Ebay_Model_Item 
  86.     * @return   boolean 
  87.     */
  88.     public function setItem(Services_Ebay_Model_Item $item)
  89.     {
  90.         $this->item = $item;
  91.         $this->args = array_merge$this->args$item->toArray() );
  92.         
  93.         return true;
  94.     }
  95.     
  96.    /**
  97.     * make the API call
  98.     *
  99.     * @param    object Services_Ebay_Session 
  100.     * @return   string 
  101.     */
  102.     public function call(Services_Ebay_Session $session)
  103.     {
  104.         $return = parent::call($session);
  105.  
  106.         if (isset($return['ItemID'])) {
  107.             $this->item->Id $return['ItemID'];
  108.             $this->item->StartTime $return['StartTime'];
  109.             $this->item->EndTime $return['EndTime'];
  110.             $this->item->Fees $return['Fees']['Fee'];
  111.         
  112.             return true;
  113.         }
  114.         return false;
  115.     }
  116. }
  117. ?>

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