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.2 2004/10/29 21:16:50 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.     * default parameters that will be used when
  27.     * adding an item
  28.     *
  29.     * @var  array 
  30.     */
  31.     protected $args = array(
  32.                             'CheckoutDetailsSpecified' => 0,
  33.                             'Country'                  => 'us',
  34.                             'Currency'                 => '1',
  35.                             'Duration'                 => '7',
  36.                             'MinimumBid'               => '1.0',
  37.                             'Quantity'                 => '1',
  38.                             'Region'                   => '0',
  39.                             'Version'                  => '2'
  40.                             );
  41.  
  42.    /**
  43.     * item that should be added
  44.     *
  45.     * @var  object Services_Ebay_Model_Item 
  46.     */
  47.     protected $item;
  48.  
  49.    /**
  50.     * constructor
  51.     *
  52.     * @param    array 
  53.     */
  54.     public function __construct($args)
  55.     {
  56.         $item $args[0];
  57.         
  58.         if (!$item instanceof Services_Ebay_Model_Item{
  59.             throw new Services_Ebay_Exception'No item passed.' );
  60.         }
  61.         $this->item = $item;
  62.         $this->args = array_merge$this->args$item->toArray() );
  63.     }
  64.     
  65.    /**
  66.     * make the API call
  67.     *
  68.     * @param    object Services_Ebay_Session 
  69.     * @return   string 
  70.     */
  71.     public function call(Services_Ebay_Session $session)
  72.     {
  73.         $return = parent::call($session);
  74.  
  75.         if (isset($return['Item'])) {
  76.             $returnItem $return['Item'];
  77.  
  78.             $this->item->Id $returnItem['Id'];
  79.             $this->item->StartTime $returnItem['StartTime'];
  80.             $this->item->EndTime $returnItem['EndTime'];
  81.             $this->item->Fees $returnItem['Fees'];
  82.         
  83.             return true;
  84.         }
  85.         return false;
  86.     }
  87. }
  88. ?>

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